[Breaking] Migrate Process-PSModule GitHub operations to strict GitHub App token auth#408
Draft
Marius Storhaug (MariusStorhaug) wants to merge 10 commits into
Draft
[Breaking] Migrate Process-PSModule GitHub operations to strict GitHub App token auth#408Marius Storhaug (MariusStorhaug) wants to merge 10 commits into
Marius Storhaug (MariusStorhaug) wants to merge 10 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Prefer caller-provided GH_TOKEN/GITHUB_TOKEN for GitHub API/CLI calls while keeping github.token fallback for compatibility. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove github.token fallbacks from GitHub-facing composite actions so reusable workflow paths require explicit app-token env wiring. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
For GitHub App-enabled workflow/action paths, remove dual-token env usage and keep explicit GH_TOKEN-only wiring with no github.token fallback. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Mint an installation token in Build-Module.yml (same pinned actions/create-github-app-token@fee1f7d... as Plan and Publish-Module) and inject it as GH_TOKEN on the Build-PSModule step. This covers the three gh repo view calls in Build-PSModuleManifest.ps1 that read repo description, topics, and URL — all of which go through the gh CLI and therefore consume GH_TOKEN. The job-level GH_TOKEN: github.token fallback is removed. workflow.yml is updated to pass the GitHubAppClientId and GitHubAppPrivateKey secrets into the Build-Module reusable workflow. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Each token-minting step now requests only the permissions the job actually exercises and restricts the token to the current repository. Plan: repositories: current repo permission-contents: read (gh release list in Resolve-Version) permission-pull-requests: write (label/comment via Get-PSModuleSettings) Publish-Module: repositories: current repo permission-contents: write (gh release create/upload/delete) permission-pull-requests: write (gh pr comment) Build-Module: repositories: current repo (no permission-* needed - only gh repo view which uses metadata:read, auto-granted to all GitHub App installations) This limits blast radius: even if a compromised step obtained GH_TOKEN, it could only act on the one repository and only with the declared permission level, not on every repo in the installation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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
This PR migrates GitHub-facing workflow operations from implicit
github.tokenusage to explicit GitHub App installation-token wiring in the reusable workflow pipeline.It introduces a generic reusable-workflow secret contract so caller repositories can map their own secret names while Process-PSModule remains stable.
Breaking change
GitHub-facing reusable workflow/action paths now require explicit GitHub App token wiring. Fallback to
github.tokenwas removed intentionally.What changed
workflow.yml:GitHubAppClientIdGitHubAppPrivateKeyPlan.ymlandPublish-Module.ymlcalls.Plan.ymlnow accepts GitHub App secrets.actions/create-github-app-tokenstep.Get-PSModuleSettingsandResolve-PSModuleVersionnow receive app token viaGH_TOKENandGITHUB_TOKEN.Publish-Module.ymlnow accepts GitHub App secrets.actions/create-github-app-tokenstep.Publish-PSModuleandCleanup-PSModulePrereleasesnow receive app token viaGH_TOKENandGITHUB_TOKEN..github/actions/Get-PSModuleSettings/action.yml.github/actions/Resolve-PSModuleVersion/action.yml.github/actions/Publish-PSModule/action.yml.github/actions/Cleanup-PSModulePrereleases/action.ymlgithub.token..github/workflows/Workflow-Test-Default.yml.github/workflows/Workflow-Test-WithManifest.ymlConsumer usage
Callers should provide:
PSMODULE_CLIENT_IDandPSMODULE_PRIVATE_KEYare consumer-side choices; only the reusable-workflow boundary names are fixed.