Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Kon Toshihito committed Nov 30, 2023
0 parents commit 9879e19
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/approve.yaml
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 }}"
43 changes: 43 additions & 0 deletions .github/workflows/deploy.yaml
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!"

0 comments on commit 9879e19

Please sign in to comment.