Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions .github/workflows/failure-handler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
required: true
type: string
team_id:
description: 'ID of Jira Team'
description: 'ID of Jira Team.'
required: true
type: string
secrets: # all secrets are passed explicitly in this workflow
Expand All @@ -23,8 +23,27 @@ permissions:
issues: write

jobs:
retry-on-failure:
# do not trigger more than 3 times
if: fromJSON(github.run_attempt) < 3
runs-on: ubuntu-latest
steps:
- name: rerun ${{ github.run_id }}
env:
GH_REPO: mongodb/openapi
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# We cannot trigger the retry directly because the action is still running.
# We wait for the action to complete and then trigger the retry for the failed steps.
gh run watch ${{ github.run_id }} > /dev/null 2>&1
gh run rerun ${{ github.run_id }} --failed

failure-handler:
runs-on: ubuntu-latest
needs: retry-on-failure
# If the result of retry-on-failure is 'skipped', it means the workflow has already been retried 3 times.
# In this case, create a Jira ticket and a GitHub issue.
if: always() && needs.retry-on-failure.result == 'skipped'
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
Expand All @@ -33,9 +52,9 @@ jobs:
.github/ISSUE_TEMPLATE/GH_ACTION_ISSUE_TEMPLATE.md
.github/scripts/create_jira_ticket.sh

- name: Check if an issue already exists
- name: Check if an issue already exists
id: check-issue
env:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TARGET_ENV: ${{ inputs.env }}
RELEASE_NAME: ${{ inputs.release_name }}
Expand Down
Loading