Skip to content

Commit 9999c44

Browse files
committed
feat: add new optional inputs to reusable workflows
Mostly to make testing the workflows possible. Refs: RATY-350
1 parent da3a1f5 commit 9999c44

10 files changed

Lines changed: 91 additions & 4 deletions

.github/workflows/ci-django-api-README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ To use this reusable workflow, create a project-specific workflow file in your `
3131
- **`use-postgis`** (boolean): Set to `true` to enable the PostGIS extension. Default is `false`.
3232
- **`extra-commands`** (string): Additional setup commands or checks to execute before running tests. Can be used to set environment variables: `echo "EXTRA_TEST_ENV_VAR=test" >> $GITHUB_ENV`.
3333
- **`working-directory`** (string): Repository subdirectory where to run tests. Default is repository root.
34+
- **`skip-sonar`** (boolean): Set to `true` to skip the SonarQube Cloud scan. Default is `false`.
35+
- **`commitlint-config-file`** (string): Path to the commitlint config file. If empty, commitlint uses its default config discovery (file in repository root).
36+
- **`pre-commit-config-file`** (string): Path to `.pre-commit-config.yaml`. If empty, pre-commit uses its default discovery (file in repository root).
3437

3538
### 🔑 Secrets
3639

.github/workflows/ci-django-api.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,25 @@ on:
2626
required: false
2727
type: string
2828
default: '.'
29+
skip-sonar:
30+
description: 'Set to true to skip SonarQube checks'
31+
required: false
32+
type: boolean
33+
default: false
34+
commitlint-config-file:
35+
description: 'Path to commitlint config file'
36+
required: false
37+
type: string
38+
default: ''
39+
pre-commit-config-file:
40+
description: 'Path to .pre-commit-config.yaml. If empty, pre-commit uses default discovery.'
41+
required: false
42+
type: string
43+
default: ''
2944
secrets:
3045
SONAR_TOKEN:
3146
description: 'SonarQube Cloud token'
32-
required: true
47+
required: false
3348
workflow_dispatch:
3449

3550
env:
@@ -47,6 +62,8 @@ jobs:
4762
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
4863
- name: Run commitlint
4964
uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6.2.1
65+
with:
66+
configFile: ${{ inputs.commitlint-config-file }}
5067

5168
pre-commit:
5269
name: Run pre-commit hooks
@@ -61,7 +78,9 @@ jobs:
6178
- name: Run pre-commit
6279
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
6380
with:
64-
extra_args: ${{ inputs.working-directory != '.' && format('--files {0}/**', inputs.working-directory) || '' }}
81+
extra_args: >-
82+
${{ inputs['pre-commit-config-file'] != '' && format('--config {0}', inputs['pre-commit-config-file']) || '' }}
83+
${{ inputs.working-directory != '.' && format('--files {0}/**', inputs.working-directory) || '' }}
6584
6685
tests:
6786
name: Run tests
@@ -157,6 +176,7 @@ jobs:
157176

158177
sonarcloud:
159178
name: Run SonarQube Cloud Scan
179+
if: ${{ !inputs.skip-sonar }}
160180
runs-on: ubuntu-latest
161181
needs: tests
162182
defaults:

.github/workflows/ci-node-README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ To use this reusable workflow, create a project-specific workflow file in your `
4040
- **`typecheck`** (boolean): Run typecheck command. Default is `false`.
4141
- **`working-directory`** (string): Repository working directory where to run yarn installation and the tests. Default is `.` (the repository root).
4242
- **`app-directory`** (string): The subdirectory of the application where the tests are run. Default is **`working-directory`**.
43+
- **`commitlint-config-file`** (string): Path to the commitlint config file. If empty, commitlint uses its default config discovery (file in repository root).
4344

4445
### 🔑 Secrets
4546

.github/workflows/ci-node.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ on:
3636
required: false
3737
type: boolean
3838
default: false
39+
commitlint-config-file:
40+
description: 'Path to commitlint config file'
41+
required: false
42+
type: string
43+
default: ''
3944
working-directory:
4045
description: 'Working directory for the yarn installation, build and tests jobs.'
4146
required: false
@@ -61,6 +66,8 @@ jobs:
6166
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
6267
- name: Run commitlint
6368
uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6.2.1
69+
with:
70+
configFile: ${{ inputs.commitlint-config-file }}
6471

6572
build:
6673
name: Lint and build

.github/workflows/ci-pnpm-node-README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ To use this reusable workflow, create a project-specific workflow file in your `
5252
- **`skip-sonar`** (boolean): Set to true to skip SonarQube checks. Default is `false`.
5353
- **`skip-build`** (boolean): Set to true to skip the build phase. Default is `false`.
5454
- **`ignore-scripts`** (boolean): Set to true to skip lifecycle scripts during install (`--ignore-scripts`). Default is `true`.
55+
- **`pnpm-version`** (string): pnpm version to use (passed to `pnpm/action-setup`). If empty, the version is read from the `packageManager` field in `package.json`.
56+
- **`commitlint-config-file`** (string): Path to the commitlint config file. If empty, commitlint uses its default config discovery (file in repository root).
5557

5658
### 🔑 Secrets
5759

.github/workflows/ci-pnpm-node.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ on:
4646
required: false
4747
type: boolean
4848
default: true
49+
pnpm-version:
50+
description: >
51+
pnpm version to use (passed to pnpm/action-setup).
52+
If empty, pnpm/action-setup reads the version from the
53+
packageManager field in package.json.
54+
required: false
55+
type: string
56+
default: ""
57+
commitlint-config-file:
58+
description: 'Path to commitlint config file'
59+
required: false
60+
type: string
61+
default: ''
4962
secrets:
5063
SONAR_TOKEN:
5164
description: 'SonarQube Cloud token'
@@ -61,6 +74,8 @@ jobs:
6174
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
6275
- name: Run commitlint
6376
uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6.2.1
77+
with:
78+
configFile: ${{ inputs.commitlint-config-file }}
6479

6580
build:
6681
name: Lint and build

.github/workflows/ci-python-library-README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ To use this reusable workflow, create a project-specific workflow file in your `
2828

