8000 ci(policy): take the semver baseline from the base and the line's tags (#937) by adityamukho · Pull Request #970 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/policy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,16 @@ jobs:

- name: Find latest release tag
id: baseline
env:
TARGET: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }}
run: |
tag=$(git describe --tags --abbrev=0 --match 'v[0-9]*')
# The latest release reachable from the base (a PR checkout is the
# merge into its base; its first parent is the base). On a
# maintenance branch (v2.x: v2.*) only that line's tags count, so a
# PR whose own history reaches a newer line's tag cannot pick it.
if [ "$GITHUB_EVENT_NAME" = pull_request ]; then base=HEAD^1; else base=HEAD; fi
if [[ "$TARGET" == *.x ]]; then match="${TARGET%.x}.*"; else match='v[0-9]*'; fi
tag=$(git describe --tags --abbrev=0 --match "$match" "$base")
echo "Baseline: $tag"
echo "tag=$tag" >> "$GITHUB_OUTPUT"

Expand Down
Loading
0