-
Notifications
You must be signed in to change notification settings - Fork 23
Add stable branch syncing and webhook for readthedocs build triggering #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
aidanfnv
merged 11 commits into
shader-slang:main
from
aidanfnv:fix/readthedocs-bot-action
May 5, 2025
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8572a22
Fix RTD build trigger
aidanfnv 918f4f0
Replace token use with RTD webhook
aidanfnv e0a97c4
Update webhook to shader-slang's repo's RTD hook
aidanfnv 2dddc37
Add stable branch syncing
aidanfnv 30ff457
Fix stable branch git add
aidanfnv 084f070
Rename the bot to Read the Docs Bot
aidanfnv b327e5c
Explicitly add changed submodules
aidanfnv 450a2d5
Change method of detecting submodule changes
aidanfnv a21861a
Try different method of detecting submodule changes
aidanfnv eb7e427
Use GH token and CLI for getting release tags, ignore updated submodules
aidanfnv 3e6635d
Change workflow name
aidanfnv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,83 @@ | ||
| name: Sync Stable Branch with Slang Release | ||
|
|
||
| on: | ||
| schedule: | ||
| # Run at 3:00 AM UTC every day | ||
| - cron: '0 3 * * *' | ||
| workflow_dispatch: # Allow manual trigger | ||
|
|
||
| jobs: | ||
| sync-stable-branch: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout main branch | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: main # Explicitly checkout main | ||
| # Fetch all history for all branches and tags | ||
| fetch-depth: 0 | ||
| # Get submodules, but don't update them yet | ||
| submodules: 'recursive' | ||
|
|
||
| - name: Set up Git | ||
| run: | | ||
| git config --global user.name 'Read the Docs Bot' | ||
| git config --global user.email 'rtd-bot@shader-slang.com' | ||
|
|
||
| - name: Get latest slang release tag | ||
| id: slang_latest_tag | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Provide token explicitly for gh | ||
| run: | | ||
| LATEST_TAG=$(gh release view --repo shader-slang/slang --json tagName --jq .tagName) | ||
| if [ -z "$LATEST_TAG" ]; then | ||
| echo "Failed to fetch latest slang release tag using gh" | ||
| exit 1 | ||
| fi | ||
| echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT | ||
| echo "Fetched latest slang tag: $LATEST_TAG" | ||
|
|
||
| - name: Update slang submodule to latest release tag | ||
| run: | | ||
| pushd docs/external/slang | ||
| git fetch --tags origin | ||
| git checkout ${{ steps.slang_latest_tag.outputs.tag }} | ||
| popd | ||
| echo "Checked out tag ${{ steps.slang_latest_tag.outputs.tag }} in docs/external/slang" | ||
|
|
||
| - name: Check for changes | ||
| id: check_changes | ||
| run: | | ||
| # Only stage the slang submodule, as the others are already updated | ||
| git add docs/external/slang | ||
|
|
||
| # Check if the index differs from HEAD | ||
| # git diff --cached --quiet exits 0 if no diff, 1 if diff | ||
| if ! git diff --cached --quiet; then | ||
| echo "Changes detected in submodule references." | ||
| echo "changes=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "No changes detected in submodule references." | ||
| echo "changes=false" >> $GITHUB_OUTPUT | ||
| # If no changes, reset the index in case unrelated changes were staged | ||
| git reset HEAD --quiet | ||
| fi | ||
|
|
||
| - name: Commit and push changes to stable branch | ||
| if: steps.check_changes.outputs.changes == 'true' | ||
| run: | | ||
| git commit -m "Sync stable to release (slang@${{ steps.slang_latest_tag.outputs.tag }})" | ||
| git push origin HEAD:stable --force | ||
| echo "Committed and force-pushed updates to stable branch." | ||
|
|
||
| - name: Trigger Read the Docs Build on stable branch update | ||
| if: steps.check_changes.outputs.changes == 'true' | ||
| env: | ||
| RTD_WEBHOOK_SECRET: ${{ secrets.RTD_WEBHOOK_SECRET }} | ||
| run: | | ||
| curl -X POST \ | ||
| -H "Authorization: token $RTD_WEBHOOK_SECRET" \ | ||
| https://readthedocs.org/api/v2/webhook/slang-documentation/296117/ | ||
| echo "Triggered Read the Docs build." | ||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.