From 730524f10b741e800afc7282c003f888bf9476e6 Mon Sep 17 00:00:00 2001 From: Mircea-Pavel Anton Date: Sun, 20 Oct 2024 15:09:10 +0300 Subject: [PATCH] ci: Update Reusable Workflows (#17) * update renovate * update label-sync * update pr labeler * add lint workflow * specify version * cleanup * add commitlint config --- .commitlintrc.json | 46 +++++++++++++++++++++++++ .github/{configs => }/labeler.yaml | 0 .github/{configs => }/labels.yaml | 0 .github/renovate.json5 | 16 --------- .github/workflows/docker-release.yaml | 2 +- .github/workflows/label-sync.yaml | 38 ++++++++++++++++++++ .github/workflows/labeler.yaml | 13 +++++++ .github/workflows/lint.yaml | 19 ++++++++++ .github/workflows/meta-label-sync.yaml | 34 ------------------ .github/workflows/meta-labeler.yaml | 13 ------- .github/workflows/readme-generator.yaml | 3 +- .github/workflows/renovate.yaml | 15 +++++--- renovate.json5 | 12 +++++++ 13 files changed, 141 insertions(+), 70 deletions(-) create mode 100644 .commitlintrc.json rename .github/{configs => }/labeler.yaml (100%) rename .github/{configs => }/labels.yaml (100%) delete mode 100644 .github/renovate.json5 create mode 100644 .github/workflows/label-sync.yaml create mode 100644 .github/workflows/labeler.yaml create mode 100644 .github/workflows/lint.yaml delete mode 100644 .github/workflows/meta-label-sync.yaml delete mode 100644 .github/workflows/meta-labeler.yaml create mode 100644 renovate.json5 diff --git a/.commitlintrc.json b/.commitlintrc.json new file mode 100644 index 0000000..cb2adda --- /dev/null +++ b/.commitlintrc.json @@ -0,0 +1,46 @@ +{ + "rules": { + "type-enum": [ + 2, + "always", + [ + "chore", + "ci", + "deps", + "feat", + "fix", + "patch", + "style" + ] + ], + "subject-empty": [ + 2, + "never" + ], + "type-case": [ + 2, + "always", + "lower-case" + ], + "subject-case": [ + 0 + ], + "type-empty": [ + 2, + "never" + ], + "scope-case": [ + 2, + "always", + "lower-case" + ], + "scope-enum": [ + 0 + ], + "header-max-length": [ + 2, + "always", + 120 + ] + } +} \ No newline at end of file diff --git a/.github/configs/labeler.yaml b/.github/labeler.yaml similarity index 100% rename from .github/configs/labeler.yaml rename to .github/labeler.yaml diff --git a/.github/configs/labels.yaml b/.github/labels.yaml similarity index 100% rename from .github/configs/labels.yaml rename to .github/labels.yaml diff --git a/.github/renovate.json5 b/.github/renovate.json5 deleted file mode 100644 index 021dd5c..0000000 --- a/.github/renovate.json5 +++ /dev/null @@ -1,16 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "dependencyDashboardTitle": "Renovate Dashboard 🤖", - "extends": [ - ":dependencyDashboard", - ":timezone(Europe/Bucharest)", - "config:best-practices", - "docker:enableMajor", - ":disableRateLimiting", - ":semanticCommits", - "github>mirceanton/centralized-workflows//.github/configs/renovate/devcontainerNoDigest.json5", - "github>mirceanton/centralized-workflows//.github/configs/renovate/autoMerge.json5", - "github>mirceanton/centralized-workflows//.github/configs/renovate/semanticCommits.json5", - "github>mirceanton/centralized-workflows//.github/configs/renovate/labels.json5" - ] -} \ No newline at end of file diff --git a/.github/workflows/docker-release.yaml b/.github/workflows/docker-release.yaml index 600a271..97349c3 100644 --- a/.github/workflows/docker-release.yaml +++ b/.github/workflows/docker-release.yaml @@ -27,7 +27,7 @@ on: jobs: release: - uses: mirceanton/reusable-workflows/.github/workflows/docker-release.yaml@17d8ef4df857d93b905170956fbbcd56b296e8bb + uses: mirceanton/reusable-workflows/.github/workflows/docker-release.yaml@v3.4.19 secrets: inherit with: image: ghcr.io/${{ github.repository }} diff --git a/.github/workflows/label-sync.yaml b/.github/workflows/label-sync.yaml new file mode 100644 index 0000000..ceaf1e1 --- /dev/null +++ b/.github/workflows/label-sync.yaml @@ -0,0 +1,38 @@ +--- +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +name: Label Sync + +on: + # Manual Trigger + workflow_dispatch: + inputs: + dry-run: + description: Dry Run + default: true + required: false + type: boolean + + # Dry Run on any PR that changes the labels config or the workflow + pull_request: + paths: + - .github/workflows/label-sync.yaml + - .github/labels.yaml + + # "Wet" Run on any push to the main branch that changes the labels config or the workflow + push: + branches: ["main", "master"] + paths: + - .github/workflows/label-sync.yaml + - .github/labels.yaml + + # "Wet" Run hourly + schedule: + - cron: "0 * * * *" + +jobs: + label-sync: + uses: mirceanton/reusable-workflows/.github/workflows/reusable-label-sync.yaml@f4dce998a168bbe2e53664acf4dd29407cd3d29f # v3.4.19 + secrets: inherit + with: + dry-run: ${{ inputs.dry-run || github.event_name == 'pull_request' }} + config-file: .github/labels.yaml diff --git a/.github/workflows/labeler.yaml b/.github/workflows/labeler.yaml new file mode 100644 index 0000000..2e6416d --- /dev/null +++ b/.github/workflows/labeler.yaml @@ -0,0 +1,13 @@ +--- +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +name: Labeler + +on: + pull_request_target: {} + +jobs: + pr-labeler: + uses: mirceanton/reusable-workflows/.github/workflows/reusable-labeler.yaml@f4dce998a168bbe2e53664acf4dd29407cd3d29f # v3.4.19 + secrets: inherit + with: + config-file: .github/labeler.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..6e3275b --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,19 @@ +--- +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +name: Lint + +on: + # Manual Trigger + workflow_dispatch: {} + + # Run on any PR + pull_request: {} + +jobs: + actionlint: + uses: mirceanton/reusable-workflows/.github/workflows/reusable-actionlint.yaml@f4dce998a168bbe2e53664acf4dd29407cd3d29f # v3.4.19 + secrets: inherit + + commitlint: + uses: mirceanton/reusable-workflows/.github/workflows/reusable-commitlint.yaml@f4dce998a168bbe2e53664acf4dd29407cd3d29f # v3.4.19 + secrets: inherit diff --git a/.github/workflows/meta-label-sync.yaml b/.github/workflows/meta-label-sync.yaml deleted file mode 100644 index 2925b81..0000000 --- a/.github/workflows/meta-label-sync.yaml +++ /dev/null @@ -1,34 +0,0 @@ ---- -# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json -name: Meta - Label Sync - -on: - workflow_dispatch: - inputs: - dry-run: - description: Dry Run - default: true - required: false - type: boolean - - pull_request: - paths: - - ".github/configs/labels.yaml" - - ".github/workflows/meta-label-sync.yaml" - - push: - branches: ["main"] - paths: - - ".github/configs/labels.yaml" - - ".github/workflows/meta-label-sync.yaml" - - schedule: - - cron: "0 0 * * *" # Every day at midnight - -jobs: - label-sync: - uses: mirceanton/reusable-workflows/.github/workflows/meta-label-sync.yaml@17d8ef4df857d93b905170956fbbcd56b296e8bb - secrets: inherit - with: - dry-run: ${{ inputs.dry-run || github.event_name == 'pull_request' }} - config-file: ".github/configs/labels.yaml" diff --git a/.github/workflows/meta-labeler.yaml b/.github/workflows/meta-labeler.yaml deleted file mode 100644 index 0957c74..0000000 --- a/.github/workflows/meta-labeler.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json -name: Meta - Labeler - -on: - pull_request_target: {} - -jobs: - pr-labeler: - uses: mirceanton/reusable-workflows/.github/workflows/meta-labeler.yaml@17d8ef4df857d93b905170956fbbcd56b296e8bb - secrets: inherit - with: - config-file: ".github/configs/labeler.yaml" diff --git a/.github/workflows/readme-generator.yaml b/.github/workflows/readme-generator.yaml index d46a866..f7065f2 100644 --- a/.github/workflows/readme-generator.yaml +++ b/.github/workflows/readme-generator.yaml @@ -42,7 +42,8 @@ jobs: run: pip install Jinja2 - name: Generate README - run: cd .github/scripts && python3 readme-generator.py + working-directory: .github/scripts + run: python3 readme-generator.py - name: Show changes run: cat README.md diff --git a/.github/workflows/renovate.yaml b/.github/workflows/renovate.yaml index e6dc350..54db688 100644 --- a/.github/workflows/renovate.yaml +++ b/.github/workflows/renovate.yaml @@ -3,6 +3,7 @@ name: Renovate on: + # Manual Trigger workflow_dispatch: inputs: dry-run: @@ -15,13 +16,16 @@ on: default: debug required: false type: string + + # Dry Run on any PR that changes the renovate config or the renovate workflow pull_request: paths: - - ".github/workflows/renovate.yaml" - - ".github/configs/renovate/*.json5" - - "renovate.json5" + - .github/workflows/renovate.yaml + - renovate.json5 + + # "Wet" Run hourly schedule: - - cron: "0 * * * *" # hourly + - cron: "0 * * * *" concurrency: group: ${{ github.workflow }}-${{ github.event.number || github.ref }} @@ -29,8 +33,9 @@ concurrency: jobs: renovate: - uses: mirceanton/reusable-workflows/.github/workflows/renovate.yaml@17d8ef4df857d93b905170956fbbcd56b296e8bb + uses: mirceanton/reusable-workflows/.github/workflows/reusable-renovate.yaml@f4dce998a168bbe2e53664acf4dd29407cd3d29f # v3.4.19 secrets: inherit with: dry-run: "${{ inputs.dry-run == true || github.event_name == 'pull_request' }}" log-level: "${{ inputs.log-level || 'debug' }}" + config-file: "renovate.json5" diff --git a/renovate.json5 b/renovate.json5 new file mode 100644 index 0000000..6f783a3 --- /dev/null +++ b/renovate.json5 @@ -0,0 +1,12 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "dependencyDashboardTitle": "Renovate Dashboard 🤖", + "extends": [ + ":dependencyDashboard", + "config:best-practices", + ":disableRateLimiting", + ":semanticCommits", + "github>mirceanton/renovate-config//labels/all.json5", + "github>mirceanton/renovate-config//semantic-commits/all.json5" + ] +} \ No newline at end of file