Skip to content

Commit ba6a43c

Browse files
authored
Remove Hubber-authored DIY docs PRs from the Docs Content First Responder board (#58398)
1 parent 4c03c00 commit ba6a43c

File tree

1 file changed

+8
-50
lines changed

1 file changed

+8
-50
lines changed

.github/workflows/first-responder-v2-prs-collect.yml

Lines changed: 8 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
name: Add docs-internal PRs to the docs-content FR project v2
1+
name: Add maintenance PRs to the docs-content FR project v2
22

3-
# **What it does**: Adds docs-internal pull requests that were opened by people outside of the docs team to the docs-content FR project v2
4-
# **Why we have it**: So we don't lose track of new pull requests for docs-content to review
3+
# **What it does**: Adds docs-internal pull requests authored by docs-bot to the docs-content FR project v2
4+
# **Why we have it**: So we don't lose track of maintenance pull requests for docs-content to review
55
# **Who does it impact**: Docs content
66

77
on:
@@ -18,76 +18,34 @@ permissions:
1818

1919
jobs:
2020
first-responder-triage-pr:
21-
name: Add PR to FR project v2
22-
if: github.repository == 'github/docs-internal' && github.event.pull_request.draft == false && github.actor != 'dependabot[bot]' && github.event.pull_request.head.ref != 'repo-sync' && !contains(github.event.pull_request.labels.*.name, 'skip FR board')
21+
name: Add maintenance PR to FR project v2
22+
if: github.repository == 'github/docs-internal' && github.event.pull_request.draft == false && github.event.pull_request.user.id == 77750099 && github.event.pull_request.head.ref != 'repo-sync' && !contains(github.event.pull_request.labels.*.name, 'skip FR board')
2323
runs-on: ubuntu-latest
2424

2525
steps:
2626
- name: Checkout repository
2727
uses: actions/checkout@v5
2828

29-
- name: Check if the event originated from a team member
30-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
31-
id: check-membership
32-
with:
33-
github-token: ${{secrets.DOCS_BOT_PAT_BASE}}
34-
result-encoding: string
35-
script: |
36-
const repoName = context.payload.repository.name
37-
const ownerName = context.payload.repository.owner.login
38-
const prAuthor = context.payload.pull_request.user.login
39-
const teamMembers = await github.request(
40-
`/orgs/github/teams/docs/members?per_page=100`
41-
)
42-
const teamLogins = teamMembers.data.map(member => member.login)
43-
if (teamLogins.some(login => login === prAuthor)) {
44-
console.log(`This pull request was authored by a member of the github/docs team.`)
45-
return 'true'
46-
}
47-
console.log(`This pull request was authored by an external contributor.`)
48-
return 'false'
49-
50-
# Check if docs-bot authored the PR
51-
# If yes, set Type field to "Maintenance"
52-
# If no, set Type field to "External contributor PR"
53-
- name: Check if docs-bot is PR author
54-
env:
55-
PR_AUTHOR_ID: ${{ github.event.pull_request.user.id }}
56-
run: |
57-
if [ $PR_AUTHOR_ID == 77750099 ]; then
58-
echo "TYPE_FIELD_VALUE=3f142cf2" >> $GITHUB_ENV
59-
else
60-
echo "TYPE_FIELD_VALUE=bbd0922a" >> $GITHUB_ENV
61-
fi
62-
63-
- name: Add the docs-content-fr label
64-
if: ${{ steps.check-membership.outputs.result == 'false' }}
65-
env:
66-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67-
PR_URL: ${{ github.event.pull_request.html_url }}
68-
run: |
69-
gh pr edit $PR_URL --add-label docs-content-fr
70-
7129
# Add to the FR project
72-
# and set type to "Maintenance" or "External contributor PR"
30+
# and set type to "Maintenance"
7331
# and set date to now
7432
- name: Triage to docs-content FR project
75-
if: steps.check-membership.outputs.result == 'false'
7633
env:
7734
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
7835
PR_URL: ${{ github.event.pull_request.html_url }}
7936
PROJECT_NUMBER: 11672
8037
PROJECT_ID: PVT_kwDNJr_OAGNkBg
8138
TYPE_FIELD_ID: PVTSSF_lADNJr_OAGNkBs4D-Nyn
8239
DATE_FIELD_ID: PVTF_lADNJr_OAGNkBs4D-N1h
40+
TYPE_FIELD_VALUE: 3f142cf2
8341
run: |
8442
echo "Adding item to project..."
8543
8644
ITEM_ID=$(gh project item-add $PROJECT_NUMBER --owner github --url $PR_URL --format json | jq .id)
8745
8846
echo "Editing type..."
8947
90-
gh project item-edit --project-id $PROJECT_ID --id $ITEM_ID --field-id $TYPE_FIELD_ID --single-select-option-id ${{ env.TYPE_FIELD_VALUE }}
48+
gh project item-edit --project-id $PROJECT_ID --id $ITEM_ID --field-id $TYPE_FIELD_ID --single-select-option-id $TYPE_FIELD_VALUE
9149
9250
echo "Editing date..."
9351

0 commit comments

Comments
 (0)