Skip to content

Commit fd965c9

Browse files
committed
fix: address review comments and absorb Dependabot version bumps
Review fixes (CodeRabbit + Copilot): - Fix sync_labels subshell scoping: use process substitution instead of piped while loop so changes variable propagates correctly - Use grep -qxF instead of grep -qx to avoid regex interpretation - Read default branch from config instead of hardcoding "main" - Handle explicit false overrides for vulnerability_alerts - Remove unused issues: write permission from workflow - Create drift issue before closing old ones to prevent gap - Add concurrency group to prevent parallel sync runs - Raise repo list limit from 200 to 1000 - Add label field structure validation to baseline schema check Dependabot bumps absorbed: - actions/checkout v4.2.2 -> v6.0.2 - actions/setup-python v5.6.0 -> v6.2.0 - actions/upload-artifact v4.6.2 -> v7.0.0 - github/codeql-action v3.28.18 -> v4.32.6 - peter-evans/create-pull-request v7.0.8 -> v8.1.0 Lint fixes: - Fix MD032 (blanks around lists) in skill SKILL.md - Fix MD029 (ordered list prefix) in audit SKILL.md - Fix MD041 (first line heading) in copilot-instructions and PR template - Fix MD034 (bare URLs) in CONTRIBUTING.md and SECURITY.md - Remove unused drift_count variable (shellcheck SC2034)
1 parent 5ea0394 commit fd965c9

15 files changed

Lines changed: 100 additions & 58 deletions

File tree

.claude/skills/add-repo-override/SKILL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Add a per-repo exception to `config/overrides.json`.
1313
`$ARGUMENTS` should be in the format: `<repo-name> <setting-path> <value>`
1414

1515
Examples:
16+
1617
- `my-repo branch_protection.required_status_checks.contexts '["Build","Test"]'`
1718
- `my-repo repo_settings.has_wiki true`
1819

.claude/skills/audit/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Run a dry-run sync to check for drift without applying changes.
1717
./scripts/sync-repo-settings.sh --dry-run
1818
```
1919

20-
2. Display the report:
20+
1. Display the report:
2121

2222
```bash
2323
cat reports/sync-report.md

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Pull Request
2+
13
## What changed
24

35
<!-- Brief description of the change -->

.github/actions/security-scan/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ runs:
2424
output: trivy-results.sarif
2525

2626
- name: Upload Trivy results to GitHub Security
27-
uses: github/codeql-action/upload-sarif@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
27+
uses: github/codeql-action/upload-sarif@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6
2828
if: always()
2929
with:
3030
sarif_file: trivy-results.sarif

.github/actions/update-pre-commit-composite/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ runs:
1010
using: composite
1111
steps:
1212
- name: Set up Python
13-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
13+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
1414
with:
1515
python-version: "3.x"
1616

@@ -23,7 +23,7 @@ runs:
2323
run: pre-commit autoupdate
2424

2525
- name: Create Pull Request
26-
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
26+
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
2727
with:
2828
token: ${{ inputs.github_token }}
2929
commit-message: "chore: update pre-commit hook versions"

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Review priorities for this repository:
1+
# Review Priorities
22

33
1. Shell script quality: shellcheck and shellharden compliance, proper
44
quoting, error handling (set -euo pipefail), no hardcoded tokens

.github/workflows/quality-checks.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1919

2020
- name: Lint markdown
2121
uses: DavidAnson/markdownlint-cli2-action@db4c2f7b1e4a6de4660458dd8d547f94deaac667 # v22.0.0
@@ -25,7 +25,7 @@ jobs:
2525
runs-on: ubuntu-latest
2626
steps:
2727
- name: Checkout
28-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2929

3030
- name: Lint YAML
3131
uses: ibiqlik/action-yamllint@2576f72e4b4e5aef56e60fc8a24fa17e25be1fef # v3.1.1
@@ -37,7 +37,7 @@ jobs:
3737
runs-on: ubuntu-latest
3838
steps:
3939
- name: Checkout
40-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
40+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4141

4242
- name: Run ShellCheck
4343
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # v2.0.0
@@ -47,7 +47,7 @@ jobs:
4747
runs-on: ubuntu-latest
4848
steps:
4949
- name: Checkout
50-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
50+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5151

5252
- name: Check required files
5353
run: |
@@ -90,6 +90,12 @@ jobs:
9090
echo "OK: section '$section' present"
9191
fi
9292
done
93+
# Validate label structure
94+
LABEL_ERRORS=$(jq '[.labels[] | select(.name == null or .color == null or .description == null)] | length' config/baseline.json)
95+
if [ "$LABEL_ERRORS" -gt 0 ]; then
96+
echo "ERROR: $LABEL_ERRORS labels missing required fields (name, color, description)"
97+
ERRORS=$((ERRORS + LABEL_ERRORS))
98+
fi
9399
if [ "$ERRORS" -gt 0 ]; then
94100
echo "ERROR: baseline.json schema validation failed"
95101
exit 1
@@ -100,7 +106,7 @@ jobs:
100106
runs-on: ubuntu-latest
101107
steps:
102108
- name: Checkout
103-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
109+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
104110

105111
- name: Install zizmor
106112
run: |

.github/workflows/security.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout
20-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2121
with:
2222
persist-credentials: false
2323

.github/workflows/sync-settings.yml

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,20 @@ on:
1515
- "--dry-run"
1616
- "--apply"
1717

