Bocchi Bot #4179
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
name: "Bocchi Bot" | |
on: | |
workflow_run: | |
workflows: [init banner] | |
types: | |
- completed | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: false | |
jobs: | |
Nijika-Chan: | |
runs-on: ubuntu-latest | |
if: ${{ github.triggering_actor == github.repository_owner }} | |
steps: | |
- name: "success checker" | |
run: | | |
if [ "${{ github.event.workflow_run.conclusion }}" != "success" ]; then | |
echo "Exiting... The init banner did not succeed" | |
exit 1 | |
fi | |
- name: "checkout" | |
uses: actions/checkout@v3 | |
- name: "check latest" | |
run: | | |
LATEST_COMMIT="$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/commits/${{ github.ref }}" | jq -r .sha)" | |
if [ "${LATEST_COMMIT}" != "${GITHUB_SHA}" ]; then | |
printf '%s\n' "current commit is not the latest" >&2 | |
exit 1 | |
fi | |
- name: "rerun on fail" | |
if: ${{ failure() }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
WORKFLOW_FILE: "bot_runner.yml" | |
run: | | |
curl -H "Authorization: Bearer ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.v3+json" -X POST -d '{"ref":"'"${{ github.ref }}"'","inputs":{}}' "https://api.github.com/repos/${{ github.repository }}/actions/workflows/${WORKFLOW_FILE}/dispatches" | |
exit 1 | |
- name: "run" | |
continue-on-error: true | |
env: | |
tok_fb: ${{ secrets.TOK_FB }} | |
tok_gif: ${{ secrets.TOK_GIF }} | |
run: bash frame_main.sh "${tok_fb}" "${tok_gif}" | |
- name: "auto commit" | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "Posted!!" | |
repository: . | |
file_pattern: README.md fb/* counter*.txt frameposter.sh frame_main.sh status/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |