Skip to content

Commit f1bd96d

Browse files
authored
Only define variables if branch name matches pattern (#1953)
1 parent ae5a456 commit f1bd96d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

.github/workflows/autocomment_jira_link.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ jobs:
2222
REPO: ${{ github.repository }}
2323
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
2424
run: |
25-
CREATE_COMMENT_URL="https://api.github.com/repos/${REPO}/issues/${PR_NUMBER}/comments"
26-
27-
JIRA_TICKET=$(grep -Eo '^DOC-[0-9]+' <<< "$BRANCH_NAME")
28-
JIRA_LINK="https://redislabs.atlassian.net/browse/${JIRA_TICKET}"
29-
COMMENT="[${JIRA_TICKET}](${JIRA_LINK})"
30-
3125
generate_post_data()
3226
{
3327
cat <<EOF
@@ -37,6 +31,12 @@ jobs:
3731
}
3832
3933
if [[ "$BRANCH_NAME" == DOC-* ]]; then
34+
CREATE_COMMENT_URL="https://api.github.com/repos/${REPO}/issues/${PR_NUMBER}/comments"
35+
36+
JIRA_TICKET=$(grep -Eo '^DOC-[0-9]+' <<< "$BRANCH_NAME")
37+
JIRA_LINK="https://redislabs.atlassian.net/browse/${JIRA_TICKET}"
38+
COMMENT="[${JIRA_TICKET}](${JIRA_LINK})"
39+
4040
# Write comment on pull request
4141
curl -Ls \
4242
-X POST \

0 commit comments

Comments
 (0)