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

First Release Error #100

Open
patrickleet opened this issue Nov 19, 2022 · 5 comments
Open

First Release Error #100

patrickleet opened this issue Nov 19, 2022 · 5 comments

Comments

@patrickleet
Copy link
Contributor

When add this action to a repo that has no releases yet, it throws an error.

Maybe it should just generate and empty changelog? Or a message "First release".

I am using this as a workaround to conditionally run the step only if previous tags exist via if: env.previous_tag:

    - name: previous tag
      run: |
        # set previous_tag to the last tag in the repo
        # or if the command throws an error, set it to nothing
        previous_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
        echo "previous_tag=$previous_tag" >> $GITHUB_ENV

    - name: Generate changelog
      id: changelog
      if: env.previous_tag
      uses: jaywcjlove/changelog-generator@main
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
@jaywcjlove
Copy link
Owner

 - name: Generate changelog
   id: changelog
   uses: jaywcjlove/changelog-generator@main
+   if: env.previous_tag
   with:
    token: ${{ secrets.GITHUB_TOKEN }}

This can solve the problem? @patrickleet

@patrickleet
Copy link
Contributor Author

yea, with the previous_tag step that sets it to "" or the previous tag - if it's "", then that will evaluate to false, so it won't run in that case

jaywcjlove added a commit that referenced this issue Nov 19, 2022
@jaywcjlove
Copy link
Owner

@patrickleet thx!

jaywcjlove added a commit to jaywcjlove/create-tag-action that referenced this issue Nov 19, 2022
github-actions bot pushed a commit to jaywcjlove/create-tag-action that referenced this issue Nov 19, 2022
@patrickleet
Copy link
Contributor Author

I trimmed the step that creates env.previous_tag down a bit:

   - run: echo "previous_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo '')" >> $GITHUB_ENV

This is also required for the workaround to work, otherwise it will never run

@jaywcjlove
Copy link
Owner

@patrickleet thx!

jaywcjlove added a commit to jaywcjlove/github-actions that referenced this issue Nov 20, 2022
jaywcjlove referenced this issue in jaywcjlove/create-tag-action Nov 20, 2022
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