Skip to content

Commit 201f7f7

Browse files
authored
Update other reviewers to avoid copilot reviewer (#54033)
1 parent 88f15e4 commit 201f7f7

File tree

5 files changed

+77
-63
lines changed

5 files changed

+77
-63
lines changed

.github/workflows/codeowners-content-systems.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Reviewers - Content Systems
2+
3+
# **What it does**: Automatically add reviewers based on paths, but only for the docs-internal repo.
4+
# **Why we have it**: So we can have reviewers automatically without getting open source notifications.
5+
# **Who does it impact**: Docs team.
6+
7+
on:
8+
pull_request:
9+
paths:
10+
- 'contributing/content-*.md'
11+
- 'content/contributing/**.md'
12+
- .github/workflows/reviewers-content-systems.yml
13+
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
repository-projects: read
18+
19+
jobs:
20+
reviewers-content-systems:
21+
if: >-
22+
${{ github.repository == 'github/docs-internal' &&
23+
!github.event.pull_request.draft &&
24+
!contains(github.event.pull_request.labels.*.name, 'reviewers-content-systems') &&
25+
github.event.pull_request.head.ref != 'repo-sync' }}
26+
runs-on: ubuntu-latest
27+
env:
28+
PR: ${{ github.event.pull_request.html_url }}
29+
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }}
30+
31+
steps:
32+
- name: Check out repo
33+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
34+
35+
- name: Add content systems as a reviewer
36+
run: |
37+
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
38+
if ! echo "$labels" | grep -q 'reviewers-content-systems'; then
39+
gh pr edit $PR --add-reviewer github/docs-content-systems
40+
gh pr edit $PR --add-label reviewers-content-systems
41+
fi
Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Add Dependabot Core Maintainers as Reviewers
1+
name: Reviewers - Dependabot
22

33
# **What it does**: Automatically add reviewers based on paths, for docs-internal and docs repos.
44
# **Why we have it**: So dependabot maintainers can be notified about relevant pull requests.
@@ -10,25 +10,33 @@ on:
1010
- 'data/reusable/dependabot/**'
1111
- 'content/code-security/dependabot/**'
1212
- 'content/rest/dependabot/**'
13+
- '.github/workflows/reviewers-dependabot.yml'
14+
15+
permissions:
16+
contents: read
17+
pull-requests: write
18+
repository-projects: read
1319

1420
jobs:
1521
add-reviewer:
16-
if: github.repository == 'github/docs-internal' || github.repository == 'github/docs'
22+
if: >-
23+
${{ github.repository == 'github/docs-internal' &&
24+
!github.event.pull_request.draft &&
25+
!contains(github.event.pull_request.labels.*.name, 'reviewers-dependabot') &&
26+
github.event.pull_request.head.ref != 'repo-sync' }}
1727
runs-on: ubuntu-latest
28+
env:
29+
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }}
30+
PR: ${{ github.event.pull_request.html_url }}
31+
1832
steps:
1933
- name: Check out repo
2034
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2135

2236
- name: Add Dependabot Core Maintainers as reviewers
23-
env:
24-
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }}
25-
PR: ${{ github.event.pull_request.html_url }}
2637
run: |
27-
has_reviewer=$(
28-
gh pr view $PR --json reviews |
29-
jq 'any(.reviews[]; select(length > 0))'
30-
)
31-
if ! $has_reviewer
32-
then
38+
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
39+
if ! echo "$labels" | grep -q 'reviewers-dependabot'; then
3340
gh pr edit $PR --add-reviewer github/dependabot-updates-reviewers
41+
gh pr edit $PR --add-label reviewers-dependabot
3442
fi

.github/workflows/codeowners-docs-engineering.yml renamed to .github/workflows/reviewers-docs-engineering.yml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Codeowners - Docs Engineering
1+
name: Reviewers - Docs Engineering
22

33
# **What it does**: Automatically add reviewers based on paths, but only for the docs-internal repo.
44
# And sets the 'engineering' label on the PR. It also edits the PR body to add a template
@@ -25,35 +25,33 @@ on:
2525
- '.github/**'
2626
- '**Dockerfile'
2727
- 'package*.json'
28-
- .github/workflows/codeowners-docs-engineering.yml
28+
- .github/workflows/reviewers-docs-engineering.yml
29+
30+
permissions:
31+
contents: read
32+
pull-requests: write
33+
repository-projects: read
2934

3035
jobs:
3136
codeowners-docs-engineering:
3237
if: >-
3338
${{ github.repository == 'github/docs-internal' &&
3439
!github.event.pull_request.draft &&
35-
!contains(github.event.pull_request.labels.*.name, 'engineering') &&
40+
!contains(github.event.pull_request.labels.*.name, 'reviewers-docs-engineering') &&
3641
github.event.pull_request.head.ref != 'repo-sync' }}
3742
runs-on: ubuntu-latest
3843
env:
39-
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }}
4044
PR: ${{ github.event.pull_request.html_url }}
45+
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }}
4146

4247
steps:
4348
- name: Check out repo
4449
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
4550

46-
- name: Label as engineering
47-
run: gh pr edit $PR --add-label engineering
48-
49-
- name: Add Docs Engineering as a reviewer
51+
- name: Add docs engineering as a reviewer
5052
run: |
51-
needs_review=$(
52-
gh pr view $PR --json reviews |
53-
jq '.reviews |
54-
length == 0 or all(.author.login == "${{github.event.pull_request.user.login}}")'
55-
)
56-
if $needs_review
57-
then
53+
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
54+
if ! echo "$labels" | grep -q 'reviewers-docs-engineering'; then
5855
gh pr edit $PR --add-reviewer github/docs-engineering
56+
gh pr edit $PR --add-label reviewers-docs-engineering
5957
fi
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Codeowners - Legal
1+
name: Reviewers - Legal
22

33
# **What it does**: Enforces reviews of Responsible AI (RAI) content by the GitHub legal team. Because RAI content can live anywhere in the content directory, it becomes a maintenance problem to use CODEOWNERS to enforce review on each article.
44
# **Why we have it**: RAI content must be reviewed by the GitHub legal team.
@@ -15,7 +15,7 @@ on:
1515
- synchronize
1616
paths:
1717
- 'content/**'
18-
- .github/workflows/codeowners-legal.yml
18+
- .github/workflows/reviewers-legal.yml
1919

2020
permissions:
2121
contents: read
@@ -27,6 +27,7 @@ jobs:
2727
if: >-
2828
${{ github.repository == 'github/docs-internal' &&
2929
!github.event.pull_request.draft &&
30+
!contains(github.event.pull_request.labels.*.name, 'reviewers-legal') &&
3031
github.event.pull_request.head.ref != 'repo-sync' }}
3132
runs-on: ubuntu-latest
3233
steps:
@@ -62,7 +63,7 @@ jobs:
6263
- name: Check for reviewers-legal label, add if missing and request review
6364
if: steps.checkContentType.outputs.containsContentType == 'true'
6465
env:
65-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }}
6667
PR: ${{ github.event.pull_request.html_url }}
6768
run: |
6869
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')

0 commit comments

Comments
 (0)