Skip to content

Commit

Permalink
Use env variables in the auto tag script instead of passing args
Browse files Browse the repository at this point in the history
  • Loading branch information
katybaulch committed Apr 30, 2024
1 parent daab13b commit 1b25722
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ runs:
PR_NUMBER: "${{ inputs.pr_number }}"
run: |
echo "Determining whether user has selected an auto-tag option..."
script_output=$("${{ github.action_path }}/auto-tag.sh" "${PR_BODY}" "${PR_NUMBER}")
script_output=$("${{ github.action_path }}/auto-tag.sh"
if $? != 0; then
exit 1
fi
Expand All @@ -71,15 +71,15 @@ runs:
- name: Determine new tag version
if: ${{ (inputs.pr_body == '' && inputs.pr_number == '') && steps.get_pr_data.outputs.result && (fromJSON(steps.get_pr_data.outputs.result).number && fromJSON(steps.get_pr_data.outputs.result).body) }}
shell: sh
env:
PR_BODY: "${{ fromJson(steps.get_pr_data.outputs.result).body }}"
PR_NUMBER: "${{ fromJson(steps.get_pr_data.outputs.result).number }}"
id: determine_next_tag_retrospectively
run: |
echo "Determining whether user selected an auto-tag option..."
echo "Using GitHub script to get PR info..."
PR_BODY="${{ fromJson(steps.get_pr_data.outputs.result).body }}"
ESCAPED_PR_BODY="$(echo $PR_BODY | envsubst)"
script_output=$("${{ github.action_path }}/auto-tag.sh" "${ESCAPED_PR_BODY}" "${{ fromJson(steps.get_pr_data.outputs.result).number }}")
script_output=$("${{ github.action_path }}/auto-tag.sh"
if $? != 0; then
exit 1
fi
Expand Down
4 changes: 2 additions & 2 deletions auto-tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if [[ -z ${latest_tag} ]]; then
fi
echo "Latest tag: ${latest_tag}"

pr_body="$1"
pr_body="$(echo ${PR_BODY} | envsubst)"
pr_tag_section=$("${pr_body}" | awk '/^## Proposed version/,/^Notes:/ {if (!/^## Proposed version/ && !/^Notes:/) print}')

# Get selected versioning checkboxes.
Expand All @@ -21,7 +21,7 @@ is_patch=$(is_patch_selected "${pr_tag_section}")
is_minor=$(is_minor_selected "${pr_tag_section}")
is_major=$(is_major_selected "${pr_tag_section}")

pr_number="$2"
pr_number="${PR_NUMBER}"

if { [[ ${is_minor} == true ]] && [[ ${is_patch} == true ]]; } ||
{ [[ ${is_minor} == true ]] && [[ ${is_major} == true ]]; } ||
Expand Down

0 comments on commit 1b25722

Please sign in to comment.