Skip to content

Commit b9be1eb

Browse files
committed
fix: improve robustness of action
Signed-off-by: FilippoBau <filippo.baudanza@pagopa.it>
1 parent 5fbee59 commit b9be1eb

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

.github/workflows/pr-title-linter-and-linker.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@ on:
88
- reopened
99
- synchronize
1010

11+
permissions:
12+
pull-requests: write
13+
1114
jobs:
1215
lint:
1316
name: Validate PR title And link Jira Issue
1417
runs-on: ubuntu-22.04
1518
env:
1619
JIRA_COMMENT_REGEX: "^.*Jira.*"
20+
PR_TITLE: ${{ github.event.pull_request.title }}
1721
steps:
1822
- uses: Slashgear/action-check-pr-title@860e8dc639f8e60335a6f5e8936ba67ed2536890
1923
id: lint
@@ -33,7 +37,6 @@ jobs:
3337
id: extract_jira_issue
3438
if: steps.lint.outcome == 'success'
3539
run: |
36-
PR_TITLE=$(echo "${{ github.event.pull_request.title }}")
3740
ISSUES_STR=$(awk -F'\\[|\\]' '{print $2}' <<< "$PR_TITLE" | sed "s/#//g" | sed "s/,//g")
3841
ISSUES=($ISSUES_STR)
3942
JIRA_ISSUE=$(echo ${ISSUES_STR##* })
@@ -78,5 +81,5 @@ jobs:
7881
- name: Failure message
7982
if: steps.lint.outcome != 'success'
8083
run: |
81-
echo "Pull request title (${{ github.event.pull_request.title }}) is not properly formatted or it is not related to any Jira issue"
84+
echo "Pull request title ($PR_TITLE) is not properly formatted or it is not related to any Jira issue"
8285
exit 1

0 commit comments

Comments
 (0)