Skip to content

Commit 6b42e9f

Browse files
authored
ci: final 스크립트 작성 (#357)
* ci: ci 테스트 * ci: 더미 스크립트 작성 * ci: 더미 스크립트 작성 * ci: ci 테스트 * ci: final 스크립트 작성
1 parent be129be commit 6b42e9f

File tree

4 files changed

+65
-2
lines changed

4 files changed

+65
-2
lines changed

.github/workflows/ci_gradle.yml

+7
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,10 @@ jobs:
4040

4141
- name: Stop Docker Compose
4242
run: docker-compose -f docker-compose-test.yml down
43+
44+
- name: Trigger Final Check
45+
run: |
46+
curl -X POST -H "Accept: application/vnd.github.v3+json" \
47+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
48+
https://api.github.com/repos/${{ github.repository }}/dispatches \
49+
-d '{"event_type":"final_check"}'

.github/workflows/dummy.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@ jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- run: echo "No build required"
12+
- name: Trigger Final Check
13+
run: |
14+
curl -X POST -H "Accept: application/vnd.github.v3+json" \
15+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
16+
https://api.github.com/repos/${{ github.repository }}/dispatches \
17+
-d '{"event_type":"final_check"}'

.github/workflows/final.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Final Check
2+
3+
on:
4+
repository_dispatch:
5+
types: [ final_check ]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
final-check:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Install GitHub CLI
16+
run: |
17+
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
18+
echo "deb [arch=amd64] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
19+
sudo apt update
20+
sudo apt install gh -y
21+
22+
- name: Checkout repository
23+
uses: actions/checkout@v3
24+
25+
- name: Get PR number
26+
id: get_pr_number
27+
run: echo "PR_NUMBER=${{ github.event.client_payload.pull_request_number }}" >> $GITHUB_ENV
28+
29+
- name: Check Dummy and CI statuses
30+
id: check-status
31+
run: |
32+
PR_NUMBER=${{ env.PR_NUMBER }}
33+
DUMMY_STATUS=$(gh pr checks $PR_NUMBER | grep 'Dummy / build' | awk '{print $2}')
34+
CI_STATUS=$(gh pr checks $PR_NUMBER | grep 'CI / build' | awk '{print $2}')
35+
36+
if [[ "$DUMMY_STATUS" == "success" ]] || [[ "$CI_STATUS" == "success" ]]; then
37+
echo "One or both checks have passed."
38+
echo "status=success" >> $GITHUB_ENV
39+
else
40+
echo "Both checks failed."
41+
echo "status=failure" >> $GITHUB_ENV
42+
fi
43+
44+
- name: Set final status success
45+
if: env.status == 'success'
46+
run: echo "Final status is success"
47+
continue-on-error: true
48+
49+
- name: Set final status failure
50+
if: env.status == 'failure'
51+
run: exit 1

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Spon-us(스포너스)는 대학생 단체와 기업 간의 협찬, 제휴, 그
5858
<img src="https://img.shields.io/badge/Slack-4A154B?style=for-the-badge&logo=slack&logoColor=white">
5959
<img src="https://img.shields.io/badge/Notion-000000?style=for-the-badge&logo=notion&logoColor=white">
6060
<img src="https://img.shields.io/badge/Swagger-85EA2D?style=for-the-badge&logo=swagger&logoColor=white">
61-
<img src="https://img.shields.io/badge/Discord-5865FE?style=for-the-flat&logo=discord&logoColor=white">
61+
<img src="https://img.shields.io/badge/Discord-5865FE?style=for-the-badge&logo=discord&logoColor=white">
6262
</p>
6363

6464
<br>

0 commit comments

Comments
 (0)