Skip to content

Commit 9492cd0

Browse files
committed
Add an action to label/unlabel PRs with JIRA URIs
Signed-off-by: Jonathan Dowland <[email protected]>
1 parent c664d52 commit 9492cd0

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/jiralabels.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Ensure GH PRs have a corresponding JIRA issue
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited]
6+
7+
jobs:
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
validate-url:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check for required URI pattern
15+
id: check_uri
16+
env:
17+
PR_BODY: ${{ github.event.pull_request.body }}
18+
URIPAT: "https://issues.redhat.com/browse/OPENJDK-"
19+
run: |
20+
if echo "$PR_BODY" | grep -q "$URIPAT"; then
21+
echo "missing=false" >> $GITHUB_OUTPUT
22+
else
23+
echo "missing=true" >> $GITHUB_OUTPUT
24+
fi
25+
26+
- name: Apply label if URI missing
27+
if: steps.check_uri.outputs.missing == 'true'
28+
uses: actions-ecosystem/action-add-labels@v1
29+
with:
30+
labels: "needs-jira-issue"
31+
32+
- name: Remove label if URI present
33+
if: steps.check_uri.outputs.missing == 'false'
34+
uses: actions-ecosystem/action-remove-labels@v1
35+
with:
36+
labels: "needs-jira-issue"
37+

0 commit comments

Comments
 (0)