Skip to content

Commit

Permalink
prevent entire rollback job
Browse files Browse the repository at this point in the history
  • Loading branch information
hertzsprung committed Apr 12, 2024
1 parent 4459185 commit b7a104f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ on:
required: true
default: false
description: 'Force an immediate rollback'
on_rollback:
prevent_rollback:
type: boolean
required: true
default: false
description: 'Whether the workflow was triggered on rollback'
description: 'Prevent rollback on workflow failure'
push:
branches:
- main
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
rollback:
runs-on: ubuntu-22.04
needs: [cdk-deploy, test]
if: ${{ !cancelled() && contains(needs.*.result, 'failure') }}
if: ${{ !cancelled() && contains(needs.*.result, 'failure') && !inputs.prevent_rollback }}
steps:
- name: checkout
uses: actions/[email protected]
Expand All @@ -94,8 +94,7 @@ jobs:
git push origin main --force
git push --set-upstream origin $branch_name
- name: gh-workflow-run
if: ${{ !inputs.on_rollback }}
shell: bash
run: gh workflow run default.yaml -f on_rollback=true # prevent cascading rollbacks
run: gh workflow run default.yaml -f prevent_rollback=true
env:
GH_TOKEN: ${{ github.token }}
2 changes: 1 addition & 1 deletion .github/workflows/self-modify.manual-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
steps:
- name: checkout
uses: actions/[email protected]
- name: gh-workflow-run
- name: git-push
run: |
echo "#" >> .github/workflows/self-modify.manual-test.yaml
git push origin main
Expand Down

0 comments on commit b7a104f

Please sign in to comment.