anton-yurchenko/git-release

malformed env.var 'GITHUB_REF' (control tag prefix via env.var 'ALLOW_TAG_PREFIX'): expected to match regex

Asim-Tahir opened this issue · 2 comments

Description

I found the error came from. But I don't understand. Am I broke semver or keepachangelog. This is the repository.

return errors.New(fmt.Sprintf("malformed env.var 'GITHUB_REF' (control tag prefix via env.var 'ALLOW_TAG_PREFIX'): expected to match regex '%s', got '%v'", expression, o))

Tag

Tried both V1.0.0 and V1.0

Workflow

name: release

on:
  push:
    branches:
    - main
    tags:
    - 'v*'

env:
  ACTION_NAME: release-please-action

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Release
      uses: docker://antonyurchenko/git-release:latest
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        ALLOW_TAG_PREFIX: "false"
        CHANGELOG_FILE: "CHANGELOG.md"
        ALLOW_EMPTY_CHANGELOG: "false"
        PRE_RELEASE: "true"
      with:
        args: build/*.zip

Changelog

# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
And this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0] - 2021-03-29

### Added

- Heroku one click deploy button.
- Both support `praw.ini` and `environment variables`(for heroku).

Log

Run docker://antonyurchenko/git-release:latest
  with:
    args: build/*.zip
  env:
    ACTION_NAME: release-please-action
    GITHUB_TOKEN: ***
    ALLOW_TAG_PREFIX: false
    CHANGELOG_FILE: CHANGELOG.md
    ALLOW_EMPTY_CHANGELOG: false
    PRE_RELEASE: true
/usr/bin/docker run --name antonyurchenkogitreleaselatest_ed83d7 --label 5588e4 --workdir /github/workspace --rm -e ACTION_NAME -e GITHUB_TOKEN -e ALLOW_TAG_PREFIX -e CHANGELOG_FILE -e ALLOW_EMPTY_CHANGELOG -e PRE_RELEASE -e INPUT_ARGS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/FloooDBot/FloooDBot":"/github/workspace" antonyurchenko/git-release:latest build/*.zip
INFO 'git-release' version: 3.4.4                 
WARNING 'DRAFT_RELEASE' is not equal to 'true', assuming 'false' 
FATAL malformed env.var 'GITHUB_REF' (control tag prefix via env.var 'ALLOW_TAG_PREFIX'): expected to match regex '^refs/tags/(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:(?P<sep1>-)(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:(?P<sep2>\+)(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$', got 'refs/heads/main' 

I am replaced tag with v1.0.0 and enabled ALLOW_TAG_PREFIX. Its works.

Hello @Asim-Tahir, I believe your issue is with a workflow trigger.
git-release is expected to be placed in a workflow that is being triggered by a new tag and not a commit, so just remove the branches section:

on:
  push:
    tags:
    - 'v*'

The difference is that in the case of a commit GITHUB_REF is refs/heads/main, and in the case of a tag it will be refs/tags/v1.0.0.

ALLOW_TAG_PREFIX is required if your git tag is not a plain semver, which does not include the v prefix by default.

Do not hesitate to re-open this issue if the problem persists.