Repository navigation
Wait for Swift CI before TestFlight ships #245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| #!/usr/bin/env bash | ||
| # Add required status checks to CodeCaps ruleset 24433457. | ||
| # | ||
| # Dry-run unless --apply. --apply refuses unless the Swift CI job names | ||
| # and gitleaks are already success on the default branch tip, so a starved or | ||
| # red Swift CI cannot become a gate that wedges every merge. | ||
| # | ||
| # Needs a token that can administer repository rulesets (GITHUB_TOKEN from | ||
| # Actions cannot). The token is never printed. | ||
| # | ||
| # scripts/apply-main-compile-gate-ruleset.sh | ||
| # scripts/apply-main-compile-gate-ruleset.sh --apply | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| ROOT="$(cd "$(dirname "$0")" && pwd)" | ||
| REPO="${REPO:-Simple-With-Us/CodeCaps}" | ||
| RULESET_ID="${RULESET_ID:-24433457}" | ||
| APPLY=0 | ||
|
|
||
| if [[ "${1:-}" == "--apply" ]]; then | ||
| APPLY=1 | ||
| elif [[ -n "${1:-}" ]]; then | ||
| echo "usage: $0 [--apply]" >&2 | ||
| exit 2 | ||
| fi | ||
|
|
||
| [[ "$REPO" =~ ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ ]] || { | ||
| echo "REPO is not owner/name" >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| current="$(mktemp)" | ||
| updated="$(mktemp)" | ||
| trap 'rm -f "$current" "$updated"' EXIT | ||
|
|
||
| gh api "repos/${REPO}/rulesets/${RULESET_ID}" >"$current" | ||
| python3 "$ROOT/compile_gate_ruleset.py" --ruleset "$current" >"$updated" | ||
|
|
||
| echo "ruleset ${RULESET_ID} on ${REPO}" | ||
| python3 - "$current" "$updated" "$ROOT/compile_gate_ruleset.py" <<'PY' | ||
| import importlib.util | ||
| import json | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| spec = importlib.util.spec_from_file_location("compile_gate_ruleset", sys.argv[3]) | ||
| module = importlib.util.module_from_spec(spec) | ||
| spec.loader.exec_module(module) | ||
| current = json.loads(Path(sys.argv[1]).read_text()) | ||
| updated = json.loads(Path(sys.argv[2]).read_text()) | ||
| print("current contexts:", ", ".join(module.contexts_of(current)) or "(none)") | ||
| print("updated contexts:", ", ".join(module.contexts_of(updated))) | ||
| print("other rules kept:", ", ".join( | ||
| rule.get("type") for rule in updated["rules"] if rule.get("type") != "required_status_checks" | ||
| )) | ||
| PY | ||
|
|
||
| branch="$(gh api "repos/${REPO}" --jq .default_branch)" | ||
| sha="$(gh api "repos/${REPO}/commits/${branch}" --jq .sha)" | ||
| echo "default branch ${branch} @ ${sha}" | ||
|
|
||
| set +e | ||
| ONCE=1 REPO="$REPO" SHA="$sha" \ | ||
| bash "$ROOT/await-swift-ci-checks.sh" \ | ||
| "Mac package build and test" \ | ||
| "iOS companion compile" \ | ||
| "gitleaks" | ||
| checks=$? | ||
| set -e | ||
| if [[ "$checks" -eq 0 ]]; then | ||
| echo "compile checks on ${branch} are success" | ||
| else | ||
| echo "compile checks on ${branch} are not success (exit ${checks})" | ||
| fi | ||
|
|
||
| if [[ "$APPLY" -eq 0 ]]; then | ||
| echo "dry-run only. Re-run with --apply after those checks are success." | ||
| exit 0 | ||
| fi | ||
|
|
||
| if [[ "$checks" -ne 0 ]]; then | ||
| echo "refusing --apply until Mac package build and test, iOS companion compile, and gitleaks are success on ${branch}" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| gh api --method PUT "repos/${REPO}/rulesets/${RULESET_ID}" --input "$updated" \ | ||
| --jq '{id,name,enforcement,rule_types:[.rules[].type]}' | ||
| echo "updated ruleset ${RULESET_ID}" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verification section gap in
docs/rollouts/2026-10-15-cc19-compile-gate.md: rule 14 requires the section to list, in order,npm run lint,npx tsc --noEmit,npm test, andnpm run build, each paired with a pass/fail outcome, but the added line is a barepython3 scripts/compile_gate_checks_test.pythat names none of the four required CI guard commands and carries no pass/fail status, so the note reads as ad-hoc verification rather than the mandated four-step build/test gate.Also found in:
docs/rollouts/2026-10-15-cc19-compile-gate.md:40-40docs/rollouts/2026-10-15-cc19-compile-gate.md:39-39Kody rule violation: Mandatory pre-commit handoff protocol and verification trio before claiming work done
Prompt for LLM
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.