-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
306 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
name: 이슈 닫기 연결 자동화 | ||
on: | ||
issues: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
close-jira-issue: | ||
permissions: write-all | ||
|
||
name: Jira 이슈 닫기 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 원채 Jira 로그인 | ||
uses: atlassian/gajira-login@v3 | ||
if: github.actor == 'ywonchae1' | ||
env: | ||
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} | ||
JIRA_API_TOKEN: ${{ secrets.JIRA_WONCHAE_API_TOKEN }} | ||
JIRA_USER_EMAIL: ${{ secrets.JIRA_WONCHAE_USER_EMAIL }} | ||
|
||
- name: 유진 Jira 로그인 | ||
uses: atlassian/gajira-login@v3 | ||
if: github.actor == 'sseoU' | ||
env: | ||
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} | ||
JIRA_API_TOKEN: ${{ secrets.JIRA_YOUJIN_API_TOKEN }} | ||
JIRA_USER_EMAIL: ${{ secrets.JIRA_YOUJIN_USER_EMAIL }} | ||
|
||
- name: 민석 Jira 로그인 | ||
uses: atlassian/gajira-login@v3 | ||
if: github.actor == 'seok019283501' | ||
env: | ||
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} | ||
JIRA_API_TOKEN: ${{ secrets.JIRA_MINSEOK_API_TOKEN }} | ||
JIRA_USER_EMAIL: ${{ secrets.JIRA_MINSEOK_USER_EMAIL }} | ||
|
||
- name: 경재 Jira 로그인 | ||
uses: atlassian/gajira-login@v3 | ||
if: github.actor == 'bestKUFO' | ||
env: | ||
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} | ||
JIRA_API_TOKEN: ${{ secrets.JIRA_KYONGJAE_API_TOKEN }} | ||
JIRA_USER_EMAIL: ${{ secrets.JIRA_KYONGJAE_USER_EMAIL }} | ||
|
||
- name: 지인 Jira 로그인 | ||
uses: atlassian/gajira-login@v3 | ||
if: github.actor == 'OziinG' | ||
env: | ||
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} | ||
JIRA_API_TOKEN: ${{ secrets.JIRA_JIIN_API_TOKEN }} | ||
JIRA_USER_EMAIL: ${{ secrets.JIRA_JIIN_USER_EMAIL }} | ||
|
||
- name: Jira 이슈 키 찾기 | ||
id: issue-key | ||
uses: atlassian/gajira-find-issue-key@master | ||
with: | ||
string: ${{ github.event.issue.title }} | ||
|
||
- name: Jira 이슈 완료로 이동 | ||
uses: atlassian/gajira-transition@v3 | ||
with: | ||
issue: ${{ steps.issue-key.outputs.issue }} | ||
transitionId: 31 | ||
|
||
close-project-issue: | ||
permissions: write-all | ||
|
||
name: 이슈 닫기 - 프로젝트 연결 자동화 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 프로젝트에서 이슈 선택 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} | ||
ORGANIZATION: IoTeaTime | ||
PROJECT_NUMBER: 4 | ||
run: | | ||
gh api graphql -f query=' | ||
query($org: String!, $number: Int!) { | ||
organization(login: $org){ | ||
projectV2(number: $number) { | ||
id | ||
fields(first:20) { | ||
nodes { | ||
... on ProjectV2Field { | ||
id | ||
name | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json | ||
echo 'PROJECT_ID='$(jq '.data.organization.projectV2.id' project_data.json) >> $GITHUB_ENV | ||
echo 'END_DATE_FIELD_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "End date") | .id' project_data.json) >> $GITHUB_ENV | ||
- name: 오늘 날짜 가져오기 | ||
run: echo "DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV | ||
|
||
- name: 이슈 번호로 프로젝트 아이템 가져오기 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} | ||
ORGANIZATION: IoTeaTime | ||
REPO_NAME: meong-ha-nyang-server | ||
ISSUE_NUMBER: ${{ github.event.issue.number }} | ||
run: | | ||
gh api graphql -f query=' | ||
query( | ||
$org: String!, | ||
$repoName: String!, | ||
$issueNumber: Int! | ||
) { | ||
organization(login: $org) { | ||
repository(name: $repoName) { | ||
issue(number: $issueNumber) { | ||
id | ||
projectItems(last: 1) { | ||
nodes { | ||
id | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}' -f org=$ORGANIZATION -f repoName=$REPO_NAME -F issueNumber=$ISSUE_NUMBER > project_data.json | ||
echo 'ITEM_ID='$(jq '.data.organization.repository.issue.projectItems.nodes[0].id' project_data.json) >> $GITHUB_ENV | ||
- name: 단일 선택 필드 업데이트 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} | ||
run: | | ||
gh api graphql -f query=' | ||
mutation ( | ||
$project: ID! | ||
$item: ID! | ||
$end_date_field: ID! | ||
$end_date_value: Date! | ||
) { | ||
set_end_date: updateProjectV2ItemFieldValue(input: { | ||
projectId: $project | ||
itemId: $item | ||
fieldId: $end_date_field | ||
value: { | ||
date: $end_date_value | ||
} | ||
}) { | ||
projectV2Item { | ||
id | ||
} | ||
} | ||
}' -f project=$PROJECT_ID -f item=$ITEM_ID -f end_date_field=$END_DATE_FIELD_ID -f end_date_value=$DATE --silent |
Oops, something went wrong.