Merge pull request #65 from ponko2/renovate/lint-staged-16.1.x #22
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: CI | |
on: | |
merge_group: {} | |
pull_request: {} | |
push: | |
branches: [main] | |
workflow_dispatch: {} | |
permissions: {} | |
jobs: | |
required: | |
name: "Required Checks: CI" | |
if: ${{ always() }} | |
needs: | |
- verify-author | |
- changed-files | |
- actionlint | |
- ghalint | |
- zizmor | |
- biome | |
- editorconfig | |
- luacheck | |
- stylua | |
- yamllint | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Fail if any required jobs failed or cancelled | |
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} | |
run: exit 1 | |
verify-author: | |
name: Verify author | |
environment: ${{ github.event_name == 'pull_request' && | |
endsWith(github.event.pull_request.user.login, '[bot]') && | |
contains(github.event.pull_request.labels.*.name, 'dependencies') && | |
contains(github.event.pull_request.labels.*.name, 'github_actions') && 'ci' || null }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Author has been verified | |
run: exit 0 | |
changed-files: | |
name: Get changed files | |
if: ${{ github.event_name == 'pull_request' }} | |
needs: verify-author | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
permissions: | |
contents: read | |
outputs: | |
# reference: https://github.com/tj-actions/changed-files#outputs- | |
actions: ${{ steps.changed-files.outputs.actions_any_modified == 'true' }} | |
biome: ${{ steps.changed-files.outputs.biome_any_modified == 'true' }} | |
luacheck: ${{ steps.changed-files.outputs.luacheck_any_modified == 'true' }} | |
stylua: ${{ steps.changed-files.outputs.stylua_any_modified == 'true' }} | |
yamllint: ${{ steps.changed-files.outputs.yamllint_any_modified == 'true' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
fetch-depth: 50 # Assume PRs are less than 50 commits | |
persist-credentials: true | |
- name: Get relevant files changed per group | |
id: changed-files | |
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5 | |
with: | |
files_yaml: | | |
common: &common | |
- .github/workflows/ci.yml | |
actions: | |
- "**/action.{yaml,yml}" | |
- ".github/workflows/*.{yaml,yml}" | |
biome: | |
- *common | |
- "**/*.{js,jsx,ts,tsx,cjs,cts,mjs,mts,json,jsonc,css,svelte,vue,astro,graphql,gql}" | |
luacheck: | |
- *common | |
- "**/*.lua" | |
- .luacheckrc | |
- .luarc.json | |
stylua: | |
- *common | |
- "**/*.lua" | |
- .luarc.json | |
- .stylua.toml | |
yamllint: | |
- *common | |
- "**/*.{yaml,yml}" | |
actionlint: | |
name: actionlint | |
if: ${{ always() && !failure() && !cancelled() && | |
(needs.changed-files.result == 'skipped' || needs.changed-files.outputs.actions == 'true') }} | |
needs: changed-files | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
persist-credentials: false | |
- name: Run actionlint | |
uses: ponko2/actions/actionlint@be93b68d5e3f066ace73e6664864315dc925b0f3 # v1.0.0 | |
ghalint: | |
name: ghalint | |
if: ${{ always() && !failure() && !cancelled() && | |
(needs.changed-files.result == 'skipped' || needs.changed-files.outputs.actions == 'true') }} | |
needs: changed-files | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
persist-credentials: false | |
- name: Run ghalint | |
uses: ponko2/actions/ghalint@be93b68d5e3f066ace73e6664864315dc925b0f3 # v1.0.0 | |
zizmor: | |
name: zizmor | |
if: ${{ always() && !failure() && !cancelled() && | |
(needs.changed-files.result == 'skipped' || needs.changed-files.outputs.actions == 'true') }} | |
needs: changed-files | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
persist-credentials: false | |
- name: Run zizmor | |
uses: ponko2/actions/zizmor@be93b68d5e3f066ace73e6664864315dc925b0f3 # v1.0.0 | |
biome: | |
name: Biome | |
if: ${{ always() && !failure() && !cancelled() && | |
(needs.changed-files.result == 'skipped' || needs.changed-files.outputs.biome == 'true') }} | |
needs: changed-files | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
persist-credentials: false | |
- name: Setup Biome | |
uses: biomejs/setup-biome@454fa0d884737805f48d7dc236c1761a0ac3cc13 # v2.6.0 | |
- name: Run Biome | |
run: biome ci --error-on-warnings | |
editorconfig: | |
name: EditorConfig | |
needs: verify-author | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
persist-credentials: false | |
- uses: editorconfig-checker/action-editorconfig-checker@d2ed4fd072ae6f887e9407c909af0f585d2ad9f4 # v2 | |
- run: editorconfig-checker | |
luacheck: | |
name: Luacheck | |
if: ${{ always() && !failure() && !cancelled() && | |
(needs.changed-files.result == 'skipped' || needs.changed-files.outputs.luacheck == 'true') }} | |
needs: changed-files | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
persist-credentials: false | |
- name: Run Luacheck | |
uses: lunarmodules/luacheck@cc089e3f65acdd1ef8716cc73a3eca24a6b845e4 # v1.2.0 | |
stylua: | |
name: StyLua | |
if: ${{ always() && !failure() && !cancelled() && | |
(needs.changed-files.result == 'skipped' || needs.changed-files.outputs.stylua == 'true') }} | |
needs: changed-files | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
persist-credentials: false | |
- name: Run StyLua | |
uses: JohnnyMorganz/stylua-action@479972f01e665acfcba96ada452c36608bdbbb5e # v4.1.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
version: latest | |
args: --allow-hidden --check . | |
yamllint: | |
name: yamllint | |
if: ${{ always() && !failure() && !cancelled() && | |
(needs.changed-files.result == 'skipped' || needs.changed-files.outputs.yamllint == 'true') }} | |
needs: changed-files | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
persist-credentials: false | |
- name: Run yamllint | |
run: yamllint --format=github --strict . |