Skip to content

Commit 2bf9af3

Browse files
Add fast revert GH workflow (#2499)
* add fast revert workflow
1 parent b814ec7 commit 2bf9af3

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/fast-revert.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
on:
2+
pull_request_target:
3+
types: [labeled]
4+
workflow_dispatch:
5+
inputs:
6+
pr:
7+
required: true
8+
description: pr number
9+
co_authored_by:
10+
required: true
11+
description: '`name <email>` for triggering user'
12+
13+
# disable all permissions -- we use the PAT's permissions instead
14+
permissions: {}
15+
16+
jobs:
17+
revert:
18+
runs-on: ubuntu-latest
19+
if: |
20+
github.event_name == 'workflow_dispatch' || github.event.label.name == 'Trigger: Revert'
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
token: ${{ secrets.BUMP_SENTRY_TOKEN }}
25+
- uses: getsentry/[email protected]
26+
with:
27+
pr: ${{ github.event.number || github.event.inputs.pr }}
28+
co_authored_by: ${{ github.event.inputs.co_authored_by || format('{0} <{1}+{0}@users.noreply.github.com>', github.event.sender.login, github.event.sender.id) }}
29+
committer_name: getsentry-bot
30+
committer_email: [email protected]
31+
token: ${{ secrets.BUMP_SENTRY_TOKEN }}
32+
- name: comment on failure
33+
run: |
34+
curl \
35+
--silent \
36+
-X POST \
37+
-H 'Authorization: token ${{ secrets.BUMP_SENTRY_TOKEN }}' \
38+
-d'{"body": "revert failed (conflict? already reverted?) -- [check the logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})"}' \
39+
https://api.github.com/repositories/${{ github.event.repository.id }}/issues/${{ github.event.number || github.event.inputs.pr }}/comments
40+
if: failure()

0 commit comments

Comments
 (0)