Skip to content

Commit c258231

Browse files
authored
Add build number to supported inputs options (#228)
* Add `build-number` to input options to let users override the action's default build number: `${{ github.run_id }}`. Co-authored-by: Brian Torres <[email protected]>
1 parent 0ae2400 commit c258231

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Diff for: .github/workflows/test.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
os: [ubuntu-latest, windows-latest, macos-latest]
17-
action: [report, done] # Note: We're also testing 'install' since it's implicitly in each of these two actions
17+
action: [report, done, build-number-report, build-number-done] # Note: We're also testing 'install' since it's implicit in each action
1818
fail_on_error: [true, false]
1919
steps:
2020
- name: Checkout code
@@ -36,13 +36,14 @@ jobs:
3636
run: |
3737
echo "Running on Windows"
3838
39-
- name: Run Test Action
39+
- name: Test Action
4040
uses: ./
4141
with:
4242
github-token: ${{ secrets.GITHUB_TOKEN }}
4343
fail-on-error: ${{ matrix.fail_on_error }}
4444
debug: true
45-
parallel-finished: ${{ matrix.action == 'done' }} # Only set 'parallel-finished' to true when testing 'done'
45+
build-number: ${{ (matrix.action == 'build-number-report' || matrix.action == 'build-number-done') && github.sha || '' }} # Only set 'build-number' to `${{ github.sha }}` when testing `build-number-report` or `build-number-done`
46+
parallel-finished: ${{ matrix.action == 'done' || matrix.action == 'build-number-done' }} # Only set `parallel-finished` to `true` when testing `done` or `build-number-done`
4647
env:
4748
CI: true
4849
continue-on-error: ${{ matrix.fail_on_error }}

Diff for: action.yml

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ inputs:
2222
flag-name:
2323
description: 'Job flag name, e.g. "Unit", "Functional", or "Integration". Will be shown in the Coveralls UI.'
2424
required: false
25+
build-number:
26+
description: 'Override the build number autodetected from CI. This is useful if your CI tool assigns a different build number per each parallel build.'
27+
required: false
2528
parallel:
2629
description: 'Set to true if you are running parallel jobs, then use "parallel-finished: true" for the last action.'
2730
required: false
@@ -195,6 +198,7 @@ runs:
195198
coveralls done
196199
${{ inputs.debug == 'true' && '--debug' || '' }}
197200
${{ inputs.measure == 'true' && '--measure' || '' }}
201+
${{ inputs.build-number && format('--build-number {0}', inputs.build-number) || '' }}
198202
${{ inputs.fail-on-error == 'false' && '--no-fail' || '' }}
199203
env:
200204
COVERALLS_DEBUG: ${{ inputs.debug }}
@@ -216,6 +220,7 @@ runs:
216220
${{ inputs.fail-on-error == 'false' && '--no-fail' || '' }}
217221
${{ inputs.allow-empty == 'true' && '--allow-empty' || '' }}
218222
${{ inputs.base-path && format('--base-path {0}', inputs.base-path) || '' }}
223+
${{ inputs.build-number && format('--build-number {0}', inputs.build-number) || '' }}
219224
${{ inputs.format && format('--format {0}', inputs.format) || '' }}
220225
${{ inputs.file || inputs.path-to-lcov }}
221226
${{ inputs.files }}

0 commit comments

Comments
 (0)