Skip to content
Closed
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
47 changes: 47 additions & 0 deletions .github/rulesets/default-main-protection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "default-main-protection",
"target": "branch",
"enforcement": "active",
"conditions": {
"ref_name": {
"include": ["~DEFAULT_BRANCH"],
"exclude": []
}
},
"rules": [
{
"type": "pull_request",
"parameters": {
"required_approving_review_count": 0,
"dismiss_stale_reviews_on_push": false,
"required_reviewers": [],
"require_code_owner_review": false,
"dismissal_restriction": {
"enabled": false,
"allowed_actors": []
},
"require_last_push_approval": false,
"required_review_thread_resolution": true,
"require_extra_approval_for_unattributed_changes": true,
"allowed_merge_methods": ["merge", "squash", "rebase"]
}
},
{
"type": "non_fast_forward"
},
{
"type": "deletion"
},
{
"type": "required_status_checks",
"parameters": {
"strict_required_status_checks_policy": false,
"required_status_checks": [
{
"context": "Swift CI / compile (macOS)"
}
Comment on lines +40 to +42

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The required status check context Swift CI / compile (macOS) does not match any check run generated by the workflow, blocking PR merges indefinitely.
Severity: HIGH

Suggested Fix

Update the context in .github/rulesets/default-main-protection.json to match the exact check run name produced by swift-ci.yml, or adjust the workflow job name to align with the required status check.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: .github/rulesets/default-main-protection.json#L40-L42

Potential issue: The ruleset configures a required status check named `Swift CI /
compile (macOS)`. However, the workflow job does not emit a check matching this full
context name, meaning the required check will never report a status. Consequently, pull
requests targeting the protected branch will be indefinitely blocked from merging.

Did we get this right? 👍 / 👎 to inform future reviews.

]
}
}
]
}
10 changes: 10 additions & 0 deletions .github/workflows/mac-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,17 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
compile:
name: compile (macOS)
if: github.event.repository.fork == false
runs-on: macos-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Swift compile gate
run: swift build

release:
needs: compile
if: github.event.repository.fork == false
runs-on: macos-latest
timeout-minutes: 60
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/swift-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@ env:
SCHEME: CodeCapsCompanion

jobs:
compile:
name: compile (macOS)
runs-on: macos-latest
steps:
- uses: actions/checkout@v7
- name: Swift compile gate
run: swift build

package:
needs: compile
runs-on: macos-latest
steps:
- uses: actions/checkout@v7
Expand All @@ -41,6 +50,7 @@ jobs:
if-no-files-found: warn

companion:
needs: compile
runs-on: macos-latest
steps:
- uses: actions/checkout@v7
Expand Down
14 changes: 14 additions & 0 deletions scripts/apply-main-compile-gate-ruleset.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -euo pipefail

repo="${1:-Simple-With-Us/CodeCaps}"
ruleset_id="${2:-24433457}"
config="${3:-$(cd "$(dirname "$0")/.." && pwd)/.github/rulesets/default-main-protection.json}"

if [[ ! -f "$config" ]]; then
echo "ruleset config not found: $config" >&2
exit 1
fi

gh api "repos/${repo}/rulesets/${ruleset_id}" -X PUT --input "$config"
echo "Updated ruleset ${ruleset_id} on ${repo} (required: Swift CI / compile (macOS))."
Loading