mathieudutour / mathieudutour/github-tag-action

Release tags are created on pull requests despite having set a release_branch

Open
#150 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
733
Forks
227
PR merge metrics
No merged PRs in 30d

Description

Hi,
I am attempting to use this action as part of a workflow that is triggered both on push and pull_request events on for my main branch with the following inputs:

steps:
- uses: actions/checkout@v3

- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
release_branches: main

The issue here comes when I run the workflow on pull requests a release tag is always created, despite having specified main as my only release branch. My understanding of the input documentation copied below is that pull requests would generate a version number with the commit hash as a suffix and not generate a tag, while push on release branch would generate a release tag. Have I misunderstood something with the implementation here?

> release_branches (optional) - Comma separated list of branches (JavaScript regular expression accepted) that will generate the release tags. Other branches and pull-requests generate versions postfixed with the commit hash and do not generate any repository tag. Examples: master or .* or release.*,hotfix.*,master... (default: master,main).

Example job triggering a release on pull request:
https://github.com/mikael-andersson91/try-tag-actions/actions/runs/3396811156/jobs/5648291822

And in-case viewing the workflow run isn't available for you, here's the log from a pull request run where a release tag was created:
![image](https://user-images.githubusercontent.com/17871668/200107373-1be4303f-b9ac-4cca-a6b7-16298eb904ef.png)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the workflow steps using actions/checkout@v3 and mathieudutour/github-tag-action@v6.1, then trace how the release_branches input is handled for push and pull_request events. Reproduce the reported pull-request run and verify that non-release branches produce only a hash-suffixed version, while pushes to main create repository tags.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github-actions, typescript
Domain
ci-cd, release
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.