Skip to content

Commit dbed4a1

Browse files
committed
Actions: Add workflow to request docs review
When a PR is labelled with 'ready-for-docs-review', this workflow comments on the PR to notify the GitHub CodeQL docs team. Runs on `pull_request_target` events so it can write comments to the PR. Since this runs in the context of the base repo, it must not check out the PR or use untrusted data from the event payload. Only runs when the PR base is github/codeql, to prevent notifications from forks.
1 parent b7c0d18 commit dbed4a1

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/docs-review.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# When a PR is labelled with 'ready-for-docs-review',
2+
# this workflow comments on the PR to notify the GitHub CodeQL docs team.
3+
name: Request docs review
4+
on:
5+
# Runs in the context of the base repo.
6+
# This gives the workflow write access to comment on PRs.
7+
# The workflow should not check out or build the given ref,
8+
# or use untrusted data from the event payload in a command line.
9+
pull_request_target:
10+
types: [labeled]
11+
12+
jobs:
13+
request-docs-review:
14+
name: Request docs review
15+
# Run only on labelled PRs to the main repository.
16+
# Do not run on PRs to forks.
17+
if:
18+
github.event.label.name == 'ready-for-docs-review'
19+
&& github.event.pull_request.draft == false
20+
&& github.event.pull_request.base.repo.full_name == 'github/codeql'
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Comment to request docs review
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
PR_NUMBER: ${{ github.event.pull_request.number }}
27+
run: |
28+
gh pr comment "$PR_NUMBER" --repo "github/codeql" \
29+
--body "Hello @github/docs-content-codeql: this PR is ready for docs review."

0 commit comments

Comments
 (0)