nedbat / scriv

Changelog management tool

Home Page:https://scriv.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Documentation unclear on how the github-release command works

rodrigogiraoserrao opened this issue · comments

I was trying to use the command scriv github-release to publish a release, but I haven't been successful. Every time I try, I get this message:

λ scriv github-release
warning: Version 0.1.0 has no tag. No release will be made.

I tried creating tags for version 0.1.0 in three different ways:

git tag 0.1.0
git tag v0.1.0
git tag -a v0.1.0 -m "My annotation here."

None of these seem to work 🤷

Can you show the contents of the changelog, and the output of git tags when you get that error?

λ git tag
v0.1.0

(Like I said, I tried this with 0.1.0 and v0.1.0.)

The contents of CHANGELOG.md are as follows:

# Changelog

<!--scriv-insert-here-->

<a id='changelog-0.1.0'></a>
# 0.1.0 — 2022-06-22

## Added

- Classes `ExtendedEncoder` and `ExtendedDecoder` to allow extension of the JSON format.
<!--scriv-end-here-->

Taken from the extendedjson repository.

Seems like the issue is that the command is git tag and you coded it as git tags:

tags = set(run_simple_command("git tags").split())

Changing that to git tag makes some progress, but I'm getting some 404 errors. I'm trying to understand if that's on me or not.

My understanding of what's happening is this:

It seems like the follow-up issue is that you are trying to create/update the release through an API without doing any sort of authentication whatsoever, so it simply doesn't work.
You can list tags and etc. because you resort to running the git commands in the command line, and I'm already auth'ed in the command line, but then you try issuing a regular POST request with requests, and that has no way of knowing that's an authorised POST request.

Please do correct me if I'm wrong.

Whoops, good catch on the git command. I have an alias for "git tags" because I could never remember the real name. I've fixed that.
The authentication is implicit through .netrc. I guess I should provide some explicit options, and documentation.

The authentication is implicit through .netrc. I guess I should provide some explicit options, and documentation.

Is that going to work on Windows as well? That sounds like a Linux/Unix thing.

Can you try the latest tip of main? If you put a personal access token in GITHUB_TOKEN, it should work.

Installing the latest tip of main with python -m pip install -e git+https://github.com/nedbat/scriv.git@56297c7ddd3fb24d6aa827b28a8509ad5f206d47#egg=scriv[toml] and then setting a personal access token in the environment variable GITHUB_TOKEN makes it work, yes! 🎉

This is now released as part of scriv 0.16.0.

Dumb question here, how do you set environment variable GITHUB_TOKEN with your personal access token? I tried $ export GITHUB_TOKEN=myPAT from within the poetry shell I use as environment and didn't work. Also, this seems to be deleted every time I launch the environment anew.

Dumb question here, how do you set environment variable GITHUB_TOKEN with your personal access token? I tried $ export GITHUB_TOKEN=myPAT from within the poetry shell I use as environment and didn't work. Also, this seems to be deleted every time I launch the environment anew.

What you did should work. To load it automatically, you could put it into a file loaded when you load the virtual env or when you start your shell. Specific vary depending on system, shell etc.

I added more explanation in 4f1ceca.