From 5895b3da3428d4b9ca9139efeeec07f005696074 Mon Sep 17 00:00:00 2001 From: "J. Caleb Wherry" <337871+calebwherry@users.noreply.github.com> Date: Tue, 19 Dec 2023 14:58:44 -0500 Subject: [PATCH] 18727: Updates git tag retrieval to skip non-repo tags (#42) Since other processes create tags on repos, this will ignore all tags that are not a semver release tag when determining next version. --- .github/workflows/create-branch-build.yml | 7 ++++--- .github/workflows/create-pr-build.yml | 7 ++++--- .github/workflows/create-release-build.yml | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/create-branch-build.yml b/.github/workflows/create-branch-build.yml index 067c5b84..c369d6b7 100644 --- a/.github/workflows/create-branch-build.yml +++ b/.github/workflows/create-branch-build.yml @@ -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 diff --git a/.github/workflows/create-pr-build.yml b/.github/workflows/create-pr-build.yml index e68055f9..5183c5ee 100644 --- a/.github/workflows/create-pr-build.yml +++ b/.github/workflows/create-pr-build.yml @@ -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 diff --git a/.github/workflows/create-release-build.yml b/.github/workflows/create-release-build.yml index a9813b37..d346337f 100644 --- a/.github/workflows/create-release-build.yml +++ b/.github/workflows/create-release-build.yml @@ -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