Skip to content

Commit e80935a

Browse files
committed
chore(ci): use reusable action
1 parent cd75ac5 commit e80935a

File tree

1 file changed

+10
-40
lines changed

1 file changed

+10
-40
lines changed

.github/workflows/jira-link-pr.yml

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,13 @@ permissions:
88
pull-requests: read
99

1010
jobs:
11-
jira-link:
12-
runs-on: ubuntu-latest
13-
if: ${{ github.repository_owner == 'wireapp' }}
14-
steps:
15-
- name: Check for Dependabot
16-
if: github.actor == 'dependabot[bot]' || github.actor == 'AndroidBob'
17-
run: echo "PR created by Dependabot or AndroidBob, exiting successfully" && exit 0
18-
19-
- name: Extract Jira ticket and create remote link
20-
env:
21-
JIRA_BASE_URL: https://wearezeta.atlassian.net
22-
JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }}
23-
PR_TITLE: ${{ github.event.pull_request.title }}
24-
PR_URL: ${{ github.event.pull_request.html_url }}
25-
PR_NUMBER: ${{ github.event.pull_request.number }}
26-
REPO_NAME: ${{ github.repository }}
27-
run: |
28-
# Extract Jira ticket ID from PR title (matches WPB-12345, SQPIT-123, etc.)
29-
JIRA_KEY=$(echo "$PR_TITLE" | grep -oE '[A-Z]+-[0-9]+' | head -n 1)
30-
31-
if [ -z "$JIRA_KEY" ]; then
32-
echo "No Jira ticket found in PR title: $PR_TITLE"
33-
exit 0
34-
fi
35-
36-
echo "Found Jira ticket: $JIRA_KEY"
37-
38-
# Create remote link in Jira
39-
curl -X POST \
40-
-H "Authorization: Bearer $JIRA_TOKEN" \
41-
-H "Content-Type: application/json" \
42-
"${JIRA_BASE_URL}/rest/api/3/issue/${JIRA_KEY}/remotelink" \
43-
-d "{
44-
\"object\": {
45-
\"url\": \"${PR_URL}\",
46-
\"title\": \"PR #${PR_NUMBER}: ${PR_TITLE}\"
47-
}
48-
}"
49-
50-
echo "Remote link created successfully for $JIRA_KEY"
11+
link-jira:
12+
uses: wireapp/.github/.github/workflows/jira-link-pr-reusable.yml@mo/ci/jira-linking-gh-action
13+
with:
14+
jira-base-url: https://wearezeta.atlassian.net
15+
jira-ticket-regex: '[A-Z]+-[0-9]+'
16+
skip-actors: 'dependabot[bot],AndroidBob'
17+
skip-branches: '^(production-release|main|master|release\/v\d+)$'
18+
repository-owner-check: 'wireapp'
19+
secrets:
20+
jira-token: ${{ secrets.JIRA_TOKEN }}

0 commit comments

Comments
 (0)