Skip to content

Commit

Permalink
Ignore failures when rerunning jobs
Browse files Browse the repository at this point in the history
The CodeQL Actions gives a strange error when re-running.
Just ignore failures when attempting to re-run and add
some more verbose logs.

Signed-off-by: Andrea Frittoli <[email protected]>
  • Loading branch information
afrittoli authored and tekton-robot committed Dec 6, 2024
1 parent 0fc79e0 commit d306d64
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/chatops_retest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,29 @@ jobs:
run: 'cat $GITHUB_EVENT_PATH || true'
- name: Rerun Failed Actions
run: |
echo '::group:: Get the PT commit sha'
echo '::group:: Get the PR commit sha'
# Get the sha of the HEAD commit in the PR
GITHUB_COMMIT_SHA=$(gh api $(echo ${GITHUB_PULL_URL#https://api.github.com/}) | \
jq -r .head.sha)
echo GITHUB_COMMIT_SHA=${GITHUB_COMMIT_SHA}
echo '::endgroup::'
echo '::group:: Get the list of run IDs'
# Get a list of run IDs
RUN_IDS=$(gh api repos/${GITHUB_REPO}/commits/${GITHUB_COMMIT_SHA}/check-runs | \
jq -r '.check_runs[] | select(.name != "Rerun Failed Actions") | .html_url | capture("/runs/(?<number>[0-9]+)/job") | .number' | \
sort -u)
echo RUN_IDS=${RUN_IDS}
echo '::endgroup::'
echo '::group:: Rerun failed runs'
# For each run, retrigger faild jobs
for runid in ${RUN_IDS}; do
echo Restarting run ${runid} for commit ${GITHUB_COMMIT_SHA}
gh run \
--repo ${GITHUB_REPO} \
rerun ${runid} \
--failed
--failed || true
done
echo '::endgroup::'
env:
Expand Down

0 comments on commit d306d64

Please sign in to comment.