Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial commit #1

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/test.yml
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
2 changes: 1 addition & 1 deletion README.md
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
41 changes: 33 additions & 8 deletions action.yml
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"