|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + pull-requests: read |
| 13 | + security-events: write |
| 14 | + |
| 15 | +jobs: |
| 16 | + setup: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + outputs: |
| 19 | + ref: ${{ steps.setup.outputs.ref }} |
| 20 | + repo: ${{ steps.setup.outputs.repo }} |
| 21 | + base_sha: ${{ steps.setup.outputs.base_sha }} |
| 22 | + checkout_path: ${{ steps.setup.outputs.checkout_path }} |
| 23 | + has_changes_yaml: ${{ steps.setup.outputs.has_changes }} |
| 24 | + has_changes_md: ${{ steps.detect_md.outputs.has_changes }} |
| 25 | + steps: |
| 26 | + - name: Workflow setup (YAML relevance) |
| 27 | + id: setup |
| 28 | + uses: Framework-R-D/action-workflow-setup@f73307dd8c13cb66c2565c9ace32571517b1cea8 |
| 29 | + with: |
| 30 | + file-type: yaml |
| 31 | + |
| 32 | + - name: Detect Markdown changes |
| 33 | + id: detect_md |
| 34 | + # Only meaningful for pull_request events, where base_sha is populated and |
| 35 | + # a diff base exists. For push / workflow_dispatch the markdown-check job |
| 36 | + # runs unconditionally (its github.event_name != 'pull_request' arm), so |
| 37 | + # this detection step is skipped and its empty output is harmless. |
| 38 | + if: github.event_name == 'pull_request' && steps.setup.outputs.is_act != 'true' |
| 39 | + uses: Framework-R-D/action-run-change-detection@c70418d77a03191b165dd7dfebadbe00c77a03191b |
| 40 | + with: |
| 41 | + checkout-path: ${{ steps.setup.outputs.checkout_path }} |
| 42 | + ref: ${{ steps.setup.outputs.ref }} |
| 43 | + repo: ${{ steps.setup.outputs.repo }} |
| 44 | + base-ref: ${{ steps.setup.outputs.base_sha }} |
| 45 | + file-type: md |
| 46 | + |
| 47 | + actionlint: |
| 48 | + needs: setup |
| 49 | + if: > |
| 50 | + always() && needs.setup.result == 'success' && ( |
| 51 | + github.event_name != 'pull_request' || |
| 52 | + needs.setup.outputs.has_changes_yaml == 'true' |
| 53 | + ) |
| 54 | + runs-on: ubuntu-latest |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 |
| 57 | + with: |
| 58 | + ref: ${{ needs.setup.outputs.ref }} |
| 59 | + path: ${{ needs.setup.outputs.checkout_path }} |
| 60 | + repository: ${{ needs.setup.outputs.repo }} |
| 61 | + persist-credentials: false |
| 62 | + - uses: raven-actions/actionlint@205b530c5d9fa8f44ae9ed59f341a0db994aa6f8 |
| 63 | + with: |
| 64 | + working-directory: ${{ needs.setup.outputs.checkout_path }} |
| 65 | + |
| 66 | + yaml-check: |
| 67 | + needs: setup |
| 68 | + if: > |
| 69 | + always() && needs.setup.result == 'success' && ( |
| 70 | + github.event_name != 'pull_request' || |
| 71 | + needs.setup.outputs.has_changes_yaml == 'true' |
| 72 | + ) |
| 73 | + runs-on: ubuntu-latest |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 |
| 76 | + with: |
| 77 | + ref: ${{ needs.setup.outputs.ref }} |
| 78 | + path: ${{ needs.setup.outputs.checkout_path }} |
| 79 | + repository: ${{ needs.setup.outputs.repo }} |
| 80 | + persist-credentials: false |
| 81 | + - name: Install uv |
| 82 | + uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e |
| 83 | + - name: Install yamllint |
| 84 | + run: uv tool install yamllint |
| 85 | + - name: Run yamllint |
| 86 | + working-directory: ${{ needs.setup.outputs.checkout_path }} |
| 87 | + run: yamllint . |
| 88 | + |
| 89 | + markdown-check: |
| 90 | + needs: setup |
| 91 | + if: > |
| 92 | + always() && needs.setup.result == 'success' && ( |
| 93 | + github.event_name != 'pull_request' || |
| 94 | + needs.setup.outputs.has_changes_md == 'true' |
| 95 | + ) |
| 96 | + runs-on: ubuntu-latest |
| 97 | + steps: |
| 98 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 |
| 99 | + with: |
| 100 | + ref: ${{ needs.setup.outputs.ref }} |
| 101 | + path: ${{ needs.setup.outputs.checkout_path }} |
| 102 | + repository: ${{ needs.setup.outputs.repo }} |
| 103 | + persist-credentials: false |
| 104 | + - uses: DavidAnson/markdownlint-cli2-action@992badcdf24e3b8eb7e87ff9287fe931bcb00c6e |
| 105 | + with: |
| 106 | + globs: | |
| 107 | + ${{ needs.setup.outputs.checkout_path }}/**/*.md |
| 108 | + !${{ needs.setup.outputs.checkout_path }}/**/CHANGELOG.md |
| 109 | +
|
| 110 | + codeql: |
| 111 | + needs: setup |
| 112 | + if: > |
| 113 | + always() && needs.setup.result == 'success' && ( |
| 114 | + github.event_name != 'pull_request' || |
| 115 | + needs.setup.outputs.has_changes_yaml == 'true' |
| 116 | + ) |
| 117 | + runs-on: ubuntu-latest |
| 118 | + steps: |
| 119 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 |
| 120 | + with: |
| 121 | + ref: ${{ needs.setup.outputs.ref }} |
| 122 | + path: ${{ needs.setup.outputs.checkout_path }} |
| 123 | + repository: ${{ needs.setup.outputs.repo }} |
| 124 | + persist-credentials: false |
| 125 | + - uses: github/codeql-action/init@dd903d2e4f5405488e5ef1422510ee31c8b32357 |
| 126 | + with: |
| 127 | + languages: actions |
| 128 | + build-mode: none |
| 129 | + queries: security-extended |
| 130 | + source-root: ${{ needs.setup.outputs.checkout_path }} |
| 131 | + - uses: github/codeql-action/analyze@dd903d2e4f5405488e5ef1422510ee31c8b32357 |
| 132 | + with: |
| 133 | + checkout_path: ${{ needs.setup.outputs.checkout_path }} |
0 commit comments