Skip to content

Commit 5559872

Browse files
committed
owen-cli-release: fix doc drift, close two script-injection nitpicks
CodeRabbit review: - docs/notes/owen-cli-release.md quoted the publish gate as just `startsWith(github.ref, 'refs/tags/owen-cli-v')`, dropping the `github.event_name == 'push'` half the workflow's own comment explains is required to block a `workflow_dispatch --ref owen-cli-vX` bypass -- the exact scenario the doc's next sentence claimed was already impossible. Quoted the real condition in full. - `${{ steps.version.outputs.version }}` (grep'd from the csproj, which this workflow now also builds on pull_request) and `${{ needs.build-test-pack.outputs.version }}` were both inlined directly into run: scripts at five sites -- the same expression-into-shell-text pattern zizmor flags elsewhere in this repo. Both now flow through env: (a job-level OWEN_CLI_VERSION for smoke-test's four sites, a step-level CSPROJ_VERSION for the tag/version-match assertion) instead of raw interpolation. Not implemented: CodeRabbit's NuGet Trusted Publishing (OIDC) suggestion for the publish step. Real publication is already blocked on the license and Environment decisions the docs already flag as the repository owner's call, not this session's; swapping the auth mechanism before either of those is resolved is the same category of decision, not a code fix. Re-verified locally end-to-end after the env: refactor: pack, isolated-feed install, `owen --version`, and the full uninstall/reinstall cycle all still pass with the version flowing through the environment instead of inline interpolation. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SSXTDuh1ZHdQc4QqmYwshw
1 parent 76cdf62 commit 5559872

2 files changed

Lines changed: 26 additions & 9 deletions

File tree

‎.github/workflows/owen-cli-release.yml‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,16 @@ jobs:
9090
echo "version=$v" >> "$GITHUB_OUTPUT"
9191
- name: On a tag push, assert the tag matches the csproj Version
9292
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/owen-cli-v')
93+
# env: indirection (CodeRabbit review), not `csproj_version="${{ ... }}"`
94+
# inlined into the script -- this workflow also triggers on pull_request
95+
# for paths that include the csproj this value is grep'd from, so a
96+
# version string containing shell metacharacters must never be
97+
# re-parsed as script text by bash.
98+
env:
99+
CSPROJ_VERSION: ${{ steps.version.outputs.version }}
93100
run: |
94101
tag_version="${GITHUB_REF_NAME#owen-cli-v}"
95-
csproj_version="${{ steps.version.outputs.version }}"
102+
csproj_version="$CSPROJ_VERSION"
96103
if [ "$tag_version" != "$csproj_version" ]; then
97104
echo "FAIL: tag owen-cli-v$tag_version does not match csproj Version $csproj_version"
98105
echo "Bump <Version> in $CLI_PROJECT to match the tag (or retag) before releasing."
@@ -138,6 +145,12 @@ jobs:
138145
defaults:
139146
run:
140147
shell: bash
148+
# env: indirection (CodeRabbit review), not `${{ needs.build-test-pack.outputs.version }}`
149+
# inlined directly into each run: script -- a job-level env var reads the
150+
# same way everywhere below without bash ever re-parsing the expression
151+
# as script text.
152+
env:
153+
OWEN_CLI_VERSION: ${{ needs.build-test-pack.outputs.version }}
141154
steps:
142155
- uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
143156
with:
@@ -179,7 +192,7 @@ jobs:
179192
</configuration>
180193
EOF
181194
- name: dotnet tool install --global from the packed artifact (isolated source)
182-
run: dotnet tool install --global Owen.Cli --version "${{ needs.build-test-pack.outputs.version }}" --configfile "$RUNNER_TEMP/isolated-nuget.config"
195+
run: dotnet tool install --global Owen.Cli --version "$OWEN_CLI_VERSION" --configfile "$RUNNER_TEMP/isolated-nuget.config"
183196
- name: A minimal leak, in a scratch dir with no Own.NET checkout anywhere
184197
run: |
185198
mkdir -p "$RUNNER_TEMP/sample"
@@ -197,8 +210,8 @@ jobs:
197210
- name: owen --version reports the released version
198211
run: |
199212
out=$(owen --version)
200-
[ "$out" = "${{ needs.build-test-pack.outputs.version }}" ] \
201-
|| { echo "FAIL: owen --version printed '$out', expected '${{ needs.build-test-pack.outputs.version }}'"; exit 1; }
213+
[ "$out" = "$OWEN_CLI_VERSION" ] \
214+
|| { echo "FAIL: owen --version printed '$out', expected '$OWEN_CLI_VERSION'"; exit 1; }
202215
- name: owen check finds the leak (--fail-on-finding exits 1, OWN001 present)
203216
run: |
204217
set +e
@@ -243,9 +256,9 @@ jobs:
243256
if command -v owen >/dev/null 2>&1; then
244257
echo "FAIL: owen still on PATH after uninstall"; exit 1
245258
fi
246-
dotnet tool install --global Owen.Cli --version "${{ needs.build-test-pack.outputs.version }}" --configfile "$RUNNER_TEMP/isolated-nuget.config"
259+
dotnet tool install --global Owen.Cli --version "$OWEN_CLI_VERSION" --configfile "$RUNNER_TEMP/isolated-nuget.config"
247260
out=$(owen --version)
248-
[ "$out" = "${{ needs.build-test-pack.outputs.version }}" ] \
261+
[ "$out" = "$OWEN_CLI_VERSION" ] \
249262
|| { echo "FAIL: reinstalled owen --version printed '$out'"; exit 1; }
250263
echo "OK: uninstall -> reinstall reproduces a working install"
251264

‎docs/notes/owen-cli-release.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,13 @@ Three jobs, each gated on the previous succeeding:
130130
per-OS hint (never an auto-download); and a full **uninstall →
131131
reinstall** cycle reproduces a working install (reinstall is the same
132132
code path an upgrade takes).
133-
3. **`publish`** — `if: startsWith(github.ref, 'refs/tags/owen-cli-v')`,
134-
so a `workflow_dispatch` run (no matching tag ref) can never reach this
135-
job no matter what inputs are given. Additionally targets the
133+
3. **`publish`** — `if: github.event_name == 'push' && startsWith(github.ref,
134+
'refs/tags/owen-cli-v')`, so neither a `workflow_dispatch` run nor a
135+
`pull_request` run can ever reach this job no matter what inputs/ref are
136+
given — a bare `startsWith(github.ref, ...)` alone would let
137+
`workflow_dispatch --ref owen-cli-v0.1.0` through, since a manual
138+
dispatch can be pointed at an existing tag ref too (Codex review, PR
139+
#244). Additionally targets the
136140
`nuget-release` GitHub Environment — **a repo admin must configure that
137141
environment with required reviewers under Settings → Environments before
138142
this job can run unattended; it does not exist yet.** Reads

0 commit comments

Comments
 (0)