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: correct pattern examples #434

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ tags: |
```yaml
tags: |
# minimal
type=match,pattern=\d.\d.\d
type=match,"pattern=\\d+.\\d+.\\d+"
# define match group
type=match,pattern=v(.*),group=1
# use custom value instead of git tag
Expand All @@ -614,13 +614,13 @@ Can create a regular expression for matching Git tag with a pattern and
capturing group. Will be used on a [push tag event](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push)
but, you can also use a custom value through `value` attribute.

| Git tag | Pattern | Group | Output |
|-------------------------|------------------|---------|------------------------|
| `v1.2.3` | `\d.\d.\d` | `0` | `1.2.3` |
| `v2.0.8-beta.67` | `v(.*)` | `1` | `2.0.8-beta.67` |
| `v2.0.8-beta.67` | `v(\d.\d)` | `1` | `2.0` |
| `20200110-RC2` | `\d+` | `0` | `20200110` |
| `p1/v1.2.3` | `p1/v(\d.\d.\d)` | `1` | `1.2.3` |
| Git tag | Pattern | Group | Output |
|-------------------------|-----------------------------|---------|---------------|
| `v1.2.3` | `\\d+\\.\\d+\\.\\d+` | `0` | `1.2.3` |
| `v2.0.8-beta.67` | `v(.*)` | `1` | `2.0.8-beta.67` |
| `v2.0.8-beta.67` | `v(\\d+\\.\\d+\\.)` | `1` | `2.0` |
| `20200110-RC2` | `\d+?` | `0` | `20200110` |
| `p1/v1.2.3` | `p1\/v(\\d+\\.\\d+\\.\\d+)` | `1` | `1.2.3` |

Extended attributes and default values:

Expand Down Expand Up @@ -809,7 +809,7 @@ tags: |

#### `{{branch}}`

Returns the branch name that triggered the workflow run. Will be empty if not
Returns the branch name that triggered the workflow run. Will be empty if not
a branch reference:

| Event | Ref | Output |
Expand Down Expand Up @@ -847,11 +847,11 @@ workflow run. Will be empty for a branch reference:
| `push` | `refs/heads/my/branch` | |
| `push tag`* | `refs/tags/v1.2.3` | `master` |

> *`base_ref` is available in the push payload but doesn't always seem to
> *`base_ref` is available in the push payload but doesn't always seem to
> return the expected branch when the push tag event occurs. It's also
> [not documented in GitHub docs](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push).
> We keep it for backward compatibility, but it's **not recommended relying on it**.
> More context in [#192](https://github.com/docker/metadata-action/pull/192#discussion_r854673012).
> More context in [#192](https://github.com/docker/metadata-action/pull/192#discussion_r854673012).

#### `{{is_default_branch}}`

Expand Down
4 changes: 2 additions & 2 deletions __tests__/fixtures/event_release_created.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=
GITHUB_JOB=test
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_82c844c7-54b3-4b5d-a1e1-4f9f2e936d4f
GITHUB_REF=refs/tags/v1.1.1
GITHUB_REF_NAME=v1.1.1
GITHUB_REF=refs/tags/v101.12.13
GITHUB_REF_NAME=v101.12.13
GITHUB_REF_PROTECTED=false
GITHUB_REF_TYPE=tag
GITHUB_REPOSITORY=docker/test-docker-action
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ GITHUB_API_URL=https://api.github.com
GITHUB_BASE_REF=
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_7703d3cb-84db-438f-9f97-46e159388a55
GITHUB_EVENT_NAME=push
GITHUB_EVENT_PATH=./__tests__/fixtures/event_tag_v1.1.1.json
GITHUB_EVENT_PATH=./__tests__/fixtures/event_tag_v101.12.13.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=
GITHUB_JOB=test
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_7703d3cb-84db-438f-9f97-46e159388a55
GITHUB_REF=refs/tags/v1.1.1
GITHUB_REF_NAME=v1.1.1
GITHUB_REF=refs/tags/v101.12.13
GITHUB_REF_NAME=v101.12.13
GITHUB_REF_PROTECTED=false
GITHUB_REF_TYPE=tag
GITHUB_REPOSITORY=docker/test-docker-action
Expand Down
Loading