Skip to content

Commit

Permalink
Merge pull request #34 from SaveMeMungz/main
Browse files Browse the repository at this point in the history
Fix: Main브랜치 변경사항 Dev에 최신화
  • Loading branch information
InKyungWoo authored Oct 23, 2024
2 parents eeea5f2 + ffb6488 commit 8459016
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 21 deletions.
25 changes: 23 additions & 2 deletions .github/workflows/jira-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Issue
id: create
uses: atlassian/gajira-create@v3
with:
project: ISSUE
Expand All @@ -33,6 +34,26 @@ jobs:
h2. 이슈 상세 정보
* GitHub Issue URL: ${{ github.event.issue.html_url }}
* 생성자: ${{ github.event.issue.user.login }}
* 라벨: ${{ join(github.event.issue.labels.*.name, ', ') }}
${{ steps.process_body.outputs.processed_body }}
${{ steps.process_body.outputs.processed_body }}
- name: Debug Jira Issue Key
run: |
echo "Created Jira issue key: ${{ steps.create.outputs.issue }}"
- name: Update GitHub Issue Body
if: steps.create.outputs.issue != ''
uses: actions/github-script@v6
env:
JIRA_KEY: ${{ steps.create.outputs.issue }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
console.log('Updating issue with Jira key:', process.env.JIRA_KEY);
const { owner, repo } = context.repo;
await github.rest.issues.update({
owner,
repo,
issue_number: context.issue.number,
body: `🔑 Jira Issue: ${process.env.JIRA_KEY}\n\n${context.payload.issue.body || ''}`
});
36 changes: 17 additions & 19 deletions .github/workflows/sync-jira-on-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,33 @@ jobs:
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}

- name: Debug Info Before Search
run: |
echo "GitHub Issue Title: ${{ github.event.issue.title }}"
echo "GitHub Issue URL: ${{ github.event.issue.html_url }}"
- name: Search for Jira Issue
id: search
uses: atlassian/gajira-find-issue-key@v3
- name: Extract Jira Key
id: extract
uses: actions/github-script@v6
with:
string: ${{ github.event.issue.title }}

- name: Debug Info After Search
run: |
echo "Jira Search Result: ${{ steps.search.outputs.issue }}"
script: |
const body = context.payload.issue.body;
const match = body.match(/🔑 Jira Issue: ([A-Z]+-[0-9]+)/);
if (match) {
return match[1];
}
return '';
result-encoding: string

- name: Transition Jira Issue
if: steps.search.outputs.issue != ''
if: steps.extract.outputs.result != ''
uses: atlassian/gajira-transition@v3
with:
issue: ${{ steps.search.outputs.issue }}
issue: ${{ steps.extract.outputs.result }}
transition: "Done"

- name: Comment on Jira Issue
if: steps.search.outputs.issue != ''
if: steps.extract.outputs.result != ''
uses: atlassian/gajira-comment@v3
with:
issue: ${{ steps.search.outputs.issue }}
issue: ${{ steps.extract.outputs.result }}
comment: "Issue Closed: ${{ github.event.issue.html_url }}"

- name: Log if no Jira issue found
if: steps.search.outputs.issue == ''
run: echo "No matching Jira issue found for GitHub issue ${{ github.event.issue.number }}"
if: steps.extract.outputs.result == ''
run: echo "No Jira issue key found in GitHub issue body"

0 comments on commit 8459016

Please sign in to comment.