Interview Prep/GitHub Actions/Secrets, OIDC & Environments

You need to push to GHCR and to a second repo's branch from one workflow. Which tokens?

IntermediateScenarioSecrets, OIDC & Environments
Answer

Situation read → One same-repo action, one cross-repo action.

What I'd do →

  1. GHCR push: GITHUB_TOKEN with packages: write (package linked to the repo).
  2. Cross-repo push: GitHub App token from actions/create-github-app-token scoped to the target repo with contents: write.
  3. Pass the app token only to the step that pushes.

Why → GITHUB_TOKEN cannot write to other repos; App tokens are short-lived and scoped.

Interview tip → Avoid PATs tied to a human account.

All GitHub Actions questions Roadmap: GitHub Actions

More on Secrets, OIDC & Environments