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

Fix type error #23

Closed
wants to merge 21 commits into from
Closed

Fix type error #23

wants to merge 21 commits into from

Conversation

ochosi
Copy link
Contributor

@ochosi ochosi commented Sep 25, 2023

This is the simple/naive way of fixing a TypeError when there are no reviewers.
This problem occurs not only when someone admin-merges without approval, it also seems to happen on auto-merged dependabot updates (e.g. osbuild/images#168)

ochosi and others added 21 commits March 21, 2022 13:56
Add composite action to create upstream tag

The release_bot.py contains several steps, which were previously part of
our release script in osbuild/maintainer-tools. The script here is much
shorter though.
Things that were dropped were the sanity checks, because we can presume
that the git repository at hand is sane, that the git remote is well
configured etc.
Furthermore all interactivity of the original script was removed. Even
though I had recently added a --no-interactive mode to the original
script, I just felt this would make the code harder to read.

The rationale for making this a composite action instead of a standalone
repository was that this way each component can define it's own
automated schedule and that there would be some representation in the
GitHub Actions for the component of the tag being created.

Getting the component/repository name as a separate step vs. just using 
`github.event.repository.name` is done so it also works when being triggered
from schedule (the event payload is missing in this case).
This was a leftover from a previous stage of this script.
In the contributors list we don't want to list the post release version
bump author since it is most likely a bot.
Also the colon feels just like a visual clutter: let's remove it.
Now the order feels arbitrary, let's just sort the list alphabetically for now.
Add an option to create new tag for a release using semantic versioning
by incrementing the major version and zeroing the rest of the version.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
Co-authored-by: Ondřej Budai <obudai@redhat.com>
The script would skip pushing a tag if there is only one new commit in
the repository, but it is not the one that bumps the version
post-release. Check for this specific case and push tags even if there
is just a single new functional commit.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
Enhance the create-tag action to optionally allow bumping the minor or
patch parts of the semantic version, in addition to already supported
major version bumps.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
Support bumping of minor or patch versions with semantic versioning
Previously, the code used `split('\n')` on commands, which were listing
commits since the last release. However, splitting an empty string with
a specified separator returns [''], which fooled the code to behave as
if there was one commit since the last release.

As a result, the code would push a new release tag, even if there were
no new commits.

Fix this by using `splitlines()`, which returns an empty list when used
on empty string.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
Make `args` global and run more actions which do not modify the
repository when --dry-run is provided. This helps with testing the
script on a real git repository.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
The script always prints the configuration used for its run. Include the
semver bump type in case semver is enabled.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
`git describe` gets confused when the same commit have more than one
tag. In such case, it may or may not return the latest tag.

In [1], the action detected the v0.2.0 tag as the latest, while there
was already the v0.3.0 tag attached to the same commit. As a result, the
action tried to recreate the v0.3.0 tag, which already exists in the
repo. The action does that every time it is run in the repo.

Move to using `git tag -l --merged` to get all tags in the repo, which are
reachable from the current commit. Sort them in the ascending order and take
the last item from the list as the latest tag.

Use `packaging.Version` to represent releases. This makes sorting of the
list of existing releases to produce expected results. In addition,
refactor the `autoincrement_version()` to also use `packaging.Version`
when parsing the latest version and bumping it. As a side-effect, a bug
with "simple dot-release" is fixed, when the code bumped only the last
digit in the latest version, not the whole number after the last dot.

[1] https://github.com/osbuild/images/actions/runs/5995856979/job/16259501077

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
To every PR in the changelog we add a deduplicated and sorted list of
reviewers and the author of the change.

Fixes osbuild#21
All contributors, both authors and reviewers, are now part of the
changelog.
join expects str, so pass a string instead of None.
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

Successfully merging this pull request may close these issues.

4 participants