-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π Removing the need for multiple branches to sync docs
- Loading branch information
Showing
2 changed files
with
48 additions
and
4 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,41 @@ | ||
name: β° Delayed Trigger for S3 Sync | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'posts/**' | ||
|
||
permissions: write-all | ||
|
||
jobs: | ||
wait-and-trigger: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
- name: π Wait for 10 seconds | ||
run: sleep 10 | ||
|
||
- 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/${{ github.repository }}/actions/workflows/sync-s3-posts.yml/dispatches \ | ||
-d "{\"ref\":\"main\"}" |
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