ci: fix reusable-workflow permissions and tighten YAML hygiene#55
Merged
Conversation
The build workflow could not be invoked from ci.yml because _build.yml
declared workflow-level `permissions: contents: write` while ci.yml only
granted `contents: read`. Reusable workflows cannot request more than
the caller grants; remove the workflow-level block so _build.yml
inherits caller permissions (read from ci.yml, write from publish.yml).
While here, apply 2025-era GitHub Actions hygiene per docs and
reference workflows in cli/cli, tauri/tauri, actions/toolkit:
- Title-case `name:` and `run-name:` for consistency with Publish/CodeQL
- Per-job `permissions:` blocks (least-privilege)
- `timeout-minutes:` on every job (5 / 20 / 60 / 90)
- `name:` on every step; Title Case imperative verbs
- Drop dead `continue-on-error: false`
- Use `${{ github.token }}` over `${{ secrets.GITHUB_TOKEN }}` consistently
- Move CodeQL's `security-events: write` to the analyze job only
- Rename `version`-job step id from `v` to `compute` for readability
No behavioral changes beyond the permissions fix.
Contributor
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
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.
Summary
_build.ymldeclaredpermissions: contents: writeat the workflow level. Reusable workflows cannot request more than the caller grants, so whenci.yml(which grantscontents: read) called it, GitHub rejected with:Drop the workflow-level permissions block from
_build.ymlso it inherits the caller's permissions —ci.ymlprovides read (verification builds, no release upload),publish.ymlprovides write (release-asset upload viatauri-action).While here, apply YAML hygiene based on the official Actions docs and reference workflows in cli/cli, tauri-apps/tauri, and actions/toolkit:
name:andrun-name:(CI,Build) so the Actions UI is consistent with the existingPublishandCodeQLworkflows.permissions:with least-privilege: each job declares only what it needs (contents: readfor build,security-events: writeonly on the CodeQL analyze job).timeout-minutes:on every job (5 for the trivial version compute, 20 for the CLI cross-compile, 60 for CodeQL analyze, 90 for the Tauri matrix legs). Avoids 6-hour stalls on hung runners.name:on every step with Title Case imperative verbs ("Checkout", "Setup Bun", "Install Rust toolchain"). Replaces opaque "Run …" entries in the UI.github.tokenoversecrets.GITHUB_TOKENfor consistency with the rest of_build.yml, which already uses the canonical form.continue-on-error: false(it's the default).version-job step id renamedv→computefor readability when grepping for the output reference.actionlintis clean on all three modified files. No behavioral changes beyond the permissions fix.Test plan
CIin the Actions UI dispatches successfully againstmain._build.ymlcall site, which is what was failing before).Publishworkflow still works when manually dispatched (it grantscontents: write, so this should be unaffected).