|
| 1 | +--- |
| 2 | +# yamllint disable rule:comments |
| 3 | +name: Test & release |
| 4 | + |
| 5 | +'on': |
| 6 | + - pull_request |
| 7 | + - push |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 11 | + cancel-in-progress: ${{ github.ref != format('refs/heads/{0}', |
| 12 | + github.event.repository.default_branch) }} |
| 13 | + |
| 14 | +jobs: |
| 15 | + should-run: |
| 16 | + name: Prep / Should run |
| 17 | + runs-on: ubuntu-latest |
| 18 | + timeout-minutes: 5 |
| 19 | + outputs: |
| 20 | + should-run: ${{ steps.action.outputs.should-run }} |
| 21 | + steps: |
| 22 | + - id: action |
| 23 | + uses: |
| 24 | + # yamllint disable-line rule:line-length |
| 25 | + techneg-it/should-workflow-run@dcbb88600d59ec2842778ef1e2d41f680f876329 # v1.0.0 |
| 26 | + pre-commit: |
| 27 | + name: Lint / `pre-commit` |
| 28 | + needs: should-run |
| 29 | + if: fromJSON(needs.should-run.outputs.should-run) |
| 30 | + # yamllint disable-line rule:line-length |
| 31 | + container: techneg/ci-pre-commit:v2.4.25@sha256:ff5192e893c1079fbf70e3ce6bfc3773815041786a75659793158be930ba7803 |
| 32 | + runs-on: ubuntu-latest |
| 33 | + timeout-minutes: 5 |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 36 | + with: |
| 37 | + fetch-depth: 0 |
| 38 | + fetch-tags: true |
| 39 | + filter: tree:0 |
| 40 | + - name: Export `CI_CACHE_ID` from container |
| 41 | + run: echo "CI_CACHE_ID=$(cat /.ci_cache_id)" >> $GITHUB_ENV |
| 42 | + - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 |
| 43 | + with: |
| 44 | + path: ~/.cache/pre-commit |
| 45 | + key: "${{ env.CI_CACHE_ID }}|\ |
| 46 | + ${{ hashFiles('.pre-commit-config.yaml') }}" |
| 47 | + - name: Run `pre-commit` |
| 48 | + run: | |
| 49 | + git config --global --add safe.directory $(pwd) |
| 50 | + pre-commit run --all-files --color always --verbose |
| 51 | + pre-commit run --color always --hook-stage manual commitlint-ci |
| 52 | + results: |
| 53 | + name: Release / Collect results |
| 54 | + permissions: |
| 55 | + checks: read |
| 56 | + runs-on: ubuntu-latest |
| 57 | + timeout-minutes: 15 |
| 58 | + steps: |
| 59 | + # yamllint disable-line rule:line-length |
| 60 | + - uses: poseidon/wait-for-status-checks@899c768d191b56eef585c18f8558da19e1f3e707 # v0.6.0 |
| 61 | + with: |
| 62 | + ignore: Release / Collect results |
| 63 | + ignore_pattern: ^GitLab CI |
| 64 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 65 | + - run: echo "::notice ::Workflow success!" |
0 commit comments