Skip to content

Allow defining a default tag #18

@christian-kreuzberger-dtx

Description

I'm using your action in a template-repo, and when somebody uses the template, the first CI run will fail with

Could not find any tags because: 
fatal: No names found, cannot describe anything.

Your action is correct. There are no tags, it's a new repo :D
The obvious workaround is to create a tag, e.g., 0.0.1.

However, I would like to propose that we can specify a default tag, e.g., 0.0.1, like this:

      - name: 'Get Previous tag'
        id: get_previous_tag
        uses: "WyriHaximus/github-action-get-previous-tag@v1.0.1"
        with:
          defaultTag: "0.0.1"
      - name: 'Get next patch version'
        id: get_next_semver_tag
        uses: "WyriHaximus/github-action-next-semvers@v1.1"
        with:
          version: ${{ steps.get_previous_tag.outputs.tag }}

This would require a code change here:

exec(`git describe --tags ${rev}`, (err, tag, stderr) => {
if (err) {
console.log('\x1b[33m%s\x1b[0m', 'Could not find any tags because: ');
console.log('\x1b[31m%s\x1b[0m', stderr);
process.exit(1);
}

To respond with

            console.log(`::set-output name=tag::${tag}`);
            console.log(`::set-output name=timestamp::${timestamp}`);

instead of

            process.exit(1);

if a default tag is set. The timestamp, in this case, could just be set to the current time.

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