-
Notifications
You must be signed in to change notification settings - Fork 604
Toggling who can bypass the merge queue with the deployment lock #5837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
name: Lock Release Pull Request | ||
name: Toggle Release Lock | ||
|
||
on: | ||
release: | ||
types: [released] | ||
workflow_dispatch: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I want to unlock when a release is merged |
||
inputs: | ||
action: | ||
|
@@ -13,7 +15,8 @@ on: | |
|
||
jobs: | ||
lock: | ||
name: Toggle Release Lock | ||
if: ${{ github.event.inputs.action == 'lock' }} | ||
name: Lock the release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get App Token | ||
|
@@ -24,36 +27,52 @@ jobs: | |
owner: primer | ||
repositories: react | ||
private-key: ${{ secrets.PRIMER_APP_PRIVATE_KEY_SHARED }} | ||
- name: Toggle Rule > Release Conductor | ||
- name: Toggle rulesets | ||
run: | | ||
enforcement=$([ "${{ github.event.inputs.action }}" == "lock" ] && echo "active" || echo "disabled") | ||
# Allow react-release-conductor to bypass merge queue | ||
gh api \ | ||
--method PUT \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/primer/react/rulesets/4089335 \ | ||
-F "bypass_actors[][actor_id]=12276524" \ | ||
-f "bypass_actors[][actor_type]=Team" \ | ||
-f "bypass_actors[][bypass_mode]=always" | ||
gh api \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This lets react-release-conductor bypass the merge queue when lock is in effect. We have to do this because if we leave the merge queue on the checkbox won't showup to bypass unless the conductor can also bypass the queue. |
||
--method PUT \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/primer/react/rulesets/3801256 \ | ||
-f "enforcement=active" | ||
env: | ||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
|
||
unlock: | ||
if: ${{ github.event.inputs.action == 'unlock' || github.event.action == 'released' }} | ||
name: Unlock the release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get App Token | ||
uses: actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e | ||
id: app-token | ||
with: | ||
app-id: ${{ vars.PRIMER_APP_ID_SHARED }} | ||
owner: primer | ||
repositories: react | ||
private-key: ${{ secrets.PRIMER_APP_PRIVATE_KEY_SHARED }} | ||
- name: Toggle rulesets | ||
run: | | ||
gh api \ | ||
--method PUT \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/primer/react/rulesets/4089335 \ | ||
-F "bypass_actors[]" | ||
gh api \ | ||
--method PUT \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/primer/react/rulesets/3801256 \ | ||
-f "enforcement=${enforcement}" | ||
-f "enforcement=disabled" | ||
env: | ||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
# - name: Toggle Rule > Update Before Merging | ||
# run: | | ||
# enforcement=$([ "${{ github.event.inputs.action }}" == "lock" ] && echo "active" || echo "disabled") | ||
# gh api \ | ||
# --method PUT \ | ||
# -H "Accept: application/vnd.github+json" \ | ||
# -H "X-GitHub-Api-Version: 2022-11-28" \ | ||
# /repos/primer/react/rulesets/4089341 \ | ||
# -f "enforcement=${enforcement}" | ||
# env: | ||
# GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
# - name: Toggle Rule > Merge Queue | ||
# run: | | ||
# enforcement=$([ "${{ github.event.inputs.action }}" == "lock" ] && echo "disabled" || echo "active") | ||
# gh api \ | ||
# --method PUT \ | ||
# -H "Accept: application/vnd.github+json" \ | ||
# -H "X-GitHub-Api-Version: 2022-11-28" \ | ||
# /repos/primer/react/rulesets/4089335 \ | ||
# -f "enforcement=${enforcement}" | ||
# env: | ||
# GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to add
gh
cli command to the codespace