init banner #4155
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: "init banner" | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 */4 * * *" | |
# - cron: "0 0-21/3 * * *" | |
# - cron: "30 1-22/3 * * *" | |
jobs: | |
inits: | |
runs-on: ubuntu-latest | |
if: ${{ github.triggering_actor == github.repository_owner }} | |
steps: | |
# Start the sequence of preventing to run it when bot_runner.yml was running | |
- name: Check Workflow Status | |
id: check_status | |
run: | | |
response=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/bot_runner.yml/runs") | |
status="$(echo "${response}" | jq -r '.workflow_runs[].status')" | |
if grep -qE 'in_progress' <<< "${status}"; then | |
echo "The bot_runner is still running, The script prevented this workflow to run to avoid conflicts... Cancelling!!" | |
exit 1 | |
fi | |
: "Ignore" | |
# Start the main script if it was succeed | |
- uses: actions/checkout@v3 | |
- name: Execute | |
run: bash img_process.sh "in_progress" | |
- name: Commit Banner | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "Processing..." | |
repository: . | |
file_pattern: status/*.png | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |