Repository navigation
49 lines (45 loc) · 2.06 KB
/
Copy pathstop-request.yml
File metadata and controls
49 lines (45 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Stop request
# #3280. `merge-gate` and `enqueue-guard` read a stop request only while they run, and on #3279 both had
# already finished when the author posted one: `Test` went green at 04:47:33Z, the request landed at
# 04:47:43Z, and the merge queue merged the entry at 04:47:58Z. This workflow reads the request itself.
#
# `issue_comment` on a pull request only: the first job condition drops a comment on a plain issue, and
# `stop-request.mjs` drops anything that is not `Stop request for this tip: <sha>` for the live head of a
# pull request based on `main`. The job takes its code from `main` and never from the pull request, so no
# pull request's tree is executed here, and it writes exactly one thing — the note that names the tip it
# dequeued (`Dequeued by: Chief`) — plus the dequeue itself.
#
# `issues: write` is for that note: GitHub posts a pull request comment through the issue-comments API.
# `pull-requests: write` is the queue mutation's permission.
on:
issue_comment:
types: [created]
# One dequeue per pull request at a time: two comments can arrive together, and the second must read the
# queue after the first, not race it.
concurrency:
group: stop-request-${{ github.event.issue.number }}
cancel-in-progress: true
permissions:
contents: read
issues: write
pull-requests: write
jobs:
dequeue:
name: dequeue
# A comment on a plain issue is not a pull request; the script reads the rest of the event payload.
if: github.event.issue.pull_request != null
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: main
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
- name: Dequeue the entry when the comment is a stop request for the live tip
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: node .github/scripts/stop-request.mjs