-
Notifications
You must be signed in to change notification settings - Fork 2
ci: notify majorcontext.com when docs change on main #52
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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,44 @@ | ||
| # Notifies majorcontext.com to rebuild immediately when gatekeeper docs | ||
| # change on main, instead of waiting for the site's daily 09:17 UTC cron. | ||
| # | ||
| # Requires a secret named SITE_DISPATCH_TOKEN: a fine-grained personal | ||
| # access token, owned by an account with write access to | ||
| # majorcontext/majorcontext.com, scoped to that single repository, with | ||
| # repository permission "Contents: Read and write" (this is what the | ||
| # repos/{owner}/{repo}/dispatches endpoint requires; "Metadata: Read-only" | ||
| # is auto-selected alongside it — no other permissions are needed). | ||
| # | ||
| # This job fails soft: if the secret is unset or the token has expired, | ||
| # it logs a notice and exits 0 rather than turning every docs push red. | ||
| # The site's daily cron already covers this case as a fallback. | ||
| name: Notify site of docs update | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - docs/content/** | ||
| - docs/README.md | ||
|
|
||
| jobs: | ||
| dispatch: | ||
| runs-on: ubuntu-latest | ||
| # This job uses SITE_DISPATCH_TOKEN, never GITHUB_TOKEN, and never checks | ||
| # out the repo — grant the default token nothing so its scope can't | ||
| # silently widen with org defaults. | ||
| permissions: {} | ||
| steps: | ||
| - name: Send repository_dispatch to majorcontext.com | ||
| env: | ||
| GH_TOKEN: ${{ secrets.SITE_DISPATCH_TOKEN }} | ||
| run: | | ||
| if [ -z "${GH_TOKEN}" ]; then | ||
| echo "::notice::SITE_DISPATCH_TOKEN is not set; skipping dispatch. The site's daily cron will pick up this change instead." | ||
| exit 0 | ||
| fi | ||
|
|
||
| if ! gh api repos/majorcontext/majorcontext.com/dispatches \ | ||
| -f event_type=docs-updated; then | ||
| echo "::notice::Dispatch to majorcontext.com failed (token may be expired or missing permissions); skipping. The site's daily cron will pick up this change instead." | ||
| exit 0 | ||
| fi | ||
Oops, something went wrong.
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.