generated from daos-stack/actions-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
37 lines (36 loc) · 1.11 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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:
# checkout the common library
- name: Checkout code
uses: actions/checkout@v4
with:
repository: daos-stack/actions-lib
ref: v1
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"