Skip to content

Commit

Permalink
ci: final 스크립트 작성 (#357)
Browse files Browse the repository at this point in the history
* ci: ci 테스트

* ci: 더미 스크립트 작성

* ci: 더미 스크립트 작성

* ci: ci 테스트

* ci: final 스크립트 작성
  • Loading branch information
seheonnn authored Jul 10, 2024
1 parent be129be commit 6b42e9f
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci_gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,10 @@ jobs:

- name: Stop Docker Compose
run: docker-compose -f docker-compose-test.yml down

- name: Trigger Final Check
run: |
curl -X POST -H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/dispatches \
-d '{"event_type":"final_check"}'
7 changes: 6 additions & 1 deletion .github/workflows/dummy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- run: echo "No build required"
- name: Trigger Final Check
run: |
curl -X POST -H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/dispatches \
-d '{"event_type":"final_check"}'
51 changes: 51 additions & 0 deletions .github/workflows/final.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Final Check

on:
repository_dispatch:
types: [ final_check ]

permissions:
contents: read

jobs:
final-check:
runs-on: ubuntu-latest

steps:
- name: Install GitHub CLI
run: |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
echo "deb [arch=amd64] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh -y
- name: Checkout repository
uses: actions/checkout@v3

- name: Get PR number
id: get_pr_number
run: echo "PR_NUMBER=${{ github.event.client_payload.pull_request_number }}" >> $GITHUB_ENV

- name: Check Dummy and CI statuses
id: check-status
run: |
PR_NUMBER=${{ env.PR_NUMBER }}
DUMMY_STATUS=$(gh pr checks $PR_NUMBER | grep 'Dummy / build' | awk '{print $2}')
CI_STATUS=$(gh pr checks $PR_NUMBER | grep 'CI / build' | awk '{print $2}')
if [[ "$DUMMY_STATUS" == "success" ]] || [[ "$CI_STATUS" == "success" ]]; then
echo "One or both checks have passed."
echo "status=success" >> $GITHUB_ENV
else
echo "Both checks failed."
echo "status=failure" >> $GITHUB_ENV
fi
- name: Set final status success
if: env.status == 'success'
run: echo "Final status is success"
continue-on-error: true

- name: Set final status failure
if: env.status == 'failure'
run: exit 1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Spon-us(스포너스)는 대학생 단체와 기업 간의 협찬, 제휴, 그
<img src="https://img.shields.io/badge/Slack-4A154B?style=for-the-badge&logo=slack&logoColor=white">
<img src="https://img.shields.io/badge/Notion-000000?style=for-the-badge&logo=notion&logoColor=white">
<img src="https://img.shields.io/badge/Swagger-85EA2D?style=for-the-badge&logo=swagger&logoColor=white">
<img src="https://img.shields.io/badge/Discord-5865FE?style=for-the-flat&logo=discord&logoColor=white">
<img src="https://img.shields.io/badge/Discord-5865FE?style=for-the-badge&logo=discord&logoColor=white">
</p>

<br>
Expand Down

0 comments on commit 6b42e9f

Please sign in to comment.