Skip to content

fix(ci): resolve PEP 668 failure and unsigned downstream commits - #28

Merged
divisionseven merged 3 commits into
mainfrom
develop
Jul 21, 2026
Merged

fix(ci): resolve PEP 668 failure and unsigned downstream commits#28
divisionseven merged 3 commits into
mainfrom
develop

Conversation

@divisionseven

Copy link
Copy Markdown
Owner

Summary

Fix two CI issues: (1) GitHub Action CI failing on Ubuntu 24.04 due to PEP 668 blocking system-wide Python package installs, and (2) sync workflows producing unsigned commits that trigger "unverified" alerts on downstream repos.

  • Replaced Python YAML validation with Node.js require('yaml') (already a devDependency)
  • Replaced manual git/PR operations with peter-evans/create-pull-request@v8 + actions/create-github-app-token@v3
  • All downstream commits are now cryptographically signed by the GitHub App identity

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • 🚀 New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 🔒 Security fix
  • ♻️ Refactor (no functional changes)
  • 📖 Documentation update
  • 🧪 Tests only
  • 🏗️ Build / CI / dependency update
  • ⚡ Performance improvement
  • 🎨 Style (formatting, no logic change)
  • 🧹 Chore (formatting, renaming, cleanup)

Motivation and Context

Two CI issues needed fixing:

Issue 1: PEP 668 CI failure: The GitHub Action CI workflows (ci.yml, release.yml) ran uv pip install --system pyyaml to install Python for YAML validation. Ubuntu 24.04's Python 3.12 is marked as externally managed (PEP 668), which blocks system-wide package installs with exit code 2. Rather than fixing the Python install, we eliminated Python entirely — the yaml npm package was already a devDependency, so we replaced python3 -c "import yaml..." with node -e "require('yaml')...".

Issue 2: Unsigned downstream commits: The sync workflows (sync-homebrew-tap.yml, sync-github-action.yml, release.yml) used raw git commit commands with fine-grained PATs to push changes to downstream repos. PATs authenticate pushes but cannot sign commits, triggering GitHub's "unsigned commit" security alerts on homebrew-pkg-defender and pkg-defender-action. We replaced the entire manual git/PR workflow with peter-evans/create-pull-request@v8 + actions/create-github-app-token@v3, the industry standard (2,820+ stars) that handles branch creation, signed commits, PR creation, and stale PR cleanup automatically.


Implementation Notes

PEP 668 fix (3 files):

  • github-action/tests/validate.sh: python3 -c "import yaml..." to node -e "require('yaml')..."
  • github-action/.github/workflows/ci.yml: removed setup-uv + uv pip install --system pyyaml steps
  • github-action/.github/workflows/release.yml: same removal

Sync workflow refactor (3 files):

  • .github/workflows/sync-homebrew-tap.yml: removed 7 manual git/PR steps, added 3 action-based steps
  • .github/workflows/sync-github-action.yml: same pattern
  • .github/workflows/release.yml: removed 4 manual steps, added 6 action-based steps (includes temp commit undo via git reset HEAD~1)

Key design decisions:

  • sign-commits: true on all create-pull-request steps, commits are API-signed by GitHub, no GPG keys needed
  • delete-branch: true replaces manual stale PR cleanup loops
  • peter-evans/enable-pull-request-automerge with continue-on-error: true replaces manual gh pr merge --auto
  • Fixed branch names (sync/tap, sync/action) instead of date-stamped branches, no stale branches accumulate
  • Old PAT secrets (HOMEBREW_TAP_PAT, ACTION_REPO_PAT) removed from workflows but kept in repo settings until new workflows are verified

Prerequisites: Required a GitHub App to be created and installed on all 3 repos


Testing

  • I have added tests that cover the changes in this PR
  • All existing tests pass locally (pytest --cov-fail-under=90)
  • I have run the e2e gate test locally (pytest tests/integration/test_smoke_e2e.py --tb=short -q)
  • I have tested this manually (describe what you did below)

