Skip to content

Commit af362a9

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

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/jiralabels.yml

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

0 commit comments

Comments
 (0)