diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..ac48398 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,4 @@ +# Require explicit review for workflow and GitHub automation changes. +.github/CODEOWNERS @intertwine +.github/workflows/** @intertwine +.github/actions/** @intertwine diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ee51d4..b519b2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,9 @@ on: branches: [main] workflow_dispatch: +permissions: + contents: read + jobs: test: runs-on: ubuntu-latest @@ -16,15 +19,15 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 with: python-version: ${{ matrix.python-version }} - name: Install uv - uses: astral-sh/setup-uv@v8.0.0 + uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 - name: Install dependencies run: uv sync diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index 71bea42..2c41fcc 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -10,6 +10,9 @@ on: # - "src/**/*.js" # - "src/**/*.jsx" +permissions: + contents: read + jobs: claude-review: # Optional: Filter by PR author @@ -29,13 +32,28 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: - fetch-depth: 1 + fetch-depth: 0 + + - name: Skip when the review workflow itself changes + id: workflow-change + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: | + set -euo pipefail + if git diff --name-only "${BASE_SHA}...${HEAD_SHA}" | grep -Fxq ".github/workflows/claude-code-review.yml"; then + echo "skip=true" >> "$GITHUB_OUTPUT" + echo "Skipping Claude review because this pull request updates the review workflow itself." + else + echo "skip=false" >> "$GITHUB_OUTPUT" + fi - name: Run Claude Code Review id: claude-review - uses: anthropics/claude-code-action@v1 + if: steps.workflow-change.outputs.skip != 'true' + uses: anthropics/claude-code-action@c7c8889b30499b4e46f4c32b892e43cd364bc2fe # v1 with: claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} plugin_marketplaces: 'https://github.com/anthropics/claude-code.git' diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index 9370e4f..7b80cdc 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -28,13 +28,13 @@ jobs: actions: read # Required for Claude to read CI results on PRs steps: - name: Checkout repository - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: fetch-depth: 1 - name: Run Claude Code id: claude - uses: anthropics/claude-code-action@v1 + uses: anthropics/claude-code-action@c7c8889b30499b4e46f4c32b892e43cd364bc2fe # v1 with: claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 0000000..4198a71 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,23 @@ +name: Dependency Review + +on: + pull_request: + branches: [main] + paths: + - "pyproject.toml" + - "uv.lock" + - "poetry.lock" + - "requirements*.txt" + - ".github/workflows/**" # GitHub tracks Actions in the dependency graph. + +permissions: + contents: read + pull-requests: read + +jobs: + dependency-review: + runs-on: ubuntu-latest + + steps: + - name: Dependency Review + uses: actions/dependency-review-action@2031cfc080254a8a887f58cffee85186f0e49e48 # v4.9.0 diff --git a/.github/workflows/homebrew-release.yml b/.github/workflows/homebrew-release.yml index 7070cfd..5f94a05 100644 --- a/.github/workflows/homebrew-release.yml +++ b/.github/workflows/homebrew-release.yml @@ -6,21 +6,24 @@ on: - "v*" workflow_dispatch: +permissions: + contents: read + jobs: update-tap: runs-on: ubuntu-latest steps: - name: Checkout source repo - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Set up Python - uses: actions/setup-python@v6 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 with: python-version: "3.13" - name: Install uv - uses: astral-sh/setup-uv@v8.0.0 + uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 - name: Check formula name availability in Homebrew/core run: | @@ -71,7 +74,7 @@ jobs: run: uv run --with pip python scripts/generate_homebrew_formula.py --output packaging/homebrew/observational-memory.rb - name: Checkout tap repo - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: repository: ${{ vars.HOMEBREW_TAP_REPO }} token: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}