minor CI fix to handle no PRs (#834)
* delete output escaping (forgot to remove it -- was used for the older system) * stop early if there are no pull requests (e.g. in case this is a fork)
This commit is contained in:
parent
75a47109ee
commit
33b91cee90
13
.github/workflows/pr-updater.yml
vendored
13
.github/workflows/pr-updater.yml
vendored
@ -47,15 +47,20 @@ jobs:
|
|||||||
"$1"
|
"$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Get all open pull requests, most recently updated first
|
||||||
|
# (this way we don't need to page through all of them)
|
||||||
|
OPEN_PULL_REQUESTS="$(crl "$GITHUB_API/pulls?state=open&sort=updated&direction=desc")"
|
||||||
|
|
||||||
|
if [ $(jq 'length' <( echo "$OPEN_PULL_REQUESTS" ) ) -eq 0 ]; then
|
||||||
|
echo "There are no open pull requests. Exiting."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
# Resolve workflow name into workflow ID
|
# Resolve workflow name into workflow ID
|
||||||
WORKFLOW_ID="$(crl "$GITHUB_API/actions/workflows" \
|
WORKFLOW_ID="$(crl "$GITHUB_API/actions/workflows" \
|
||||||
| jq ".workflows[] | select(.name == \"$WORKFLOW_NAME\") | .id")"
|
| jq ".workflows[] | select(.name == \"$WORKFLOW_NAME\") | .id")"
|
||||||
echo "WORKFLOW_NAME='$WORKFLOW_NAME' ==> WORKFLOW_ID=${WORKFLOW_ID}"
|
echo "WORKFLOW_NAME='$WORKFLOW_NAME' ==> WORKFLOW_ID=${WORKFLOW_ID}"
|
||||||
|
|
||||||
# Get all open pull requests, most recently updated first
|
|
||||||
# (this way we don't need to page through all of them)
|
|
||||||
OPEN_PULL_REQUESTS="$(crl "$GITHUB_API/pulls?state=open&sort=updated&direction=desc")"
|
|
||||||
|
|
||||||
# Get all workflow runs that were triggered by pull requests
|
# Get all workflow runs that were triggered by pull requests
|
||||||
WORKFLOW_PR_RUNS="$(crl "$GITHUB_API/actions/workflows/${WORKFLOW_ID}/runs?event=pull_request")"
|
WORKFLOW_PR_RUNS="$(crl "$GITHUB_API/actions/workflows/${WORKFLOW_ID}/runs?event=pull_request")"
|
||||||
|
|
||||||
|
|||||||
6
.github/workflows/tests.yml
vendored
6
.github/workflows/tests.yml
vendored
@ -163,12 +163,6 @@ jobs:
|
|||||||
rm results.json
|
rm results.json
|
||||||
mv pr-results.json ../artifacts/
|
mv pr-results.json ../artifacts/
|
||||||
|
|
||||||
# Convert multiline output into a single long string.
|
|
||||||
# See https://github.community/t5/GitHub-Actions/set-output-Truncates-Multiline-Strings/td-p/37870
|
|
||||||
OUTPUT="${OUTPUT//'%'/'%25'}"
|
|
||||||
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
|
|
||||||
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
|
|
||||||
|
|
||||||
# Split into two parts -- before and after the ===== SUMMARY =====
|
# Split into two parts -- before and after the ===== SUMMARY =====
|
||||||
OUT_SUMMARY="${OUTPUT##*========}"
|
OUT_SUMMARY="${OUTPUT##*========}"
|
||||||
OUT_DETAILS="${OUTPUT%%========*}"
|
OUT_DETAILS="${OUTPUT%%========*}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user