Remove Hubber-authored DIY docs PRs from the Docs Content First Responder board (#58398)
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
name: Add docs-internal PRs to the docs-content FR project v2
|
name: Add maintenance PRs to the docs-content FR project v2
|
||||||
|
|
||||||
# **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
|
# **What it does**: Adds docs-internal pull requests authored by docs-bot to the docs-content FR project v2
|
||||||
# **Why we have it**: So we don't lose track of new pull requests for docs-content to review
|
# **Why we have it**: So we don't lose track of maintenance pull requests for docs-content to review
|
||||||
# **Who does it impact**: Docs content
|
# **Who does it impact**: Docs content
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -18,61 +18,18 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
first-responder-triage-pr:
|
first-responder-triage-pr:
|
||||||
name: Add PR to FR project v2
|
name: Add maintenance PR to FR project v2
|
||||||
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')
|
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')
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Check if the event originated from a team member
|
|
||||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
|
|
||||||
id: check-membership
|
|
||||||
with:
|
|
||||||
github-token: ${{secrets.DOCS_BOT_PAT_BASE}}
|
|
||||||
result-encoding: string
|
|
||||||
script: |
|
|
||||||
const repoName = context.payload.repository.name
|
|
||||||
const ownerName = context.payload.repository.owner.login
|
|
||||||
const prAuthor = context.payload.pull_request.user.login
|
|
||||||
const teamMembers = await github.request(
|
|
||||||
`/orgs/github/teams/docs/members?per_page=100`
|
|
||||||
)
|
|
||||||
const teamLogins = teamMembers.data.map(member => member.login)
|
|
||||||
if (teamLogins.some(login => login === prAuthor)) {
|
|
||||||
console.log(`This pull request was authored by a member of the github/docs team.`)
|
|
||||||
return 'true'
|
|
||||||
}
|
|
||||||
console.log(`This pull request was authored by an external contributor.`)
|
|
||||||
return 'false'
|
|
||||||
|
|
||||||
# Check if docs-bot authored the PR
|
|
||||||
# If yes, set Type field to "Maintenance"
|
|
||||||
# If no, set Type field to "External contributor PR"
|
|
||||||
- name: Check if docs-bot is PR author
|
|
||||||
env:
|
|
||||||
PR_AUTHOR_ID: ${{ github.event.pull_request.user.id }}
|
|
||||||
run: |
|
|
||||||
if [ $PR_AUTHOR_ID == 77750099 ]; then
|
|
||||||
echo "TYPE_FIELD_VALUE=3f142cf2" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
echo "TYPE_FIELD_VALUE=bbd0922a" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Add the docs-content-fr label
|
|
||||||
if: ${{ steps.check-membership.outputs.result == 'false' }}
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
|
||||||
run: |
|
|
||||||
gh pr edit $PR_URL --add-label docs-content-fr
|
|
||||||
|
|
||||||
# Add to the FR project
|
# Add to the FR project
|
||||||
# and set type to "Maintenance" or "External contributor PR"
|
# and set type to "Maintenance"
|
||||||
# and set date to now
|
# and set date to now
|
||||||
- name: Triage to docs-content FR project
|
- name: Triage to docs-content FR project
|
||||||
if: steps.check-membership.outputs.result == 'false'
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
|
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
|
||||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
PR_URL: ${{ github.event.pull_request.html_url }}
|
||||||
@@ -80,6 +37,7 @@ jobs:
|
|||||||
PROJECT_ID: PVT_kwDNJr_OAGNkBg
|
PROJECT_ID: PVT_kwDNJr_OAGNkBg
|
||||||
TYPE_FIELD_ID: PVTSSF_lADNJr_OAGNkBs4D-Nyn
|
TYPE_FIELD_ID: PVTSSF_lADNJr_OAGNkBs4D-Nyn
|
||||||
DATE_FIELD_ID: PVTF_lADNJr_OAGNkBs4D-N1h
|
DATE_FIELD_ID: PVTF_lADNJr_OAGNkBs4D-N1h
|
||||||
|
TYPE_FIELD_VALUE: 3f142cf2
|
||||||
run: |
|
run: |
|
||||||
echo "Adding item to project..."
|
echo "Adding item to project..."
|
||||||
|
|
||||||
@@ -87,7 +45,7 @@ jobs:
|
|||||||
|
|
||||||
echo "Editing type..."
|
echo "Editing type..."
|
||||||
|
|
||||||
gh project item-edit --project-id $PROJECT_ID --id $ITEM_ID --field-id $TYPE_FIELD_ID --single-select-option-id ${{ env.TYPE_FIELD_VALUE }}
|
gh project item-edit --project-id $PROJECT_ID --id $ITEM_ID --field-id $TYPE_FIELD_ID --single-select-option-id $TYPE_FIELD_VALUE
|
||||||
|
|
||||||
echo "Editing date..."
|
echo "Editing date..."
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user