Skip to content

Feature - CREATE_INITIAL_VERSION #344

@Jared-Hinze

Description

@Jared-Hinze

Hello,

I may be missing something obvious, but I believe I've noticed when beginning with a brand new repo that has no pre-existing tags that this github action fails to create the INITIAL_VERSION specified as a tag of its own. Instead, it creates the next tag version after the INITIAL_VERSION. I think it would be nice to allow users to create that specified tag to reduce extra code in workflows to check and do these things through other actions or scripts.

Given a new repository with no branches and an action configured simply as:

- name: AutoTagger
  id: tagger
  uses: anothrNick/github-tag-action@1.73.0
  env:
    INITIAL_VERSION: "1.0.0"
    TAG_PREFIX: v

your current code on line 136...

tag_commit=$(git rev-list -n 1 "$tag" || true )

...will produce the following error...

fatal: ambiguous argument 'v1.0.0': unknown revision or path not in the working tree.

...yet I will still get this v1.1.0 tag...

Bumping tag v1.0.0 - New tag v1.1.0
EVENT: creating local tag v1.1.0
EVENT: pushing tag v1.1.0 to origin

I believe this would be the ideal location to create the $tag...

#pseudo-ish code
create_initial_version=${CREATE_INITIAL_VERSION:-true}
...
tag_commit=$(git rev-list -n 1 "$tag" || true )
if [ $? -ne 0 ] && create_initial_version && !dryrun
then
    <create and push $tag>
    exit 0
fi

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions