nedbat / scriv

Changelog management tool
https://scriv.readthedocs.io
Apache License 2.0
256 stars 28 forks source link

github-release and github actions #56

Closed step21 closed 2 years ago

step21 commented 2 years ago

I haven't tried it yet, but can scriv github-release work as a github action? The token can be supplied, but if it needs to be in a netrc file, I assume it has to be written to that file instead of being supplied to the command, right?

nedbat commented 2 years ago

The token can also be in a GITHUB_TOKEN environment variable, which can be populated from a GitHub secret.

nedbat commented 2 years ago

For example:

        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
step21 commented 2 years ago

Yes, this is what I did instead. It runs, but doesn't create any release. And there does not seem to be any way to make it give output or errors. Is this on purpose as well? I can give you a link to or copy some example output from a github actions run if that helps.

nedbat commented 2 years ago

Sure, I'll take a look at what you've got.

step21 commented 2 years ago

Github action config is this:

      - name: Create Github Release with scriv
        id: create_release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          scriv github-release

and this is in the Github Action log:

Run scriv github-release
  scriv github-release
  shell: /usr/bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.10.6/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.6/x64/lib
    GITHUB_TOKEN: ***

It looks like a successful run, however, it does not create any release on github. Do you have any idea how to test it or make it give reasonable error messages?

nedbat commented 2 years ago

I would have thought it would produce error messages. Can you add --verbosity=DEBUG to the scriv command line and try it again? Also, can you link me to the action run?

step21 commented 2 years ago

You can find the latest run here: https://github.com/step21/eurlex/actions/runs/3054295037/jobs/4926007039 I made a special new release to run it again on Github. Though locally it was the same result, I wanted to be sure, and as the last release was already published on pypi (which is the step before right now), without a re-release or changing the workflow, it would not get to the scriv step.

nedbat commented 2 years ago

I see the problem: your changelog has dates but no version numbers. scriv tries to match changelog entries to tags by their version number. If there's no version number, it can't do that.

How did you want it to make the release?

I can add more logging to the command so that this would be clearer.

nedbat commented 2 years ago

Commit 10f0afd now outputs warnings for version-less changelog entries.

step21 commented 2 years ago

Ah thanks, that makes sense. I just followed a tutorial and added changes to scriv, but wasn't aware that I should adjust the version there. Thanks for taking a look.

nedbat commented 2 years ago

The improved logging is now released as part of scriv 0.17.0.