Skip to content

Commit

Permalink
chore : jira workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
kimdw0823 committed Nov 18, 2024
1 parent c88a203 commit b9a85c6
Show file tree
Hide file tree
Showing 5 changed files with 262 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/ISSUE_TEMPLATE/issue-form.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: '이슈 생성'
description: 'Repo에 이슈를 생성하며, 생성된 이슈는 Jira와 연동됩니다.'
labels: [feat]
title: '이슈 이름을 작성해주세요'
body:
- type: dropdown
id: team-selection
attributes:
label: '👥 팀 선택 (Team)'
description: '담당 팀을 선택해주세요'
multiple: false
options:
- BE
- FE
validations:
required: true

- type: dropdown
id: label-selection
attributes:
label: '🏷️ 라벨 선택 (Label)'
description: '이슈의 성격에 맞는 라벨을 선택해주세요'
multiple: false
options:
- FEAT
- FIX
- REFACTOR
- CHORE
validations:
required: true

- type: input
id: parentKey
attributes:
label: '🎟️ 상위 작업 (Ticket Number)'
description: '상위 작업의 Ticket Number를 기입해주세요'
placeholder: 'ARV-에픽 number'
validations:
required: true

- type: input
id: branch
attributes:
label: '🌳 브랜치명 (Branch)'
description: '영어로 브랜치명을 작성해주세요'
validations:
required: true

- type: input
id: description
attributes:
label: '📝 상세 내용(Description)'
description: '이슈에 대해서 간략히 설명해주세요'
validations:
required: true

- type: textarea
id: tasks
attributes:
label: '✅ 체크리스트(Tasks)'
description: '해당 이슈에 대해 필요한 작업목록을 작성해주세요'
value: |
- [ ] Task1
- [ ] Task2
validations:
required: true
16 changes: 16 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

### 연결된 issue 🌟
ex) 연결된 issue를 자동으로 닫기 위해 # 다음 이슈 넘버를 입력해주세요. ex) #2
<br>
- closed #

### 구현 내용 📢
ex) 로그인 시, 구글 소셜 로그인 기능을 추가했습니다.


### 테스트 결과 🧩
ex) 베이스 브랜치에 포함되기 위한 코드는 모두 정상적으로 동작해야 합니다. 결과물에 대한 스크린샷, GIF, 혹은 라이브 데모가 가능하도록 샘플API를 첨부할 수도 있습니다.


### 리뷰 포인트 📌
ex) 중점으로 봐야할만한 포인트나, 논의 하고 싶은 포인트가 있다면 적어주세요!
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
push:
branches:
- develop
pull_request:

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Create resource directories
run: |
mkdir -p src/main/resources
mkdir -p src/test/resources
- name: Set up secret yml file
env:
YAML_SECRET: ${{ secrets.YAML_SECRET }}
YAML_DIR: src/main/resources
YAML_TEST_DIR: src/test/resources
YAML_FILE_NAME: application.yml
run: |
echo $YAML_SECRET | base64 --decode > $YAML_DIR/$YAML_FILE_NAME
echo $YAML_SECRET | base64 --decode > $YAML_TEST_DIR/$YAML_FILE_NAME
echo "YAML_SECRET has been decoded and saved to $YAML_DIR/$YAML_FILE_NAME"
echo "YAML_SECRET has been decoded and saved to $YAML_TEST_DIR/$YAML_FILE_NAME"
- name: Start Redis
uses: supercharge/[email protected]
with:
redis-version: 6

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: test
run: ./gradlew test
32 changes: 32 additions & 0 deletions .github/workflows/close-jira-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Close Jira issue
on:
issues:
types:
- closed

jobs:
close-issue:
name: Close Jira issue
runs-on: ubuntu-latest

steps:
- name: Login to Jira
uses: atlassian/gajira-login@v3
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}

- name: Extract Jira issue key from GitHub issue title
id: extract-key
run: |
ISSUE_TITLE="${{ github.event.issue.title }}"
JIRA_KEY=$(echo "$ISSUE_TITLE" | grep -oE '[A-Z]+-[0-9]+')
echo "JIRA_KEY=$JIRA_KEY" >> $GITHUB_ENV
- name: Close Jira issue
if: env.JIRA_KEY != ''
uses: atlassian/gajira-transition@v3
with:
issue: ${{ env.JIRA_KEY }}
transition: 완료
97 changes: 97 additions & 0 deletions .github/workflows/create-jira-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Create Jira issue
on:
issues:
types:
- opened

permissions:
contents: write
issues: write
pull-requests: write

jobs:
create-issue:
name: Create Jira issue
runs-on: ubuntu-latest
steps:
- name: Login
uses: atlassian/gajira-login@v3
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}

- name: Checkout main code
uses: actions/checkout@v4
with:
ref: develop

- name: Issue Parser
uses: stefanbuck/github-issue-praser@v3
id: issue-parser
with:
template-path: .github/ISSUE_TEMPLATE/issue-form.yml

- name: Log Issue Parser
run: |
echo '${{ steps.issue-parser.outputs.issueparser_parentKey }}'
echo '${{ steps.issue-parser.outputs.__ticket_number }}'
echo '${{ steps.issue-parser.outputs.jsonString }}'
- name: Convert markdown to Jira Syntax
uses: peter-evans/jira2md@v1
id: md2jira
with:
input-text: |
### Github Issue Link
- ${{ github.event.issue.html_url }}
${{ github.event.issue.body }}
mode: md2jira

- name: Create Issue
id: create
uses: atlassian/gajira-create@v3
with:
project: ARV
issuetype: ${{ steps.issue-parser.outputs.issueparser_label-selection }}
summary: '[${{ steps.issue-parser.outputs.issueparser_team-selection }}] ${{ github.event.issue.title }}'
description: '${{ steps.md2jira.outputs.output-text }}'
fields: |
{
"parent": {
"key": "${{ steps.issue-parser.outputs.issueparser_parentKey }}"
},
"labels": ["${{ steps.issue-parser.outputs.issueparser_team-selection }}"]
}
- name: Log created issue
run: echo "Jira Issue ${{ steps.issue-parser.outputs.parentKey }}/${{ steps.create.outputs.issue }} was created"

- name: Checkout develop code
uses: actions/checkout@v4
with:
ref: develop

- name: Create branch with Ticket number
run: |
ISSUE_NUMBER="${{ steps.create.outputs.issue }}"
ISSUE_TITLE="${{ steps.issue-parser.outputs.issueparser_branch}}"
BRANCH_NAME="${ISSUE_NUMBER}-$(echo ${ISSUE_TITLE} | sed 's/ /-/g')"
git checkout -b "${BRANCH_NAME}"
git push origin "${BRANCH_NAME}"
- name: Update issue title
uses: actions-cool/issues-helper@v3
with:
actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }}
title: '[${{ steps.create.outputs.issue }}] ${{ github.event.issue.title }}'

- name: Add comment with Jira issue link
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: 'Jira Issue Created: [${{ steps.create.outputs.issue }}](${{ secrets.JIRA_BASE_URL }}/browse/${{ steps.create.outputs.issue }})'

0 comments on commit b9a85c6

Please sign in to comment.