You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 76cdf62
Browse filesBrowse the repository at this point in the historyBrowse files
owen-cli-release: exercise the workflow on PRs, require actual reviewers
Two independent review findings, both closed:
1. owen-cli-release.yml only triggered on tag push / workflow_dispatch, so
a green PR check never actually ran build-test-pack -> smoke-test on
either OS -- only a real tag push did, and PRs never push tags. Added a
pull_request trigger scoped to the paths that matter (the CLI/extractor
projects, ownlang, the workflow file itself, the shared protection
script). The publish job's existing tag-push condition is unchanged, so
it stays skipped on pull_request exactly as it already was on
workflow_dispatch.
2. The environment-protection check (`.protection_rules | length`) accepted
ANY protection rule -- a wait_timer-only or branch_policy-only
environment, or a required_reviewers rule saved with zero reviewers,
none of which actually gate on a human. Extracted the real predicate
into scripts/check_environment_protection.sh: accepts only a
required_reviewers rule with >=1 reviewer. The publish job now checks
out just scripts/ (sparse), fetches the environment via `gh api` into a
file, and calls the script. Its permissions gained `actions: read`,
which the environment-read endpoint requires alongside `contents: read`.
Fixture-driven, offline test in ci.yml's new environment-protection-selftest
job (runs on every ordinary push/PR, no GitHub API or real Environment
needed): zero rules, wait_timer-only, branch_policy-only, and
required_reviewers-with-zero-reviewers all reject; required_reviewers with
one reviewer accepts.
The same script and fixtures will also back action-marketplace-readiness.yml's
analogous move-major-tag check (PR #248, stacked on this branch for now --
duplication is temporary until #247 merges and #248 rebases cleanly onto
main).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSXTDuh1ZHdQc4QqmYwshw
# GitHub auto-creates a REFERENCED-BUT-NEVER-CONFIGURED environment on
251
279
# first use, with NO protection rules (Codex review: "referencing a
252
280
# missing environment creates it and the newly created environment has
@@ -256,19 +284,19 @@ jobs:
256
284
# any step runs already let this run through if the environment was
257
285
# never actually configured with required reviewers. This step is the
258
286
# loud, fail-closed check for that: it runs first, before the artifact
259
-
# is even downloaded, and refuses to publish if the environment
260
-
# currently has zero protection rules, rather than silently letting an
261
-
# unconfigured "protected" environment behave like no gate at all.
287
+
# is even downloaded, and refuses to publish unless the environment
288
+
# has a REQUIRED_REVIEWERS rule with at least one reviewer (Codex
289
+
# review: a bare protection_rules count also accepts a wait_timer- or
290
+
# branch_policy-only environment, neither of which waits for a
291
+
# human) -- scripts/check_environment_protection.sh is the single
292
+
# source of truth for that predicate, fixture-tested in ci.yml.
262
293
- name: Refuse to publish unless nuget-release actually has protection rules
263
294
env:
264
295
GH_TOKEN: ${{ github.token }}
265
296
run: |
266
-
rules=$(gh api "repos/${{ github.repository }}/environments/nuget-release" --jq '.protection_rules | length')
267
-
if [ "$rules" -eq 0 ]; then
268
-
echo "::error::the 'nuget-release' GitHub Environment has no protection rules (required reviewers) configured -- a repo admin must set that up under Settings -> Environments before a tag push can safely reach 'dotnet nuget push'. Refusing to publish."
269
-
exit 1
270
-
fi
271
-
echo "OK: nuget-release environment has $rules protection rule(s) configured"
297
+
gh api "repos/${{ github.repository }}/environments/nuget-release" > "$RUNNER_TEMP/nuget-release-env.json"
|| { echo "::error::the 'nuget-release' GitHub Environment does not have a required_reviewers rule with at least one reviewer -- a repo admin must set that up under Settings -> Environments before a tag push can safely reach 'dotnet nuget push'. Refusing to publish."; exit 1; }
0 commit comments