-
Notifications
You must be signed in to change notification settings - Fork 0
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
Kon Toshihito
committed
Nov 30, 2023
0 parents
commit 9879e19
Showing
2 changed files
with
65 additions
and
0 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,22 @@ | ||
name: approve | ||
on: | ||
workflow_dispatch | ||
|
||
jobs: | ||
approve: | ||
name: approve | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: ToshihitoKon/slack-quickpost@v1 | ||
with: | ||
version: 0.7.1 | ||
|
||
- name: Notify slack workflow start | ||
env: | ||
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} | ||
run: | | ||
slack-quickpost \ | ||
--token ${{ secrets.SLACK_TOKEN } \ | ||
--channel ${{ env.SLACK_CHANNEL }} \ | ||
--username "GitHub Actions: ${{ github.workflow }}" \ | ||
--text ":white_check_mark: Approved by ${{ github.actor }}" |
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,43 @@ | ||
name: deploy | ||
on: | ||
workflow_dispatch | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: ToshihitoKon/slack-quickpost@v1 | ||
with: | ||
version: 0.7.1 | ||
|
||
- run: | | ||
slack-quickpost \ | ||
--channel ${SLACK_CHANNEL} \ | ||
--username "GitHub Actions: ${{ github.workflow }}" \ | ||
--text ":black_square_for_stop: Waiting manual approve..." | ||
- name: Wait manual approve | ||
timeout-minutes: 5 | ||
isApproved=false | ||
until ${isApproved}; do | ||
sleep 10 | ||
result=$(gh run list \ | ||
--workflow approve.yml \ | ||
--status success \ | ||
--branch ${{ github.ref_name }} \ | ||
--json headSha \ | ||
--jq '.[].headSha' \ | ||
--limit 1) | ||
|
||
# github.shaが一致すればOK | ||
if [ "${{ github.sha }}" = "${result}" ]; then | ||
isApproved=true | ||
fi | ||
done | ||
|
||
- run: | | ||
slack-quickpost \ | ||
--channel ${SLACK_CHANNEL} \ | ||
--username "GitHub Actions: ${{ github.workflow }}" \ | ||
--text ":thumbsup: Deploy Approved!" |