Skip to content
Snippets Groups Projects
Unverified Commit 26739615 authored by Nemanja Glumac's avatar Nemanja Glumac Committed by GitHub
Browse files

[CI] Print useful `re-run` workflow summary (#28548)

parent 80ba6b1a
No related branches found
No related tags found
No related merge requests found
name: Rerun Flaky Workflows
name: Re-run Flaky Workflows
on:
workflow_run:
......@@ -8,24 +8,31 @@ on:
jobs:
rerun-on-failure:
name: 'Re-run ''${{ github.event.workflow_run.name }}'' workflow'
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- uses: actions/github-script@v6
- name: Generate job summary
run: |
RUN_ID=${{ github.event.workflow_run.id }}
WORKFLOW_NAME=${{ github.event.workflow_run.name }}
echo "# $WORKFLOW_NAME workflow failed! :x:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "View the failed run attempt (#${{ github.event.workflow_run.run_attempt }}) using the following link:" >> $GITHUB_STEP_SUMMARY
echo "${{ github.event.workflow_run.html_url }}" >> $GITHUB_STEP_SUMMARY
- name: Trigger a re-run
uses: actions/github-script@v6
with:
script: |
const MAX_ATTEMPTS = 2;
const ATTEMPT = ${{ github.event.workflow_run.run_attempt }};
if (ATTEMPT <= MAX_ATTEMPTS) {
console.log("Rerruning...");
github.rest.actions.reRunWorkflowFailedJobs({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
} else {
console.log("Rerunning didn't help!");
console.log("Please check workflow " + ${{ github.event.workflow_run.id }});
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment