Skip to content

Reusable workflow from a private repo fails in activation: run-info metadata read 404s with caller's GITHUB_TOKEN (v1.2.2+) #77395

Done

Description

@ricohomewood

Version Information

Configuration / Code

An agentic workflow compiled in a private repo (myorg/shared-workflows) and consumed by other repos in the same org as a reusable workflow:

# myorg/shared-workflows/.github/workflows/generate.md (compiled to generate.lock.yml)
---
on:
  workflow_call:
    inputs:
      tag-name:
        required: true
        type: string
permissions:
  contents: read
engine: copilot
safe-outputs:
  update-release:
    max: 1
---
# Update a release
Rewrite the body of the release tagged `${{ inputs.tag-name }}`.
# myorg/my-app/.github/workflows/release-notes.yml (caller)
on:
  release:
    types: [published]
jobs:
  notes:
    uses: myorg/shared-workflows/.github/workflows/generate.lock.yml@main
    with:
      tag-name: ${{ github.event.release.tag_name }}
    permissions:
      actions: read
      contents: write
      copilot-requests: write
      pull-requests: read
    secrets: inherit

Expected Behavior

The activation job's Generate agentic run info step loads the compiler metadata for the executing lock file and activation continues, as it did on v1.0.1.

Actual Behavior

The step calls the Contents API for the lock file in the callee repo using the caller's default GITHUB_TOKEN. That token is scoped to the caller repo, so the call 404s and activation fails. Every caller of the shared workflow is broken.

GET /repos/myorg/shared-workflows/contents/.github%2Fworkflows%2Fgenerate.lock.yml?ref=<sha> - 404
RequestError [HttpError]: Not Found - https://docs.github.com/rest/repos/contents#get-repository-content
    at async readRemoteMarkdownMetadata (/home/runner/work/_temp/gh-aw/actions/markdown_metadata.cjs:286:20)
    at async loadMarkdownMetadata (/home/runner/work/_temp/gh-aw/actions/markdown_metadata.cjs:306:29)
    at async main (/home/runner/work/_temp/gh-aw/actions/generate_aw_info.cjs:64:28)
##[error]Unhandled error: HttpError: Not Found

Steps to Reproduce

  1. In a private repo, compile the workflow above with gh-aw v1.2.2 and push it.
  2. In another repo in the same org, add the caller above (allow access to the private repo's workflows in its Actions settings).
  3. Publish a release in the caller repo.
  4. activation fails at Generate agentic run info with the 404 above.

Additional Context

  • In loadMarkdownMetadata, remote is true whenever GH_AW_INFO_WORKFLOW_SHA is set or the caller repo differs from the workflow repo. It then calls readRemoteMarkdownMetadata with global.github, i.e. the caller's GITHUB_TOKEN. That token can never read another private repo, regardless of the permissions the caller grants.
  • v1.2.3 adds readGitObjectMarkdownMetadata, but activation doesn't check out the callee repo before this step. So the local git object isn't there, the code falls back to the same API call, and it still 404s.
  • There seems to be no frontmatter option to supply a different token for this read, or to skip it.
  • Possible fixes: read the metadata from a token that can access the callee repo (e.g. GH_AW_GITHUB_TOKEN when present), check out the callee lock file before this step, or embed the needed metadata in the lock file so no remote read is needed.

Workaround

Pin the compiler to v1.0.1 (gh extension install github/gh-aw --pin v1.0.1) and recompile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions