fix: skip GitHub Pages deploy on pull_request events#5
Merged
Conversation
- Add `if: github.event_name == 'push' && github.ref == 'refs/heads/master'` to the peaceiris/actions-gh-pages step so it only runs on pushes to master (or workflow_dispatch), never on pull_request events including Dependabot PRs. - Add `permissions: contents: write` at workflow level so GITHUB_TOKEN can push to gh-pages when deploying from master. Agent-Logs-Url: https://github.com/FerreolS/InverseProblemsCookbook/sessions/4c98b4c1-a82d-4aa7-b2c0-b16a9af4ff1b Co-authored-by: FerreolS <10050083+FerreolS@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix GitHub Pages deployment on pull_request events
fix: skip GitHub Pages deploy on pull_request events
Apr 30, 2026
FerreolS
reviewed
Apr 30, 2026
| workflow_dispatch: | ||
|
|
||
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
| permissions: |
Contributor
Author
There was a problem hiding this comment.
Not required — removed in 968bb9f. The original failure was only on PR events (tokens are read-only for PRs); master push deployments were already working, so the if: condition on the deploy step is the only change needed.
The original failure was only on PRs; master push deployments were already working, so the top-level permissions block is not required. The `if:` condition on the deploy step is sufficient to fix the issue. Agent-Logs-Url: https://github.com/FerreolS/InverseProblemsCookbook/sessions/aafe25f5-e7fa-42ff-ae95-82583ac27d7f Co-authored-by: FerreolS <10050083+FerreolS@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
peaceiris/actions-gh-pageswas running on everypull_requestevent, causing a403—github-actions[bot]cannot push togh-pageson PRs (tokens are read-only for fork/PR contexts).Changes
if: github.event_name == 'push' && github.ref == 'refs/heads/master'on theactions-gh-pagesstep; PDF/SVG build still runs on PRs for CI validationCovers Dependabot PRs as well — the
dependabotjob already gates ongithub.actor == 'dependabot[bot]'; now the deploy step inbuildis also skipped on those runs.Original prompt
This pull request was created from Copilot chat.