Skip to content

Commit

Permalink
Add build number to supported inputs options (#228)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
afinetooth authored Oct 11, 2024
1 parent 0ae2400 commit c258231
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
action: [report, done] # Note: We're also testing 'install' since it's implicitly in each of these two actions
action: [report, done, build-number-report, build-number-done] # Note: We're also testing 'install' since it's implicit in each action
fail_on_error: [true, false]
steps:
- name: Checkout code
Expand All @@ -36,13 +36,14 @@ jobs:
run: |
echo "Running on Windows"
- name: Run Test Action
- name: Test Action
uses: ./
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
fail-on-error: ${{ matrix.fail_on_error }}
debug: true
parallel-finished: ${{ matrix.action == 'done' }} # Only set 'parallel-finished' to true when testing 'done'
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`
parallel-finished: ${{ matrix.action == 'done' || matrix.action == 'build-number-done' }} # Only set `parallel-finished` to `true` when testing `done` or `build-number-done`
env:
CI: true
continue-on-error: ${{ matrix.fail_on_error }}
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ inputs:
flag-name:
description: 'Job flag name, e.g. "Unit", "Functional", or "Integration". Will be shown in the Coveralls UI.'
required: false
build-number:
description: 'Override the build number autodetected from CI. This is useful if your CI tool assigns a different build number per each parallel build.'
required: false
parallel:
description: 'Set to true if you are running parallel jobs, then use "parallel-finished: true" for the last action.'
required: false
Expand Down Expand Up @@ -195,6 +198,7 @@ runs:
coveralls done
${{ inputs.debug == 'true' && '--debug' || '' }}
${{ inputs.measure == 'true' && '--measure' || '' }}
${{ inputs.build-number && format('--build-number {0}', inputs.build-number) || '' }}
${{ inputs.fail-on-error == 'false' && '--no-fail' || '' }}
env:
COVERALLS_DEBUG: ${{ inputs.debug }}
Expand All @@ -216,6 +220,7 @@ runs:
${{ inputs.fail-on-error == 'false' && '--no-fail' || '' }}
${{ inputs.allow-empty == 'true' && '--allow-empty' || '' }}
${{ inputs.base-path && format('--base-path {0}', inputs.base-path) || '' }}
${{ inputs.build-number && format('--build-number {0}', inputs.build-number) || '' }}
${{ inputs.format && format('--format {0}', inputs.format) || '' }}
${{ inputs.file || inputs.path-to-lcov }}
${{ inputs.files }}
Expand Down

0 comments on commit c258231

Please sign in to comment.