Skip to content

Commit

Permalink
Merge pull request #52 from rossjrw/fix-action-version-report
Browse files Browse the repository at this point in the history
Fix action version check
  • Loading branch information
rossjrw authored May 18, 2023
2 parents 70d0e7a + aa0f798 commit b3a95bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ runs:
shell: bash

- name: Determine action version
run: >-
$GITHUB_ACTION_PATH/lib/find-current-git-tag.sh
-p $actionrepo -f $actionref
run: |
action_version=$("${{ github.action_path }}/lib/find-current-git-tag.sh" -p $actionrepo -f $actionref)
echo "action_version=$action_version" >> "$GITHUB_ENV"
shell: bash

- name: Determine auto action
Expand Down
20 changes: 10 additions & 10 deletions lib/find-current-git-tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ if [ -z "$github_repository" ] || [ -z "$git_ref" ]; then
helpFunction
fi

echo >&2 "Determining preview action version"
echo >&2 "Determining Git tag for $github_repository/$git_ref"

echo >&2 "Cloning repository $github_repository at ref $git_ref"
if git clone --bare --single-branch --branch "$git_ref" "https://github.com/$github_repository" bare_pr_preview; then
echo >&2 "Finding most specific tag matching tag $git_ref"
action_version=$(git describe --tags --match "v*.*.*" || git describe --tags || git rev-parse HEAD)
echo >&2 "Found $action_version"
echo "action_version=$action_version" >>"$GITHUB_ENV"
else
echo >&2 "Clone failed; using truncated ref as action version"
echo "action_version=${git_ref:0:9}" >>"$GITHUB_ENV"
fi
git clone --bare --single-branch --branch "$git_ref" "https://github.com/$github_repository" bare_pr_preview

cd bare_pr_preview || exit 1

action_version=$(git describe --tags --match "v*.*.*" || git describe --tags || git rev-parse HEAD)

echo "$action_version"
exit 0

0 comments on commit b3a95bc

Please sign in to comment.