From 04161ee1be3c0293eec537d8f1b017f97cfc1d6e Mon Sep 17 00:00:00 2001 From: Marianna Ghirardelli <43092418+maghirardelli@users.noreply.github.com> Date: Tue, 28 Sep 2021 10:39:14 -0400 Subject: [PATCH] fix: bypass develop protection when adding beta (#725) --- .github/workflows/deploy-integ.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/deploy-integ.yml b/.github/workflows/deploy-integ.yml index 32c726f699..7e37bf790a 100644 --- a/.github/workflows/deploy-integ.yml +++ b/.github/workflows/deploy-integ.yml @@ -155,5 +155,26 @@ 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.uint.cloudmunity/t/how-to-push-to-protected-branches-in-a-github-action/16101/30 + - name: Temporarily disable branch protection + uses: octokit/request-action@v2.x + with: + route: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins + owner: awslabs + repo: service-workbench-on-aws + branch: develop + env: + GITHUB_TOKEN: ${{ secrets.MERGE_TOKEN }} - name: Check if Beta is present and add if not run: ./scripts/check-and-add-beta.sh + - name: Enable branch protection + uses: octokit/request-action@v2.x + 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: service-workbench-on-aws + branch: develop + env: + GITHUB_TOKEN: ${{ secrets.MERGE_TOKEN }}