|
| 1 | +name: Test sticky-comment |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + |
| 6 | +concurrency: |
| 7 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 8 | + cancel-in-progress: true |
| 9 | + |
| 10 | +permissions: {} |
| 11 | + |
| 12 | +jobs: |
| 13 | + pre-job: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + permissions: |
| 16 | + contents: read |
| 17 | + outputs: |
| 18 | + should_run: ${{ steps.check.outputs.should_run }} |
| 19 | + steps: |
| 20 | + - name: Check what should run |
| 21 | + id: check |
| 22 | + uses: immich-app/devtools/actions/pre-job@91f342bb4477c4bc10c576ae739da875d85aa164 # pre-job-action-v2.0.4 |
| 23 | + with: |
| 24 | + github-token: ${{ github.token }} |
| 25 | + filters: | |
| 26 | + sticky_comment: |
| 27 | + - 'actions/sticky-comment/**' |
| 28 | + force-filters: | |
| 29 | + - '.github/workflows/test-sticky-comment.yml' |
| 30 | +
|
| 31 | + build-check: |
| 32 | + name: Verify dist is up to date |
| 33 | + needs: pre-job |
| 34 | + if: ${{ fromJSON(needs.pre-job.outputs.should_run).sticky_comment == true }} |
| 35 | + runs-on: ubuntu-latest |
| 36 | + permissions: |
| 37 | + contents: read |
| 38 | + defaults: |
| 39 | + run: |
| 40 | + working-directory: ./actions/sticky-comment |
| 41 | + steps: |
| 42 | + - name: Checkout code |
| 43 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 44 | + with: |
| 45 | + persist-credentials: false |
| 46 | + |
| 47 | + - name: Setup Node |
| 48 | + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 |
| 49 | + with: |
| 50 | + node-version-file: './actions/sticky-comment/.nvmrc' |
| 51 | + |
| 52 | + - run: npm ci |
| 53 | + - run: npm run check |
| 54 | + - run: npm run build |
| 55 | + |
| 56 | + - name: Verify dist/ matches source |
| 57 | + working-directory: . |
| 58 | + run: | |
| 59 | + if ! git diff --exit-code actions/sticky-comment/dist; then |
| 60 | + echo "::error::dist/ is out of date. Run 'npm run build' in actions/sticky-comment and commit the result." |
| 61 | + exit 1 |
| 62 | + fi |
| 63 | +
|
| 64 | + smoke: |
| 65 | + name: Smoke test |
| 66 | + needs: pre-job |
| 67 | + if: ${{ fromJSON(needs.pre-job.outputs.should_run).sticky_comment == true && !github.event.pull_request.head.repo.fork }} |
| 68 | + runs-on: ubuntu-latest |
| 69 | + permissions: |
| 70 | + contents: read |
| 71 | + pull-requests: write |
| 72 | + steps: |
| 73 | + - name: Checkout code |
| 74 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 75 | + with: |
| 76 | + persist-credentials: false |
| 77 | + |
| 78 | + - name: Pre-clean (exercise delete path) |
| 79 | + uses: ./actions/sticky-comment |
| 80 | + with: |
| 81 | + id: smoke-test |
| 82 | + delete: true |
| 83 | + |
| 84 | + - name: Create comment (exercise create path) |
| 85 | + uses: ./actions/sticky-comment |
| 86 | + with: |
| 87 | + id: smoke-test |
| 88 | + body: | |
| 89 | + Smoke test for sticky-comment action — created by run ${{ github.run_id }}. |
| 90 | +
|
| 91 | + - name: Update comment (exercise update path) |
| 92 | + uses: ./actions/sticky-comment |
| 93 | + with: |
| 94 | + id: smoke-test |
| 95 | + body: | |
| 96 | + ✅ Smoke test for sticky-comment action passed — run ${{ github.run_id }}. |
0 commit comments