Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ permissions:
jobs:
release:
runs-on: ubuntu-latest
environment: npm
environment: Publish
steps:
- name: Get CI Bot Token
uses: tibdex/github-app-token@v2
uses: actions/create-github-app-token@v3
id: ci_bot_token
with:
app_id: ${{ secrets.CI_BOT_APP_ID }}
private_key: ${{ secrets.CI_BOT_SECRET }}
client-id: ${{ vars.PUBLISH_CI_APP_CLIENT_ID }}
private-key: ${{ secrets.PUBLISH_CI_APP_KEY }}

- name: Checkout source code
uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
# Skip for pre-releases (tags containing '-') unless manually dispatched
if: github.event_name != 'release' || !contains(github.event.release.tag_name, '-')
runs-on: ubuntu-latest
environment: Sync-docs
permissions:
contents: read
Comment on lines 14 to 15

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 | 🟠 Major | ⚡ Quick win

contents: read will cause the CLI-repo git push to fail on releases.

The "Commit and push docs back to CLI repo" step (line 61) writes back to the CLI repo via GITHUB_TOKEN (the initial actions/checkout@v4 at line 17 uses no explicit token). With only contents: read, that push will always get a 403 on non-draft release events.

The PR notes acknowledge this gap ("a step that writes docs may require contents: write"). The fix is straightforward:

🔒 Proposed fix
     permissions:
-      contents: read
+      contents: write
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/sync-docs.yml around lines 14 - 15, The workflow currently
sets permissions: contents: read which prevents the "Commit and push docs back
to CLI repo" step from pushing via GITHUB_TOKEN; update the workflow permissions
to grant write access (change or replace contents: read with contents: write) so
the checkout/push step can authenticate and push release updates, and ensure any
job-level or step-level permissions do not override this change.

steps:
Expand Down Expand Up @@ -64,9 +65,9 @@ jobs:

- name: Generate docs repo token
id: app-token
uses: actions/create-github-app-token@v1
uses: actions/create-github-app-token@v3
with:
app-id: ${{ vars.DOCS_SYNC_APP_ID }}
client-id: ${{ vars.DOCS_SYNC_APP_CLIENT_ID }}
private-key: ${{ secrets.DOCS_SYNC_APP_KEY }}
repositories: genlayer-docs

Expand Down
Loading