2929
- **`python-version`** (string): Python version to use for pre-commit checks. Defaults to `"3.x"`.
3030
- **`enable-sonar`** (boolean): Whether to run the SonarQube Cloud Scan job after tests. Defaults to `true`.
31+
- **`commitlint-config-file`** (string): Path to the commitlint config file. If empty, commitlint uses its default config discovery (file in repository root).
32+
- **`pre-commit-config-file`** (string): Path to `.pre-commit-config.yaml`. If empty, pre-commit uses its default discovery (file in repository root).
3133

3234
### Secrets
3335

.github/workflows/ci-python-library.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ on:
1717
required: false
1818
type: boolean
1919
default: true
20+
commitlint-config-file:
21+
description: 'Path to commitlint config file. If empty, commitlint uses its default config discovery.'
22+
required: false
23+
type: string
24+
default: ''
25+
pre-commit-config-file:
26+
description: 'Path to .pre-commit-config.yaml. If empty, pre-commit uses default discovery.'
27+
required: false
28+
type: string
29+
default: ''
2030
secrets:
2131
sonar-token:
2232
description: "Token for SonarQube Cloud Scan. Required if enable-sonar is set to true."
@@ -36,6 +46,8 @@ jobs:
3646

3747
- name: Run commitlint
3848
uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6.2.1
49+
with:
50+
configFile: ${{ inputs.commitlint-config-file }}
3951

4052
pre-commit:
4153
name: Run pre-commit hooks
@@ -51,6 +63,8 @@ jobs:
5163

5264
- name: Run pre-commit
5365
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
66+
with:
67+
extra_args: ${{ inputs['pre-commit-config-file'] != '' && format('--config {0}', inputs['pre-commit-config-file']) || '' }}
5468

5569
tests:
5670
name: Python ${{ matrix.python_version }}

.github/workflows/ci-uv-django-api-README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ To use this reusable workflow, create a project-specific workflow file in your `
3838
- **`use-postgis`** (boolean): Set to `true` to enable the PostGIS extension. Default is `false`.
3939
- **`extra-commands`** (string): Additional setup commands or checks to execute before running tests. Can be used to set environment variables or install extra packages: `echo "EXTRA_TEST_ENV_VAR=test" >> $GITHUB_ENV`.
4040
- **`working-directory`** (string): Repository subdirectory where to run tests. Default is repository root.
41+
- **`skip-sonar`** (boolean): Set to `true` to skip the SonarQube Cloud scan. Default is `false`.
42+
- **`commitlint-config-file`** (string): Path to the commitlint config file. If empty, commitlint uses its default config discovery (file in repository root).
43+
- **`pre-commit-config-file`** (string): Path to `.pre-commit-config.yaml`. If empty, pre-commit uses its default discovery (file in repository root).
4144

4245
### 🔑 Secrets
4346

.github/workflows/ci-uv-django-api.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,25 @@ on:
2626
required: false
2727
type: string
2828
default: '.'
29+
skip-sonar:
30+
description: 'Set to true to skip SonarQube checks'
31+
required: false
32+
type: boolean
33+
default: false
34+
commitlint-config-file:
35+
description: 'Path to commitlint config file'
36+
required: false
37+
type: string
38+
default: ''
39+
pre-commit-config-file:
40+
description: 'Path to .pre-commit-config.yaml. If empty, pre-commit uses default discovery.'
41+
required: false
42+
type: string
43+
default: ''
2944
secrets:
3045
SONAR_TOKEN:
3146
description: 'SonarQube Cloud token'
32-
required: true
47+
required: false
3348
workflow_dispatch:
3449

3550
env:
@@ -47,6 +62,8 @@ jobs:
4762
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
4863
- name: Run commitlint
4964
uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6.2.1
65+
with:
66+
configFile: ${{ inputs.commitlint-config-file }}
5067

5168
pre-commit:
5269
name: Run pre-commit hooks
@@ -61,7 +78,9 @@ jobs:
6178
- name: Run pre-commit
6279
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
6380
with:
64-
extra_args: ${{ inputs.working-directory != '.' && format('--files {0}/**', inputs.working-directory) || '' }}
81+
extra_args: >-
82+
${{ inputs['pre-commit-config-file'] != '' && format('--config {0}', inputs['pre-commit-config-file']) || '' }}
83+
${{ inputs.working-directory != '.' && format('--files {0}/**', inputs.working-directory) || '' }}
6584
6685
tests:
6786
name: Run tests
@@ -146,6 +165,7 @@ jobs:
146165

147166
sonarcloud:
148167
name: Run SonarQube Cloud Scan
168+
if: ${{ !inputs.skip-sonar }}
149169
runs-on: ubuntu-latest
150170
needs: tests
151171
defaults:

0 commit comments

Comments
 (0)