generated from daos-stack/actions-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Brian J. Murrell <[email protected]>
- Loading branch information
1 parent
fc1afbc
commit d0052f7
Showing
3 changed files
with
72 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Test | ||
id: test | ||
uses: ./ | ||
with: | ||
commit-message: | | ||
Use external action | ||
Run-GHA: true | ||
Skip-PR-comments: true | ||
Test-tag: always_passes,vm | ||
Required-githooks: true | ||
Signed-off-by: Brian J. Murrell <[email protected]> | ||
pragma: TEST_TAG | ||
default: foobar | ||
- name: Test value | ||
run: | | ||
set -eux | ||
if [ '${{ steps.test.outputs.value }}' != 'always_passes,vm' ]; then | ||
echo "Value is not 'always_passes,vm'" | ||
exit 1 | ||
fi |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
A GitHub Action to … | ||
A GitHub Action to create a variable from a commit pragma |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,37 @@ | ||
name: '…' | ||
description: '…' | ||
#inputs: | ||
# <name>: | ||
# description: '…' | ||
# required: true | ||
name: 'Set Variable from Commit Pragma' | ||
description: 'Set Variable from Commit Pragma' | ||
inputs: | ||
commit-message: | ||
description: Dequoted commit message | ||
required: true | ||
pragma: | ||
description: Pragma to make a variable from | ||
required: true | ||
default: | ||
description: Default value if pragma is not found | ||
required: false | ||
outputs: | ||
value: | ||
description: The value of the pragma | ||
value: ${{ steps.value.outputs.value }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- run: | | ||
echo "…" | ||
# checkout the common library | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: daos-stack/actions-lib | ||
ref: bmurrell/initial | ||
path: actions-lib | ||
- name: Create Variable | ||
id: value | ||
shell: bash | ||
run: | | ||
set -eu | ||
# using user input (the commit message) in an eval can be pretty dangerous | ||
# but actions-lib/get_commit_pragmas does a good job of sanitizing it | ||
eval $(echo '${{ inputs.commit-message }}' | actions-lib/get_commit_pragmas) | ||
echo "value=${${{ inputs.pragma }}:-${{ inputs.default }}}" >> $GITHUB_OUTPUT | ||
cat "$GITHUB_OUTPUT" |