Skip to content

Commit

Permalink
18727: Updates git tag retrieval to skip non-repo tags (#42)
Browse files Browse the repository at this point in the history
Since other processes create tags on repos, this will ignore all tags
that are not a semver release tag when determining next version.
  • Loading branch information
calebwherry authored Dec 19, 2023
1 parent 2eeda97 commit 5895b3d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/create-branch-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ jobs:

- name: Get previous git tag
id: previous-tag
uses: WyriHaximus/github-action-get-previous-tag@v1
with:
fallback: 0.0.0
run: |
tag=$(git for-each-ref --sort=-creatordate --count 5 --format="%(refname:short)" "refs/tags/" | grep -E "^[0-9]+\.[0-9]+\.[0-9]+" | head -n 1)
echo "Found tag: $tag"
echo "tag=$(echo $tag)" >> $GITHUB_OUTPUT
- name: Get next semver from previous tag
id: next-semvers
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/create-pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ jobs:

- name: Get previous git tag
id: previous-tag
uses: WyriHaximus/github-action-get-previous-tag@v1
with:
fallback: 0.0.0
run: |
tag=$(git for-each-ref --sort=-creatordate --count 5 --format="%(refname:short)" "refs/tags/" | grep -E "^[0-9]+\.[0-9]+\.[0-9]+" | head -n 1)
echo "Found tag: $tag"
echo "tag=$(echo $tag)" >> $GITHUB_OUTPUT
- name: Get next semver from previous tag
id: next-semvers
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/create-release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ jobs:

- name: Get previous git tag
id: previous-tag
uses: WyriHaximus/github-action-get-previous-tag@v1
with:
fallback: 0.0.0
run: |
tag=$(git for-each-ref --sort=-creatordate --count 5 --format="%(refname:short)" "refs/tags/" | grep -E "^[0-9]+\.[0-9]+\.[0-9]+" | head -n 1)
echo "Found tag: $tag"
echo "tag=$(echo $tag)" >> $GITHUB_OUTPUT
- name: Get next semver from previous tag
id: next-semvers
Expand Down

0 comments on commit 5895b3d

Please sign in to comment.