diff --git a/.github/workflows/compile-check.yml b/.github/workflows/compile-check.yml deleted file mode 100644 index 76bb24e..0000000 --- a/.github/workflows/compile-check.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Compile check - -on: - pull_request: - paths: - - '.github/workflows/gh-aw-*.md' - - '.github/workflows/gh-aw-*.lock.yml' - - '.github/workflows/gh-aw-fragments/**' - -permissions: - contents: read - -jobs: - compile-check: - name: Verify lock files are up to date - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - - name: Detect gh-aw version from lock files - id: detect-version - run: | - version=$(head -1 .github/workflows/gh-aw-*.lock.yml | grep -oP '"compiler_version":"v\K[^"]+' | head -1) - echo "version=v${version}" >> "$GITHUB_OUTPUT" - - - name: Install gh-aw - run: gh extension install github/gh-aw --pin ${{ steps.detect-version.outputs.version }} - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Compile - run: gh aw compile - - - name: Check for uncommitted changes - run: | - if ! git diff --quiet .github/workflows/*.lock.yml; then - echo "::error::Lock files are out of date. Run 'make compile' and commit the changes." - git diff --stat .github/workflows/*.lock.yml - exit 1 - fi diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 14b7246..8f4542e 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -17,4 +17,8 @@ jobs: - uses: actions/setup-python@v6 with: python-version: "3.x" + - name: Install gh-aw + run: gh extension install github/gh-aw + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f4ec946..956d8dd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,3 +23,12 @@ repos: hooks: - id: actionlint exclude: '\.lock\.yml$' + + - repo: local + hooks: + - id: compile-workflows + name: compile gh-aw workflows + language: system + entry: gh aw compile + files: '\.github/workflows/gh-aw-.*\.md$|\.github/workflows/gh-aw-fragments/' + pass_filenames: false