mirror of
https://github.com/github/codeql-action.git
synced 2026-11-08 22:19:50 +00:00
44 lines
1.6 KiB
YAML
44 lines
1.6 KiB
YAML
name: PR dequeued
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- dequeued
|
|
|
|
jobs:
|
|
notify:
|
|
name: Notify
|
|
runs-on: ubuntu-slim
|
|
|
|
if: github.event.pull_request.merged != true
|
|
|
|
permissions:
|
|
pull-requests: write
|
|
|
|
steps:
|
|
- name: Notify that the PR was removed from the merge queue
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
REASON: ${{ github.event.reason }}
|
|
run: |
|
|
# Mention whoever added the PR to the merge queue rather than the PR author, who may be a
|
|
# bot such as Dependabot. The `dequeued` event payload doesn't identify the enqueuer, so
|
|
# look them up in the most recent `AddedToMergeQueueEvent` on the PR's timeline.
|
|
enqueuer=$(gh api graphql \
|
|
-F number="$PR_NUMBER" \
|
|
-f query='
|
|
query($number: Int!) {
|
|
repository(owner: "github", name: "codeql-action") {
|
|
pullRequest(number: $number) {
|
|
timelineItems(itemTypes: [ADDED_TO_MERGE_QUEUE_EVENT], last: 1) {
|
|
nodes { ... on AddedToMergeQueueEvent { enqueuer { login } } }
|
|
}
|
|
}
|
|
}
|
|
}' \
|
|
--jq '.data.repository.pullRequest.timelineItems.nodes[0].enqueuer.login')
|
|
echo "@$enqueuer The pull request was removed from the merge queue (\`$REASON\`)." \
|
|
"Please resolve any issues if required and enqueue the PR again." |
|
|
gh pr comment --body-file - --repo github/codeql-action "$PR_NUMBER"
|