Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions .github/workflows/csharp-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ on:
secrets:
BOT_GITHUB_TOKEN:
description: >-
PAT or GitHub App token with `read:packages` for `dotnet restore`
against private NuGet feeds (e.g. GitHub Packages). Optional;
omit for public-only restores. Pass via `secrets: inherit` or an
explicit `secrets:` block on the caller.
Deprecated and unused. `dotnet restore` runs without any credential and
resolves from nuget.org. Kept declared and optional so callers that name
it in an explicit `secrets:` block keep working; an inherited or passed
value is never exposed to the steps.
required: false
inputs:
concurrency-group:
Expand Down Expand Up @@ -262,7 +262,6 @@ jobs:
include: ${{ fromJSON(needs.normalize.outputs.matrix) }}
permissions:
contents: read
packages: read
pull-requests: write
defaults:
run:
Expand All @@ -277,6 +276,8 @@ jobs:

- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Setup .NET
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
Expand All @@ -292,6 +293,7 @@ jobs:
repository: peacefulstudio/github-actions
ref: ${{ job.workflow_sha }}
path: .github-actions-helpers
persist-credentials: false

- name: Resolve dotnet-coverage version
if: ${{ matrix.coverage }}
Expand All @@ -310,9 +312,6 @@ jobs:
"$GITHUB_WORKSPACE/.github-actions-helpers/scripts/install-dotnet-coverage.sh" "$DOTNET_COVERAGE_VERSION"

- name: Restore
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
run: |
set -euo pipefail
dotnet restore
Expand Down Expand Up @@ -553,7 +552,6 @@ jobs:
runs-on: ${{ inputs.plumbing-runner != '' && (startsWith(inputs.plumbing-runner, '[') && fromJSON(inputs.plumbing-runner) || inputs.plumbing-runner) || ((inputs.matrix-mode != '' && inputs.matrix-mode || vars.CI_MATRIX_MODE) == 'cheap' && github.event.repository.private == true && fromJSON('["self-hosted","hetzner"]') || 'ubuntu-latest') }}
permissions:
contents: read
packages: read
defaults:
run:
shell: bash
Expand All @@ -579,6 +577,8 @@ jobs:

- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Setup .NET
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
Expand All @@ -588,9 +588,6 @@ jobs:
global-json-file: ${{ inputs.dotnet-version == '' && ((inputs.working-directory == '.' || inputs.working-directory == '') && 'global.json' || format('{0}/global.json', inputs.working-directory)) || '' }}

- name: Restore
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
run: |
set -euo pipefail
dotnet restore
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- `csharp-ci.yaml` runs `dotnet restore` and `dotnet pack` without any credential: the `Restore` steps no longer receive `secrets.BOT_GITHUB_TOKEN` or `github.token`, so no token is in the environment of steps that execute pull-request-controlled MSBuild files (`Directory.Build.props`, `nuget.config`, project targets), and the `actions/checkout` steps set `persist-credentials: false`. Every package resolves from nuget.org; the private GitHub Packages feed is retired, so no package "Manage Actions access" grants are needed. The `BOT_GITHUB_TOKEN` secret stays declared as optional and deprecated, so callers that name it in an explicit `secrets:` block do not break; its value is ignored.

## [2.6.0] - 2026-09-29

### Added
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ choosing which shard carries coverage — use `build-matrix` instead (see
| `pack` | `false` | When true, also runs `dotnet pack` and uploads `.nupkg` artifacts. |
| `pack-project` | *(empty)* | Project to pack. Required when `pack: true`. |

**Optional secrets**:
**Restore is credential-free**: `dotnet restore` and `dotnet pack` run with no
token and resolve every package from nuget.org. The private GitHub Packages feed
is retired, so no package grants are needed.

- `BOT_GITHUB_TOKEN` — PAT or GitHub App token with `read:packages` for
`dotnet restore` against private NuGet feeds (e.g. GitHub Packages).
Omit for public-only restores. Pass via `secrets: inherit` or an
explicit `secrets:` block on the caller.
**Deprecated secret**: `BOT_GITHUB_TOKEN` is still accepted but unused, so
callers that name it in an explicit `secrets:` block keep working.

Consumer `.github/workflows/csharp-ci.yaml`:

Expand Down
Loading