ci: env var and token handling improvements#12072
Conversation
Signed-off-by: Dariusz Porowski <3431813+DariuszPorowski@users.noreply.github.com>
Signed-off-by: Dariusz Porowski <3431813+DariuszPorowski@users.noreply.github.com>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
This PR performs CI-only maintenance across multiple GitHub Actions workflows by (1) standardizing on the built-in github.token instead of a bot PAT and (2) reducing direct ${{ ... }} expression interpolation inside run: blocks by mapping values through step env: and using shell variables, improving safety and consistency.
Changes:
- Replace
secrets.GH_RAD_CI_BOT_PAT/secrets.GITHUB_TOKENusage with${{ github.token }}in affected workflows, paired with explicit job/step permissions where needed. - Refactor inline
bashscripts to use shell variables (e.g.,"${VAR}") and step-levelenv:mappings instead of${{ ... }}inside the script body. - Minor quoting/consistency improvements around paths,
ghCLI usage, and registry/login commands.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/validate-bicep.yaml | Use ${BICEP_VER} and $GITHUB_WORKSPACE in shell to avoid expression interpolation in run: blocks. |
| .github/workflows/unit-tests.yaml | Install gotestsum using shell var expansion instead of workflow expression inside the script. |
| .github/workflows/spellcheck.yaml | Use ${ACTION_LINK} in the step summary script output. |
| .github/workflows/release.yaml | Pass step outputs via env: into scripts; remove ${{ ... }} from bash run: bodies. |
| .github/workflows/release-verification.yaml | Pass inputs.version through env: and quote in shell usage. |
| .github/workflows/radius-bot.yaml | Switch to ${{ github.token }} and add required issues: write permission for issue assignment. |
| .github/workflows/purge-old-images.yaml | Switch to ${{ github.token }} and scope permissions for issue creation on failure. |
| .github/workflows/purge-azure-test-resources.yaml | Replace ${{ ... }} usage inside shell with env vars; switch to ${{ github.token }} for issue creation. |
| .github/workflows/purge-aws-test-resources.yaml | Quote ${AWS_RESOURCE_TYPES} in script call and switch issue creation to ${{ github.token }}. |
| .github/workflows/publish-docs.yaml | Use shell variables and proper quoting when writing to $GITHUB_ENV. |
| .github/workflows/publish-de-image.yaml | Pass workflow run id via env: and use shell variable in gh run view. |
| .github/workflows/nightly-rad-CLI-tests.yaml | Map matrix values via env: for shell use; switch issue creation auth to ${{ github.token }}. |
| .github/workflows/long-running-azure.yaml | Replace expression interpolation with env vars in scripts; add permissions and secret-to-env mappings for shell usage. |
| .github/workflows/lint.yaml | Quote ${HELM_CHARTS_DIR} usage in shell. |
| .github/workflows/functional-test-noncloud.yaml | Map PR/input/matrix values to env: for shell use; reduce ${{ ... }} in run: blocks. |
| .github/workflows/functional-test-cloud.yaml | Map PR/input/matrix/secrets to env: for shell use; switch issue creation auth to ${{ github.token }}. |
| .github/workflows/devcontainer-feature-test.yaml | Pass matrix.baseImage via step env: and quote in shell usage. |
| .github/workflows/c9k-failure-report.yml | Replace secrets.GITHUB_TOKEN usage with ${{ github.token }}. |
| .github/workflows/build.yaml | Quote shell variables in copy/publish steps; use ${{ github.token }} for helm/gh auth via GH_TOKEN. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Dariusz Porowski <3431813+DariuszPorowski@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12072 +/- ##
==========================================
- Coverage 52.13% 52.13% -0.01%
==========================================
Files 734 734
Lines 46704 46704
==========================================
- Hits 24350 24349 -1
- Misses 20017 20019 +2
+ Partials 2337 2336 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: Dariusz Porowski <3431813+DariuszPorowski@users.noreply.github.com>
Radius functional test overviewClick here to see the test run details
Test Status⌛ Building Radius and pushing container images for functional tests... |
Description
CI-only maintenance changes to the GitHub Actions workflows. No Radius runtime functionality is affected. Two logical changes are included:
Adopt the built-in
github.token— replacessecrets.GH_RAD_CI_BOT_PAT(and a straysecrets.GITHUB_TOKEN) with the automatically providedgithub.tokenacross nine workflows, reducing reliance on a long-lived bot PAT.Improve environment variable usage in inline shell scripts — converts GitHub Actions
${{ ... }}expressions used inside bashrun:blocks to native shell variable syntax ("${VAR}"). Values that are not already environment variables (secrets,matrix,inputs,steps.*.outputs) are mapped through step-levelenv:blocks so they are visible to the shell and no longer interpolated directly into the script body, hardening the workflows against shell script injection. YAML fields (if:,with:,name:, etc.),actions/github-scriptblocks,with:client payloads, and Markdown comment bodies are intentionally left unchanged.Affected workflows
build.yaml,c9k-failure-report.yml,devcontainer-feature-test.yaml,functional-test-cloud.yaml,functional-test-noncloud.yaml,lint.yaml,long-running-azure.yaml,nightly-rad-CLI-tests.yaml,publish-de-image.yaml,publish-docs.yaml,purge-aws-test-resources.yaml,purge-azure-test-resources.yaml,purge-old-images.yaml,radius-bot.yaml,release-verification.yaml,release.yaml,spellcheck.yaml,unit-tests.yaml,validate-bicep.yamlType of change
Contributor checklist
Please verify that the PR meets the following requirements, where applicable:
eng/design-notes/in this repository, if new APIs are being introduced.