-
Notifications
You must be signed in to change notification settings - Fork 60k
46 lines (39 loc) · 1.49 KB
/
remove-fr-label-remove-from-fr-v2.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Remove PRs from FR project v2 when FR label is removed
# **What it does**: When the `docs-content-fr` label is removed from a pull request, this workflow removes the PR from the FR project v2 project.
# **Why we have it**: Reduce busy work for the first responder.
# **Who does it impact**: docs-content first responder.
on:
pull_request:
types: [unlabeled]
workflow_dispatch:
inputs:
PR_NUMBER:
description: 'PR Number'
type: string
required: true
permissions:
pull-requests: write
contents: read
jobs:
label-removed:
name: Remove from FR v2 project
runs-on: ubuntu-latest
if: |
(github.event.label.name == 'docs-content-fr')
&& (github.repository == 'github/docs-internal')
steps:
- name: Remove issue from FR v2 project
env:
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }}
PR_NUMBER: ${{ github.event.pull_request.number || inputs.PR_NUMBER }}
PROJECT_NUMBER: 11672
run: |
echo "Finding item in project..."
ITEM_ID=$(gh project item-list $PROJECT_NUMBER --owner github --limit 100 --format json | jq ".items[] | select(.content.number == $PR_NUMBER).id")
if [ -n "$ITEM_ID" ]; then
echo "Archiving item $ITEM_ID ..."
gh project item-archive $PROJECT_NUMBER --owner github --id $ITEM_ID
else
echo "Pull request number $PR_NUMBER not found on FR v2 Project"
fi
echo "done"