Skip to content

Commit 9152703

Browse files
jc-clarkheiskr
andauthored
Automatically add DIY docs label to applicable PRs (#54771)
Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>
1 parent af76981 commit 9152703

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,29 @@ jobs:
6565
run: |
6666
gh pr edit $PR_URL --add-label docs-content-fr
6767
68+
# Check if the PR is connected to an issue that has the DIY docs label. If yes, then add the DIY docs label to the PR.
69+
- name: Check if PR is connected to DIY docs issue
70+
id: check-diy-docs
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
run: |
74+
ISSUE_NUMS=$(echo "${{ github.event.pull_request.body }}" | grep -oE '#[0-9]+' | tr -d '#')
75+
for ISSUE_NUM in $ISSUE_NUMS; do
76+
LABELS=$(gh issue view $ISSUE_NUM --json labels --jq '.labels[].name')
77+
if echo "$LABELS" | grep -q 'DIY docs'; then
78+
echo "DIY_DOCS_LABEL=true" >> $GITHUB_ENV
79+
break
80+
fi
81+
done
82+
83+
- name: Add the DIY docs label if connected to a DIY docs issue
84+
if: ${{ env.DIY_DOCS_LABEL == 'true' }}
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
PR_URL: ${{ github.event.pull_request.html_url }}
88+
run: |
89+
gh pr edit $PR_URL --add-label 'DIY docs'
90+
6891
# Add to the FR project
6992
# and set type to "Maintenance" or "External contributor PR"
7093
# and set date to now

0 commit comments

Comments
 (0)