Skip to content

No way to use a multi-word git tag message? #166

@ruohola

Description

@ruohola

There doesn't seem to be any way to pass a --message that has multiple word to the Git tag command. For example this attempt:

  - name: "Commit changes"
    uses: EndBug/add-and-commit@v7
    with:
      add: 'CHANGELOG.md'
      message: 'Release 1.0.0'
      tag: "v1.0.0 --annotate --message 'Release 1.0.0'"

Fails with:

2021-04-13T10:51:08.1831581Z > Tagging commit...
2021-04-13T10:51:08.1889446Z ##[error]Error: fatal: Failed to resolve '1.0.0'' as a valid ref.

2021-04-13T10:51:08.1904561Z ##[error]Error: fatal: Failed to resolve '1.0.0'' as a valid ref.

2021-04-13T10:51:08.1908826Z > Pushing commit to repo...

and this:

 - name: "Commit changes"
    uses: EndBug/add-and-commit@v7
    with:
      add: 'CHANGELOG.md'
      message: 'Release 1.0.0'
      tag: 'v1.0.0 --annotate --message "Release 1.0.0"'

results in the tag message being literally "Release 1.0.0".

I tried all kinds of YAML quoting, but the problem is really this function:

export function matchGitArgs(string: string) {
return string.match(/(?:[^\s"]+|"[^"]*")+/g) || []
}

There is no way to pass arguments to that so that it would keep the Release 1.0.0 as one string with no extra quotes around it:

https://www.typescriptlang.org/play?ts=4.2.3#code/GYVwdgxgLglg9mABAWwIZQgCwOIygQQCcBzAZwApSpCYxiAuRKmugSkQG8AoRRQgUyghCSZrWIA6NBkzkA9OQD89ANoA9ADqkARAF0A1AB9t6vQCptrfXOLtDhxCt1cAvly4QEpOABt+EnzhicmksXAISCm0ANwBGCQAGRMQAWhTUMDA4KHR+VJTkflJSVGI8gHIAJX4-VFI8+KSE8stWAG4PL19-QODQnDwiMnJyuMTktIysnKg8tMLi0rztatr6xEbE7XLWds6wbz8AoJD0MMHI8hjNhPyp7Nz8hZKyxA0Vmv46hvGE99aOp4Dt1jn0zgMIsNRjc7pkHrMnkUXnkNFVPt8Nr9UTt2kA

Metadata

Metadata

Assignees

Labels

type: bugVerified problems that need to be worked on

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions