From 94e4efebff9a9be678dd1518aaabadb261428a71 Mon Sep 17 00:00:00 2001 From: Katy Baulch <46493669+katybaulch@users.noreply.github.com> Date: Tue, 26 Mar 2024 12:05:31 +0000 Subject: [PATCH] Move within PR step above retrospective step --- action.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/action.yml b/action.yml index d568cf4..160b1de 100644 --- a/action.yml +++ b/action.yml @@ -52,18 +52,18 @@ runs: - uses: actions/checkout@v4 - uses: fregante/setup-git-user@v2 - - name: Determine new tag version - if: ${{ inputs.pr_body == '' && inputs.pr_number == '' }} + - name: Determine new tag version from PR event + if: ${{ inputs.pr_body != '' && inputs.pr_number != ''}} shell: sh - id: determine_next_tag + id: determine_next_tag_from_pr_event # User controlled input needs to be santitised beforehand e.g., by adding an # intermediate env var to prevent the workflow being exposed to a critical # command injection attack env: - PR_BODY: "${{ fromJson(steps.get_pr_data.outputs.result).body }}" - PR_NUMBER: "${{ fromJson(steps.get_pr_data.outputs.result).number }}" + PR_BODY: "${{ inputs.pr_body }}" + PR_NUMBER: "${{ inputs.pr_number }}" run: | - echo "Attempting to auto-tag merge commit" + echo "Attempting to auto-tag merge commit2" script_output=$("${{ github.action_path }}/auto-tag.sh" "${PR_BODY}" "${PR_NUMBER}") if $? != 0; then exit 1 @@ -72,18 +72,18 @@ runs: echo "New tag: ${new_tag}" echo "new_tag=${new_tag}" >> "$GITHUB_OUTPUT" - - name: Determine new tag version from PR event - if: ${{ inputs.pr_body != '' && inputs.pr_number != ''}} + - name: Determine new tag version + if: ${{ inputs.pr_body == '' && inputs.pr_number == '' }} shell: sh - id: determine_next_tag_from_pr_event + id: determine_next_tag # User controlled input needs to be santitised beforehand e.g., by adding an # intermediate env var to prevent the workflow being exposed to a critical # command injection attack env: - PR_BODY: "${{ inputs.pr_body }}" - PR_NUMBER: "${{ inputs.pr_number }}" + PR_BODY: "${{ fromJson(steps.get_pr_data.outputs.result).body }}" + PR_NUMBER: "${{ fromJson(steps.get_pr_data.outputs.result).number }}" run: | - echo "Attempting to auto-tag merge commit2" + echo "Attempting to auto-tag merge commit" script_output=$("${{ github.action_path }}/auto-tag.sh" "${PR_BODY}" "${PR_NUMBER}") if $? != 0; then exit 1