Skip to content

πŸ™ Updated workflow_dispatch - more work (1) #6

πŸ™ Updated workflow_dispatch - more work (1)

πŸ™ Updated workflow_dispatch - more work (1) #6

Workflow file for this run

name: ⏰ Delayed Trigger
on:
push:
branches:
- main # change to `docs` later
permissions: write-all
jobs:
wait-and-trigger:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: 5️⃣ Wait for 5 seconds
run: sleep 5
- name: πŸ”€ Check for newer commits
id: check-commits
run: |
LATEST_COMMIT=$(git log -1 --format='%H')
CURRENT_COMMIT=${{ github.sha }}
if [ "$LATEST_COMMIT" != "$CURRENT_COMMIT" ]; then
echo "Newer commit found. Stopping workflow."
echo "::set-output name=abort::true"
fi
- name: ⚑ Trigger main workflow
if: steps.check-commits.outputs.abort != 'true'
run: |
curl -L \
-X POST \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/ShafSpecs/journal-stack/actions/workflows/sync-s3-posts.yml/dispatches \
-d "{\"ref\":\"main\"}"