Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,29 +302,50 @@ jobs:
"id-token": "write"
"packages": "write"

custom-publish-npm:
custom-publish-docker:
needs:
- plan
- host
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
permissions:
contents: read
id-token: write
packages: "write"
uses: ./.github/workflows/publish-npm.yml
uses: ./.github/workflows/publish-docker.yml
with:
plan: ${{ needs.plan.outputs.val }}
secrets: inherit
# publish jobs get escalated permissions
permissions:
"id-token": "write"
"packages": "write"
Comment on lines +315 to +317
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Caller job permissions and reusable workflow mapping =="
rg -n -A6 -B2 'custom-publish-(docker|npm):|uses: \./\.github/workflows/publish-(docker|npm)\.yml|permissions:|"contents"|"id-token"|"packages"' .github/workflows/release.yml

echo
echo "== Callee workflows requiring checkout (and their permissions) =="
rg -n -A5 -B2 'permissions:|contents:\s*read|id-token:\s*write|packages:\s*write|uses:\s*actions/checkout@v6' .github/workflows/publish-docker.yml .github/workflows/publish-npm.yml

Repository: tower/tower-cli

Length of output: 3417


Add contents: read to caller permissions for reusable publish jobs.

Both called workflows perform actions/checkout@v6; without contents: read at the caller, checkout will fail due to reduced token scope in reusable workflow execution.

🔧 Proposed fix
   custom-publish-docker:
     ...
     permissions:
+      "contents": "read"
       "id-token": "write"
       "packages": "write"

   custom-publish-npm:
     ...
     permissions:
+      "contents": "read"
       "id-token": "write"
       "packages": "write"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release.yml around lines 315 - 317, The caller workflow's
permissions block is missing the contents read scope required by reusable
publish jobs that call actions/checkout; update the permissions object in the
workflow (the block that currently contains "id-token": "write" and "packages":
"write") to also include "contents": "read" so the reusable workflows can
successfully run actions/checkout@v6.


custom-publish-docker:
custom-publish-npm:
needs:
- plan
- host
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
uses: ./.github/workflows/publish-docker.yml
uses: ./.github/workflows/publish-npm.yml
with:
plan: ${{ needs.plan.outputs.val }}
secrets: inherit
# publish jobs get escalated permissions
permissions:
"contents": "read"
"id-token": "write"
"packages": "write"

announce:
needs:
- plan
- host
- custom-publish-pypi
- custom-publish-docker
- custom-publish-npm
# use "always() && ..." to allow us to wait for all publish jobs while
# still allowing individual publish jobs to skip themselves (for prereleases).
# "host" however must run to completion, no skipping allowed!
if: ${{ always() && needs.host.result == 'success' && (needs.custom-publish-pypi.result == 'skipped' || needs.custom-publish-pypi.result == 'success') && (needs.custom-publish-docker.result == 'skipped' || needs.custom-publish-docker.result == 'success') && (needs.custom-publish-npm.result == 'skipped' || needs.custom-publish-npm.result == 'success') }}
runs-on: "ubuntu-22.04"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
submodules: recursive
2 changes: 1 addition & 1 deletion dist-workspace.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "aarch64-unknown
# Path that installers should place binaries in
install-path = "CARGO_HOME"
# Publish jobs to run in CI
publish-jobs = ["./publish-pypi", "./publish-docker"]
publish-jobs = ["./publish-pypi", "./publish-docker", "./publish-npm"]
# Whether to install an updater program
install-updater = false
# Whether dist should create a Github Release or use an existing draft
Expand Down
Loading