18+
concurrency:
19+
group: settings-sync
20+
cancel-in-progress: false
21+
1822
permissions:
1923
contents: read
20-
issues: write
2124

2225
jobs:
2326
sync:
2427
name: Sync Settings
2528
runs-on: ubuntu-latest
2629
steps:
2730
- name: Checkout
28-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2932

3033
- name: Run settings sync
3134
id: sync
@@ -35,7 +38,7 @@ jobs:
3538
github_token: ${{ secrets.ORG_SETTINGS_PAT }}
3639

3740
- name: Upload report artifact
38-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
41+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
3942
with:
4043
name: sync-report-${{ github.run_number }}
4144
path: reports/sync-report.md
@@ -49,42 +52,50 @@ jobs:
4952
echo ""
5053
echo "| Metric | Value |"
5154
echo "| --- | --- |"
52-
echo "| Repositories scanned | ${{ steps.sync.outputs.total_repos }} |"
53-
echo "| Compliant | ${{ steps.sync.outputs.compliant }} |"
54-
echo "| Drift detected | ${{ steps.sync.outputs.drift }} |"
55-
echo "| Mode | ${{ github.event.inputs.mode || '--apply' }} |"
55+
echo "| Repositories scanned | $TOTAL_REPOS |"
56+
echo "| Compliant | $COMPLIANT |"
57+
echo "| Drift detected | $DRIFT |"
58+
echo "| Mode | $MODE |"
5659
echo ""
5760
echo "### Full Report"
5861
echo ""
5962
cat reports/sync-report.md
6063
} >> "$GITHUB_STEP_SUMMARY"
64+
env:
65+
TOTAL_REPOS: ${{ steps.sync.outputs.total_repos }}
66+
COMPLIANT: ${{ steps.sync.outputs.compliant }}
67+
DRIFT: ${{ steps.sync.outputs.drift }}
68+
MODE: ${{ github.event.inputs.mode || '--apply' }}
6169

62-
- name: Create or update drift issue
70+
- name: Create drift issue
6371
if: steps.sync.outputs.has_drift == 'true'
6472
env:
6573
GH_TOKEN: ${{ secrets.ORG_SETTINGS_PAT }}
74+
DRIFT: ${{ steps.sync.outputs.drift }}
75+
TOTAL_REPOS: ${{ steps.sync.outputs.total_repos }}
76+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
77+
SYNC_MODE: ${{ github.event.inputs.mode || '--apply' }}
6678
run: |
6779
TITLE="chore: settings drift detected — $(date '+%Y-%m-%d')"
68-
BODY=$(cat <<'ISSUE_EOF'
69-
## Settings Drift Report
80+
BODY="## Settings Drift Report
7081
71-
**Run**: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
72-
**Mode**: ${{ github.event.inputs.mode || '--apply' }}
73-
**Repos with drift**: ${{ steps.sync.outputs.drift }} / ${{ steps.sync.outputs.total_repos }}
82+
**Run**: $RUN_URL
83+
**Mode**: $SYNC_MODE
84+
**Repos with drift**: $DRIFT / $TOTAL_REPOS
7485
75-
See the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for the full report.
86+
See the [workflow run]($RUN_URL) for the full report."
7687
77-
ISSUE_EOF
78-
)
88+
# Create new issue first, then close old ones
89+
gh issue create --title "$TITLE" --body "$BODY" --label "settings-drift"
7990
80-
# Close previous drift issues
91+
# Close previous drift issues (all except the one just created)
92+
LATEST=$(gh issue list --label "settings-drift" --state open --json number --jq '.[0].number')
8193
gh issue list --label "settings-drift" --state open --json number --jq '.[].number' | while read -r num; do
82-
gh issue close "$num" --comment "Superseded by new sync run."
94+
if [ "$num" != "$LATEST" ]; then
95+
gh issue close "$num" --comment "Superseded by new sync run."
96+
fi
8397
done
8498
85-
# Create new issue
86-
gh issue create --title "$TITLE" --body "$BODY" --label "settings-drift"
87-
8899
- name: Close drift issue if compliant
89100
if: steps.sync.outputs.has_drift == 'false'
90101
env:
@@ -99,7 +110,7 @@ jobs:
99110
runs-on: ubuntu-latest
100111
steps:
101112
- name: Checkout
102-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
113+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
103114

104115
- name: Check for new repos
105116
id: newrepos
@@ -116,7 +127,7 @@ jobs:
116127
|| date -u -v-7d '+%Y-%m-%dT%H:%M:%SZ')
117128
NEW_REPOS=$(gh repo list gamaware --no-archived --json name,createdAt \
118129
--jq "[.[] | select(.createdAt > \"$WEEK_AGO\")] | .[].name" \
119-
--limit 200 || echo "")
130+
--limit 1000 || echo "")
120131
121132
if [ -n "$NEW_REPOS" ]; then
122133
echo "has_new=true" >> "$GITHUB_OUTPUT"
@@ -148,7 +159,7 @@ jobs:
148159
--label "new-repo"
149160
150161
- name: Upload new repos report
151-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
162+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
152163
with:
153164
name: new-repos-report-${{ github.run_number }}
154165
path: reports/new-repos.md

.github/workflows/update-pre-commit-hooks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1919
with:
2020
persist-credentials: false
2121

0 commit comments

Comments
 (0)