From e65371a995699cd9c47f4e4cab0b54f1336ac5bc Mon Sep 17 00:00:00 2001 From: "Brian J. Murrell" Date: Tue, 16 Apr 2024 15:45:07 -0400 Subject: [PATCH] DO NOT LAND Copy actions from daos-stack/daos. These need to be published and commonly available. Skip-PR-comments: true Run-GHA: true Required-githooks: true Signed-off-by: Brian J. Murrell --- .../actions/import-commit-pragmas/action.yml | 14 ++++++++++ .../actions/variable-from-pragma/action.yml | 28 +++++++++++++++++++ .github/workflows/rpm-build-and-test.yml | 6 ++-- 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 .github/actions/import-commit-pragmas/action.yml create mode 100644 .github/actions/variable-from-pragma/action.yml diff --git a/.github/actions/import-commit-pragmas/action.yml b/.github/actions/import-commit-pragmas/action.yml new file mode 100644 index 0000000..58d8ecc --- /dev/null +++ b/.github/actions/import-commit-pragmas/action.yml @@ -0,0 +1,14 @@ +name: 'Import Commit Pragmas' +description: 'Import Commit Pragmas' +runs: + using: "composite" + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + - run: . ci/gha_functions.sh; + git show -s --format=%B | sed -e "s/'/'\"'\"'/g" | + get_commit_pragmas | + sed -e 's/^/CP_/' >> $GITHUB_ENV + shell: bash diff --git a/.github/actions/variable-from-pragma/action.yml b/.github/actions/variable-from-pragma/action.yml new file mode 100644 index 0000000..929ed99 --- /dev/null +++ b/.github/actions/variable-from-pragma/action.yml @@ -0,0 +1,28 @@ +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: + - name: Create Variable + id: value + shell: bash + run: | + . ci/gha_functions.sh + set -eu + eval $(echo '${{ inputs.commit_message }}' | get_commit_pragmas) + echo "value=${${{ inputs.pragma }}:-${{ inputs.default }}}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/rpm-build-and-test.yml b/.github/workflows/rpm-build-and-test.yml index c1ec00f..5c74286 100644 --- a/.github/workflows/rpm-build-and-test.yml +++ b/.github/workflows/rpm-build-and-test.yml @@ -68,19 +68,19 @@ jobs: steps: - name: Set rpm-test-version variable id: rpm-test-version - uses: daos-stack/daos/variable-from-pragma + uses: ./.github/actions/variable-from-pragma with: commit_message: ${{ needs.Import-commit-message.outputs.dequoted_message }} pragma: RPM_TEST_VERSION - name: Set pr-repos variable id: pr-repos - uses: daos-stack/daos/variable-from-pragma + uses: ./.github/actions/variable-from-pragma with: commit_message: ${{ needs.Import-commit-message.outputs.dequoted_message }} pragma: PR_REPOS - name: Set run-gha variable id: run-gha - uses: daos-stack/daos/variable-from-pragma + uses: ./.github/actions/variable-from-pragma with: commit_message: ${{ needs.Import-commit-message.outputs.dequoted_message }} pragma: RUN_GHA