Skip to content

Use GitHub App to create a new token (for PUSH and RELEASE)#1953

Merged
arturcic merged 11 commits intomainfrom
feature/github-app-token
Feb 19, 2026
Merged

Use GitHub App to create a new token (for PUSH and RELEASE)#1953
arturcic merged 11 commits intomainfrom
feature/github-app-token

Conversation

@arturcic
Copy link
Copy Markdown
Member

This pull request focuses on improving GitHub Actions workflows and related automation scripts for the project. The main enhancements include switching to GitHub App tokens for better security, refining permissions scopes for workflows, and making dependency installation more robust. There are also minor code cleanups and improvements to script reliability.

Workflow Security and Token Management:

  • Replaced the use of static secrets (like PUSH_GITHUB_TOKEN and RELEASE_GITHUB_TOKEN) with dynamically generated GitHub App tokens using the actions/create-github-app-token action in the ci.yml, release.yml, prerelease.yml, gitversion-published.yml, and examples-version.yml workflows. This change improves security and allows for more granular permissions management. [1] [2] [3] [4] [5] [6] [7]
  • Updated all references to workflow tokens to use the output from the new GitHub App token generation step, ensuring all downstream actions use the correct credentials. [1] [2] [3] [4] [5] [6] [7]

Workflow Permissions Hardening:

  • Changed workflow-level permissions from read-all to contents: read across all workflows, and set job-level permissions where necessary. This limits the default permissions for workflows, following GitHub security best practices. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
  • Added explicit permissions blocks to jobs in multi-job workflows where required. [1] [2] [3]

Dependency Installation Improvements:

  • Updated all npm install commands in CI and release workflows to use the --ignore-scripts flag, preventing the execution of potentially unsafe lifecycle scripts during dependency installation. [1] [2] [3] [4]

Robustness and Minor Code Improvements:

  • Improved nullish checks in src/tools/common/dotnet-tool.ts for more concise and reliable code when handling fetch responses and version arrays.

Action and Script Refactoring:

  • Updated the publish-azure GitHub Action to use environment variables for passing inputs to the publishing script, aligning with best practices and improving maintainability.

These changes collectively enhance the security, maintainability, and reliability of the project's CI/CD pipelines.

Replaces static secrets with a dynamically generated GitHub App token, enhancing security and granting precise permissions.
Grants write permissions for actions, contents, and workflows to the GitHub App token for CI operations.
Update TypeScript compilation target to ES2022 and refactor code with optional chaining for conciseness. Optimize CI dependency installation by ignoring scripts and passing workflow inputs via environment variables.
Centralizes GitHub App token generation for write operations across workflows, improving consistency and maintainability.
Replaces direct use of a legacy token with an App-generated token for enhanced security in release workflows.
Add blank lines to visually separate steps in GitHub Actions workflows.
Updates GitHub Actions workflows to use specific `contents: read` permissions for enhanced security and least privilege.
Enhance security and stability by preventing execution of lifecycle scripts during dependency installation in CI/CD.
Replaces custom token generation actions with `actions/create-github-app-token@v2` and explicitly defines required permissions.
@arturcic arturcic added this to the v4.x milestone Feb 19, 2026
@sonarqubecloud
Copy link
Copy Markdown

@arturcic arturcic changed the title Feature/GitHub app token Use GitHub App to create a new token (for PUSH and RELEASE) Feb 19, 2026
@arturcic arturcic merged commit f0873cb into main Feb 19, 2026
21 checks passed
@arturcic arturcic deleted the feature/github-app-token branch February 19, 2026 22:19
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Feb 19, 2026

Thank you @arturcic for your contribution!

@arturcic arturcic linked an issue Feb 20, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ISSUE]: Secret management

2 participants