Manual testing performed:

  • github-action/tests/validate.sh: all 6 validation tests pass with Node.js YAML validation
  • YAML syntax validated on all 5 workflow files via python3 -c "import yaml; yaml.safe_load(...)"
  • actionlint run on all workflow files, only non-blocking shellcheck style advisories
  • Full diff review performed, no accidental deletions, no formatting issues
  • Cross-file consistency verified, action SHAs, secret names, branch naming all consistent

Checklist

  • My code follows the project's style guidelines (passes ruff check . and ruff format --check .)
  • My code passes type checking (mypy .)
  • My changes maintain or improve code coverage (pytest --cov-fail-under=90)
  • My CLI changes use the correct exit codes defined in docs/reference/exit-codes.md
  • I have updated documentation as needed (README, docstrings, CHANGELOG)
  • I have updated CHANGELOG.md with a brief entry under [Unreleased]
  • My changes do not introduce new dependencies without discussion
  • Any new dependencies are pinned appropriately in pyproject.toml
  • I am aware that the dependency review workflow (.github/workflows/dependency-review.yml) runs automatically on PRs
  • I have reviewed my own diff before requesting review

Breaking Changes

None. The sync workflows now require a GitHub App to be created and installed (prerequisites documented in PR). Old PAT secrets are kept as fallback until verification.


Related Issues / PRs

  • Fixes unsigned commit alerts on divisionseven/homebrew-pkg-defender
  • Fixes unsigned commit alerts on divisionseven/pkg-defender-action
  • Fixes downstream CI failure on Ubuntu 24.04 runners (PEP 668)

…ntu 24.04

Signed-off-by: Division 7 <divisionseven@users.noreply.github.com>
Downstream repo commits were unsigned, triggering GitHub's
"unsigned commit" security alerts on homebrew-pkg-defender
and pkg-defender-action.

Replace manual git clone/commit/push operations with
`peter-evans/create-pull-request@v8` and
`actions/create-github-app-token@v3` across `sync-homebrew-tap.yml`,
`sync-github-action.yml`, and `release.yml`. All downstream commits
are now signed by the GitHub App identity.

- Removed PAT-based auth
- Added GitHub App token generation
- Added sign-commits: `true` on all PR creation steps
- Removed stale PR cleanup steps (handled by `delete-branch: true`)
- Replaced gh pr merge with `enable-pull-request-automerge`

Signed-off-by: Division 7 <divisionseven@users.noreply.github.com>
Signed-off-by: Division 7 <divisionseven@users.noreply.github.com>
@divisionseven divisionseven self-assigned this Jul 21, 2026
@divisionseven divisionseven added area: ci-cd GitHub Actions, pre-commit, and CI/CD integration performance Performance improvement or regression labels Jul 21, 2026
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails
actions/actions/create-github-app-token bcd2ba49218906704ab6c1aa796996da409d3eb1 🟢 6.1
Details
CheckScoreReason
Code-Review⚠️ 2Found 3/14 approved changesets -- score normalized to 2
Maintained🟢 1013 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Binary-Artifacts🟢 10no binaries found in the repo
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Pinned-Dependencies🟢 7dependency not pinned by hash detected -- score normalized to 7
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
SAST🟢 6SAST tool is not run on all commits -- score normalized to 6
Branch-Protection🟢 6branch protection is not maximal on development and all release branches
actions/peter-evans/create-pull-request 5f6978faf089d4d20b00c7766989d076bb2fc7f1 🟢 5
Details
CheckScoreReason
Maintained🟢 89 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 8
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Packaging⚠️ -1packaging workflow not detected
Code-Review⚠️ 2Found 3/11 approved changesets -- score normalized to 2
Binary-Artifacts🟢 10no binaries found in the repo
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies🟢 10all dependencies are pinned
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: some github tokens can't read classic branch protection rules: https://github.com/ossf/scorecard-action/blob/main/docs/authentication/fine-grained-auth-token.md
Signed-Releases⚠️ -1no releases found
Security-Policy⚠️ 0security policy file not detected
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0

Scanned Files

  • .github/workflows/sync-homebrew-tap.yml

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@divisionseven
divisionseven merged commit b3fb8fa into main Jul 21, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci-cd GitHub Actions, pre-commit, and CI/CD integration performance Performance improvement or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants