Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pre-release sufix bump not working #290

Open
gabriel-amyot opened this issue Nov 8, 2023 · 4 comments
Open

pre-release sufix bump not working #290

gabriel-amyot opened this issue Nov 8, 2023 · 4 comments

Comments

@gabriel-amyot
Copy link

gabriel-amyot commented Nov 8, 2023

I am not able to publish a second Tag within a PR.
It triggers a conflict.
The documentation leads to thing that the pre-release sufix is incremented, but it is not in my case.

Is this a bug, or a misconfigured the action?

Output

*** CONFIGURATION ***
	DEFAULT_BUMP: patch
	DEFAULT_BRANCH: master
	WITH_V: false
	RELEASE_BRANCHES: master,main
	CUSTOM_TAG: 
	SOURCE: .
	DRY_RUN: false
	INITIAL_VERSION: 0.0.0
	TAG_CONTEXT: repo
	PRERELEASE: true
	PRERELEASE_SUFFIX: pr_9
	VERBOSE: false
	MAJOR_STRING_TOKEN: #major
	MINOR_STRING_TOKEN: #minor
	PATCH_STRING_TOKEN: #patch
	NONE_STRING_TOKEN: #none
	BRANCH_HISTORY: last
pre_release = true
fatal: ambiguous argument 'master..HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
History:
---
Merge 09b561adcb8267e7a6[11](https://github.com/gabriel-amyot/github-action-maven-example-start/actions/runs/6804158532/job/18501052012#step:4:12)0d2a6374b849635e96bb into 9fcac0e98c9650c9ecade0c5b94a2c59d64a5388
---
fatal: ambiguous argument '': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Setting pr_9 pre-tag  - With pre-tag 0.1.2-pr_9.0
fatal: tag '0.1.2-pr_9.0' already exists

Action

name: Bump version
on:
  pull_request:
    branches: [ master ]
jobs:
  build:
    runs-on: ubuntu-22.04
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v3
        with:
          ref: ${{ github.event.pull_request.merge_commit_sha }}
          fetch-depth: '0'

      - name: Bump version and push tag
        uses: anothrNick/github-tag-action@1.64.0
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          WITH_V: false
          PRERELEASE: true
          PRERELEASE_SUFFIX: pr_${{ github.event.number }}
          DEFAULT_BUMP: patch
          BRANCH_HISTORY: last

First PR commit tags correctly, but when I merge a second commit on the PR it fails
[0.2.0-pr_8.0]
[0.1.0]
[0.1.0-PR_7.0]
[0.0.1]

@gabriel-amyot
Copy link
Author

I found a work arround by dynamicaly setting a different suffix each time, but the number at the end of the suffix stays at 0

name: Bump version
on:
  pull_request:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-latest
    permissions: write-all

    steps:
      - uses: actions/checkout@v3
        with:
          ref: ${{ github.event.pull_request.merge_commit_sha }}
          fetch-depth: '0'

      - name: Bump version and push tag
        uses: anothrNick/github-tag-action@1.67.0 #https://github.com/anothrNick/github-tag-action
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          WITH_V: false
          PRERELEASE: true
          PRERELEASE_SUFFIX: pr-${{ github.event.number }}_${{ github.run_id }}_${{ github.run_number }}
          DEFAULT_BUMP: patch

image

@sbe-arg
Copy link
Collaborator

sbe-arg commented Nov 9, 2023

Does seem like a bug. I remember the suffix .X in pre-tags being bumped in earlier versions.

@gabriel-amyot
Copy link
Author

gabriel-amyot commented Nov 9, 2023

Thanks for the response @sbe-arg ,

I think I've figured out the issue
image

I highly suspect that the problem happens when I use a mutable PRERELEASE_SUFFIX like i was doing previously
something like:

  PRERELEASE_SUFFIX: pr-${{ github.event.number }}

I would assume that the problem happens here when we try to match the pre_tag.

I could try fixing this myself, but I am not sure how to "compile and publish" a github action in order to test my hypothesis.

@sbe-arg
Copy link
Collaborator

sbe-arg commented Nov 9, 2023

If you fork edit and point testing to your fork master or branch is the easier way to develop.

Ill review the pr.

It seems you are ontrack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants