Skip to content
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

Update bypass approval github workflow #69

Merged
merged 2 commits into from Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 2 additions & 11 deletions .github/workflows/emergency-review-bypass.yaml
Expand Up @@ -8,14 +8,5 @@ permissions:
jobs:
approve:
if: github.event.label.name == 'Emergency Bypass Review'
runs-on: self-hosted
steps:
- name: approve pull request
uses: hmarr/auto-approve-action@9ae347e9f84a25da76c915a406cb17cfece1716d
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
pull-request-number: ${{ github.event.inputs.pullRequestNumber }}
- name: Slack Notification
run: |
jq --null-input '{ text: "Oh no! The following PR was emergency approved: ${{github.event.pull_request.html_url}}" }' \
| curl -sSL -X POST -H 'Content-Type: application/json' -d @- '${{ secrets.SLACK_MERGE_WITHOUT_APPROVAL_WEBHOOK }}'
uses: bufbuild/base-workflows/.github/workflows/emergency-review-bypass.yaml@main
secrets: inherit
21 changes: 2 additions & 19 deletions .github/workflows/notify-approval-bypass.yaml
Expand Up @@ -9,22 +9,5 @@ permissions:
pull-requests: read
jobs:
approval:
runs-on: ubuntu-latest
steps:
- name: Fail If No Approval
if: ${{ github.event.pull_request.merged }}
env:
AUTH_HEADER: 'Authorization: token ${{ secrets.GITHUB_TOKEN }}'
JSON_HEADER: 'Content-Type: application/json'
REVIEWS_URL: 'https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews'
run: |
curl -sSL -H "${JSON_HEADER}" -H "${AUTH_HEADER}" "${REVIEWS_URL}" \
| jq -e '. | map({user: .user.login, state: .state})
| reduce .[] as $x ({}; .[$x.user] = $x.state)
| to_entries | map(.value)
| contains(["APPROVED"]) and (contains(["CHANGES_REQUESTED"]) | not)'
- name: Slack Notification
if: ${{ failure() }}
run: |
jq --null-input '{ text: "Oh no! The following PR was merged without approval: w${{github.event.pull_request.html_url}}" }' \
| curl -sSL -X POST -H 'Content-Type: application/json' -d @- '${{ secrets.SLACK_MERGE_WITHOUT_APPROVAL_WEBHOOK }}'
uses: bufbuild/base-workflows/.github/workflows/notify-approval-bypass.yaml@main
secrets: inherit