feat(hooks): run custom step types as lifecycle hooks (kind: step) #2743
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: atmos.ci | |
| on: pull_request | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| autofix: | |
| if: github.actor != 'atmos-pro[bot]' | |
| runs-on: | |
| - runs-on=${{github.run_id}} | |
| - runner=terraform | |
| - tag=atmos | |
| - extras=s3-cache | |
| - private=false | |
| container: | |
| image: ghcr.io/cloudposse/atmos:1.215.0 | |
| permissions: | |
| contents: read | |
| id-token: write | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: runs-on/action@v2 | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| # Install Go and toolchain dependencies | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: go.mod | |
| - run: go mod tidy | |
| - name: Install toolchain dependencies | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| atmos toolchain install | |
| atmos toolchain env --format=github | |
| # gofumpt | |
| - name: Get changed Go files | |
| id: changed-files | |
| uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6 | |
| with: | |
| use_rest_api: "true" | |
| files: | | |
| **/*.go | |
| - if: steps.changed-files.outputs.all_changed_files_count != '0' | |
| env: | |
| ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
| run: | | |
| # shellcheck disable=SC2086 | |
| gofumpt -l -w $ALL_CHANGED_FILES | |
| # Run pre-commit hooks for whitespace fixes | |
| - name: Install pre-commit | |
| run: | | |
| apt-get update && apt-get install -y --no-install-recommends pre-commit | |
| - name: Run pre-commit whitespace fixes | |
| run: | | |
| # Run only the whitespace-related hooks from pre-commit | |
| pre-commit run trailing-whitespace --all-files || true | |
| pre-commit run end-of-file-fixer --all-files || true | |
| # Generate NOTICE file on all PRs to ensure it stays up-to-date | |
| - name: Generate NOTICE file | |
| run: ./scripts/generate-notice.sh | |
| # Format HCL files in test fixtures and examples | |
| - name: Format HCL | |
| run: | | |
| atmos toolchain exec -- tofu fmt -recursive tests/fixtures/components/terraform | |
| atmos toolchain exec -- tofu fmt -recursive examples/ | |
| # Regenerate README.md from README.yaml | |
| - name: Regenerate README | |
| run: atmos docs generate readme | |
| - name: Commit fixes via Atmos Pro | |
| env: | |
| ATMOS_LOGS_LEVEL: debug | |
| ATMOS_PRO_WORKSPACE_ID: ${{ vars.ATMOS_PRO_WORKSPACE_ID }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: atmos pro commit -m "[autocommit] formatting fixes" --all |