|
| 1 | +name: "CI - Test Templates" |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + |
| 5 | +jobs: |
| 6 | + smoke-test: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + permissions: |
| 9 | + # Give the default GITHUB_TOKEN write permission to commit and push the |
| 10 | + # added or changed files to the repository. |
| 11 | + contents: write |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v6 |
| 14 | + |
| 15 | + - name: Smoke test for "gz" |
| 16 | + id: smoke_test |
| 17 | + uses: ./.github/actions/smoke-test |
| 18 | + with: |
| 19 | + template: "gz" |
| 20 | + |
| 21 | + gen-docs: |
| 22 | + if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} |
| 23 | + runs-on: ubuntu-latest |
| 24 | + permissions: |
| 25 | + # Give the default GITHUB_TOKEN write permission to commit and push the |
| 26 | + # added or changed files to the repository. |
| 27 | + contents: write |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v6 |
| 30 | + with: |
| 31 | + ref: ${{ github.head_ref }} |
| 32 | + token: ${{ secrets.CI_BOT_TOKEN }} |
| 33 | + |
| 34 | + - name: "Publish Templates" |
| 35 | + uses: devcontainers/action@v1 |
| 36 | + with: |
| 37 | + publish-templates: "false" |
| 38 | + base-path-to-templates: "./templates/src" |
| 39 | + generate-docs: "true" |
| 40 | + |
| 41 | + - uses: stefanzweifel/git-auto-commit-action@v7 |
| 42 | + with: |
| 43 | + commit_message: Update generated docs |
| 44 | + |
| 45 | + complete: |
| 46 | + needs: |
| 47 | + - gen-docs |
| 48 | + - smoke-test |
| 49 | + if: always() |
| 50 | + runs-on: ubuntu-latest |
| 51 | + steps: |
| 52 | + - name: Verify required jobs succeeded |
| 53 | + env: |
| 54 | + SMOKE_TEST_RESULT: ${{ needs.smoke-test.result }} |
| 55 | + GEN_DOCS_RESULT: ${{ needs.gen-docs.result }} |
| 56 | + run: | |
| 57 | + set -euo pipefail |
| 58 | +
|
| 59 | + echo "smoke_test: ${SMOKE_TEST_RESULT}" |
| 60 | + echo "gen_docs: ${GEN_DOCS_RESULT}" |
| 61 | +
|
| 62 | + if [[ "${SMOKE_TEST_RESULT}" != "success" ]]; then |
| 63 | + echo "Required job 'smoke_test' did not succeed." |
| 64 | + exit 1 |
| 65 | + fi |
| 66 | +
|
| 67 | + # gen_docs is skipped for fork PRs by design; treat that as acceptable. |
| 68 | + if [[ "${GEN_DOCS_RESULT}" != "success" && "${GEN_DOCS_RESULT}" != "skipped" ]]; then |
| 69 | + echo "Required job 'gen_docs' failed or was cancelled." |
| 70 | + exit 1 |
| 71 | + fi |
| 72 | +
|
| 73 | + echo "All required jobs completed successfully." |
0 commit comments