Compare commits

...

36 Commits

Author SHA1 Message Date
CrazyMax
a2e02890a0 Merge pull request #153 from crazy-max/preserve-quotes
Preserve quotes inside unquoted field
2021-11-29 14:23:16 +01:00
CrazyMax
59e3d70a23 Preserve quotes inside unquoted field
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-11-29 13:31:50 +01:00
CrazyMax
5220b23112 Merge pull request #146 from crazy-max/update-workflow
dev: update workflow
2021-11-16 21:53:37 +01:00
CrazyMax
8d0937e440 dev: update workflow
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-11-16 21:51:23 +01:00
CrazyMax
548e2346a9 Merge pull request #143 from crazy-max/trim-val
Trim tags and flavor inputs
2021-10-23 03:53:44 +02:00
CrazyMax
b69dce7fed Trim tags and flavor inputs
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-10-22 13:50:33 +02:00
CrazyMax
110426b173 Merge pull request #142 from crazy-max/baseref-global-expr
`base_ref` global expression
2021-10-22 13:17:22 +02:00
CrazyMax
09666f941b base_ref global expression
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-10-22 13:14:53 +02:00
CrazyMax
a287d15e54 Merge pull request #136 from corburn/corburn-patch-1
docs: add README pep440 anchor to list of types
2021-10-04 13:22:39 +02:00
CrazyMax
7e983ea6f6 Merge pull request #135 from docker/dependabot/npm_and_yarn/actions/core-1.6.0
Bump @actions/core from 1.5.0 to 1.6.0
2021-10-04 13:21:38 +02:00
CrazyMax
4f95a04c21 Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-10-04 13:19:25 +02:00
Jason Travis
48b55c14a8 docs: add README pep440 anchor to list of types
Signed-off-by: Jason Travis <JasonTravis@nau.edu>
2021-10-03 09:24:47 -07:00
dependabot[bot]
b1925560ed Bump @actions/core from 1.5.0 to 1.6.0
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-28 19:10:43 +00:00
CrazyMax
09dffb9c1c Merge pull request #134 from docker/dependabot/npm_and_yarn/ansi-regex-5.0.1
Bump ansi-regex from 5.0.0 to 5.0.1
2021-09-24 14:52:16 +02:00
CrazyMax
2d7c9d2045 Merge pull request #133 from venkytv/master
Fix README
2021-09-24 14:05:47 +02:00
dependabot[bot]
c4edafbb78 Bump ansi-regex from 5.0.0 to 5.0.1
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](https://github.com/chalk/ansi-regex/compare/v5.0.0...v5.0.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-24 12:04:57 +00:00
CrazyMax
931213b773 Merge pull request #132 from docker/dependabot/npm_and_yarn/tmpl-1.0.5
Bump tmpl from 1.0.4 to 1.0.5
2021-09-24 14:04:27 +02:00
Venky
be7d35970b Fix README
Signed-off-by: Venky <718613+venkytv@users.noreply.github.com>
2021-09-23 13:21:11 +02:00
dependabot[bot]
70fc13ca64 Bump tmpl from 1.0.4 to 1.0.5
Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5.
- [Release notes](https://github.com/daaku/nodejs-tmpl/releases)
- [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5)

---
updated-dependencies:
- dependency-name: tmpl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-22 03:20:59 +00:00
CrazyMax
6d43bfb301 Merge pull request #131 from docker/dependabot/npm_and_yarn/csv-parse-4.16.3
Bump csv-parse from 4.16.0 to 4.16.3
2021-09-03 13:51:18 +02:00
CrazyMax
59b75ee1a1 Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-09-03 13:47:44 +02:00
dependabot[bot]
c729e26a57 Bump csv-parse from 4.16.0 to 4.16.3
Bumps [csv-parse](https://github.com/wdavidw/node-csv-parse) from 4.16.0 to 4.16.3.
- [Release notes](https://github.com/wdavidw/node-csv-parse/releases)
- [Commits](https://github.com/wdavidw/node-csv-parse/commits)

---
updated-dependencies:
- dependency-name: csv-parse
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-03 11:36:50 +00:00
CrazyMax
f595d60eab Merge pull request #130 from crazy-max/fix-dep-labels
Fix dependabot labels
2021-09-03 13:35:25 +02:00
CrazyMax
22924852dc Fix dependabot labels
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-09-03 13:33:29 +02:00
CrazyMax
3a3bb3a817 Merge pull request #122 from docker/dependabot/npm_and_yarn/actions/core-1.5.0
Bump @actions/core from 1.4.0 to 1.5.0
2021-08-19 21:21:19 +02:00
CrazyMax
6200091c0f Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-08-19 21:19:13 +02:00
dependabot[bot]
d26b8cd003 Bump @actions/core from 1.4.0 to 1.5.0
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-19 19:11:48 +00:00
CrazyMax
03cec7cbca Merge pull request #121 from crazy-max/data-expr
Add global expression "date"
2021-08-19 20:05:40 +02:00
CrazyMax
e4f548552d Add global expression "date"
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-08-19 19:58:15 +02:00
CrazyMax
a67f45cb0f Merge pull request #119 from theo-brown/patch-1
Update README
2021-08-03 02:14:19 +02:00
Theo Brown
66b9054417 Update README (Issue #116)
Signed-off-by: Theo Brown <7982453+theo-brown@users.noreply.github.com>
2021-08-02 21:19:26 +01:00
CrazyMax
b127c18eb4 Merge pull request #117 from docker/dependabot/github_actions/codecov/codecov-action-2.0.1
Bump codecov/codecov-action from 1 to 2.0.1
2021-07-23 12:57:35 +02:00
CrazyMax
401bfc308e Use major
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-07-23 12:56:00 +02:00
dependabot[bot]
ad2fba2495 Bump codecov/codecov-action from 1 to 2.0.1
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 1 to 2.0.1.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v1...v2.0.1)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-19 19:12:26 +00:00
CrazyMax
8b842e721d Merge pull request #115 from crazy-max/edge-branch
Only return edge if branch matches
2021-07-15 00:34:54 +02:00
CrazyMax
4cb9252fa6 Only return edge if branch matches
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-07-12 17:08:07 +02:00
24 changed files with 1340 additions and 169 deletions

1
.gitattributes vendored
View File

@@ -1,2 +1,3 @@
/__tests__/fixtures/** -linguist-detectable
/dist/** linguist-generated=true /dist/** linguist-generated=true
/lib/** linguist-generated=true /lib/** linguist-generated=true

View File

@@ -5,8 +5,8 @@ updates:
schedule: schedule:
interval: "daily" interval: "daily"
labels: labels:
- ":game_die: dependencies" - "dependencies"
- ":robot: bot" - "bot"
- package-ecosystem: "npm" - package-ecosystem: "npm"
directory: "/" directory: "/"
schedule: schedule:
@@ -14,5 +14,5 @@ updates:
allow: allow:
- dependency-type: "production" - dependency-type: "production"
labels: labels:
- ":game_die: dependencies" - "dependencies"
- ":robot: bot" - "bot"

View File

@@ -162,7 +162,7 @@ jobs:
labels: | labels: |
maintainer=CrazyMax maintainer=CrazyMax
org.opencontainers.image.title=MyCustomTitle org.opencontainers.image.title=MyCustomTitle
org.opencontainers.image.description=Another description org.opencontainers.image.description=this is a "good" example
org.opencontainers.image.vendor=MyCompany org.opencontainers.image.vendor=MyCompany
json: json:

View File

@@ -29,6 +29,6 @@ jobs:
targets: test targets: test
- -
name: Upload coverage name: Upload coverage
uses: codecov/codecov-action@v1 uses: codecov/codecov-action@v2
with: with:
file: ./coverage/clover.xml file: ./coverage/clover.xml

View File

@@ -5,8 +5,8 @@
## About ## About
GitHub Action to extract metadata (tags, labels) for Docker. This action is particularly useful if used with GitHub Action to extract metadata from Git reference and GitHub events.
[Docker Build Push](https://github.com/docker/build-push-action) action. This action is particularly useful if used with [Docker Build Push](https://github.com/docker/build-push-action) action to tag and label Docker images.
![Screenshot](.github/metadata-action.png) ![Screenshot](.github/metadata-action.png)
@@ -297,8 +297,8 @@ flavor: |
``` ```
* `latest=<auto|true|false>`: Handle [latest tag](#latest-tag) (default `auto`) * `latest=<auto|true|false>`: Handle [latest tag](#latest-tag) (default `auto`)
* `prefix=<string>,onlatest=<true|false>`: A global prefix for each generated tag and optionnally for `latest` * `prefix=<string>,onlatest=<true|false>`: A global prefix for each generated tag and optionally for `latest`
* `suffix=<string>,onlatest=<true|false>`: A global suffix for each generated tag and optionnally for `latest` * `suffix=<string>,onlatest=<true|false>`: A global suffix for each generated tag and optionally for `latest`
## `tags` input ## `tags` input
@@ -309,11 +309,11 @@ the form of a key-value pair list in CSV format to remove limitations intrinsica
```yaml ```yaml
tags: | tags: |
type=schedule type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}} type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}} type=semver,pattern={{major}}
type=ref,event=branch
type=ref,event=pr
type=sha type=sha
``` ```
@@ -321,6 +321,7 @@ Each entry is defined by a `type`, which are:
* [`type=schedule`](#typeschedule) * [`type=schedule`](#typeschedule)
* [`type=semver`](#typesemver) * [`type=semver`](#typesemver)
* [`type=pep440`](#typepep440)
* [`type=match`](#typematch) * [`type=match`](#typematch)
* [`type=edge`](#typeedge) * [`type=edge`](#typeedge)
* [`type=ref`](#typeref) * [`type=ref`](#typeref)
@@ -544,11 +545,11 @@ Extended attributes and default values:
```yaml ```yaml
tags: | tags: |
# branch event # branch event
type=ref,enable=true,priority=600,prefix=,suffix=,event= type=ref,enable=true,priority=600,prefix=,suffix=,event=branch
# tag event # tag event
type=ref,enable=true,priority=600,prefix=,suffix=,event= type=ref,enable=true,priority=600,prefix=,suffix=,event=tag
# pull request event # pull request event
type=ref,enable=true,priority=600,prefix=pr-,suffix=,event= type=ref,enable=true,priority=600,prefix=pr-,suffix=,event=pr
``` ```
### `type=raw` ### `type=raw`
@@ -612,6 +613,8 @@ attributes are available:
| `{{branch}}` | `master` | | `{{branch}}` | `master` |
| `{{tag}}` | `v1.2.3` | | `{{tag}}` | `v1.2.3` |
| `{{sha}}` | `90dd603` | | `{{sha}}` | `90dd603` |
| `{{base_ref}}` | `master` |
| `{{date 'YYYYMMDD'}}` | `20210326` |
```yaml ```yaml
tags: | tags: |
@@ -643,7 +646,7 @@ tags: |
### JSON output object ### JSON output object
The `json` output is a JSON object composed of the generated tags and labels so that you can reuse them further in your The `json` output is a JSON object composed of the generated tags and labels so that you can reuse them further in your
workflow using the [`fromJSON` function](https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#fromjson): workflow using the [`fromJSON` function](https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson):
```yaml ```yaml
- -

View File

@@ -6,7 +6,7 @@ GITHUB_API_URL=https://api.github.com
GITHUB_BASE_REF=master GITHUB_BASE_REF=master
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_e00a951d-2585-4fac-b085-459d80e69a2f GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_e00a951d-2585-4fac-b085-459d80e69a2f
GITHUB_EVENT_NAME=pull_request GITHUB_EVENT_NAME=pull_request
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json GITHUB_EVENT_PATH=./__tests__/fixtures/event_pull_request.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=pr GITHUB_HEAD_REF=pr
GITHUB_JOB=event GITHUB_JOB=event

View File

@@ -0,0 +1,488 @@
{
"action": "opened",
"number": 7,
"pull_request": {
"_links": {
"comments": {
"href": "https://api.github.com/repos/crazy-max/test-docker-action/issues/7/comments"
},
"commits": {
"href": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/7/commits"
},
"html": {
"href": "https://github.com/crazy-max/test-docker-action/pull/7"
},
"issue": {
"href": "https://api.github.com/repos/crazy-max/test-docker-action/issues/7"
},
"review_comment": {
"href": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/comments{/number}"
},
"review_comments": {
"href": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/7/comments"
},
"self": {
"href": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/7"
},
"statuses": {
"href": "https://api.github.com/repos/crazy-max/test-docker-action/statuses/0337b3a374a0b833cf127b9111ca8c5589d93616"
}
},
"active_lock_reason": null,
"additions": 0,
"assignee": null,
"assignees": [],
"author_association": "COLLABORATOR",
"auto_merge": null,
"base": {
"label": "docker:master",
"ref": "master",
"repo": {
"allow_auto_merge": false,
"allow_forking": true,
"allow_merge_commit": true,
"allow_rebase_merge": true,
"allow_squash_merge": true,
"archive_url": "https://api.github.com/repos/crazy-max/test-docker-action/{archive_format}{/ref}",
"archived": false,
"assignees_url": "https://api.github.com/repos/crazy-max/test-docker-action/assignees{/user}",
"blobs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/crazy-max/test-docker-action/branches{/branch}",
"clone_url": "https://github.com/crazy-max/test-docker-action.git",
"collaborators_url": "https://api.github.com/repos/crazy-max/test-docker-action/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/comments{/number}",
"commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/commits{/sha}",
"compare_url": "https://api.github.com/repos/crazy-max/test-docker-action/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/crazy-max/test-docker-action/contents/{+path}",
"contributors_url": "https://api.github.com/repos/crazy-max/test-docker-action/contributors",
"created_at": "2020-08-07T09:23:00Z",
"default_branch": "master",
"delete_branch_on_merge": false,
"deployments_url": "https://api.github.com/repos/crazy-max/test-docker-action/deployments",
"description": "Test \"Docker\" Actions",
"disabled": false,
"downloads_url": "https://api.github.com/repos/crazy-max/test-docker-action/downloads",
"events_url": "https://api.github.com/repos/crazy-max/test-docker-action/events",
"fork": false,
"forks": 1,
"forks_count": 1,
"forks_url": "https://api.github.com/repos/crazy-max/test-docker-action/forks",
"full_name": "docker/test-docker-action",
"git_commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/tags{/sha}",
"git_url": "git://github.com/crazy-max/test-docker-action.git",
"has_downloads": true,
"has_issues": false,
"has_pages": false,
"has_projects": false,
"has_wiki": false,
"homepage": "",
"hooks_url": "https://api.github.com/repos/crazy-max/test-docker-action/hooks",
"html_url": "https://github.com/crazy-max/test-docker-action",
"id": 285789493,
"is_template": false,
"issue_comment_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/events{/number}",
"issues_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues{/number}",
"keys_url": "https://api.github.com/repos/crazy-max/test-docker-action/keys{/key_id}",
"labels_url": "https://api.github.com/repos/crazy-max/test-docker-action/labels{/name}",
"language": "JavaScript",
"languages_url": "https://api.github.com/repos/crazy-max/test-docker-action/languages",
"license": {
"key": "mit",
"name": "MIT License",
"node_id": "MDc6TGljZW5zZTEz",
"spdx_id": "MIT",
"url": "https://api.github.com/licenses/mit"
},
"merges_url": "https://api.github.com/repos/crazy-max/test-docker-action/merges",
"milestones_url": "https://api.github.com/repos/crazy-max/test-docker-action/milestones{/number}",
"mirror_url": null,
"name": "test-docker-action",
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
"notifications_url": "https://api.github.com/repos/crazy-max/test-docker-action/notifications{?since,all,participating}",
"open_issues": 5,
"open_issues_count": 5,
"owner": {
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
"followers_url": "https://api.github.com/users/crazy-max/followers",
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/crazy-max",
"id": 5429470,
"login": "docker",
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
"organizations_url": "https://api.github.com/users/crazy-max/users",
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
"repos_url": "https://api.github.com/users/crazy-max/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
"type": "Organization",
"url": "https://api.github.com/users/crazy-max"
},
"private": true,
"pulls_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls{/number}",
"pushed_at": "2021-10-21T21:44:34Z",
"releases_url": "https://api.github.com/repos/crazy-max/test-docker-action/releases{/id}",
"size": 714,
"ssh_url": "git@github.com:docker/test-docker-action.git",
"stargazers_count": 0,
"stargazers_url": "https://api.github.com/repos/crazy-max/test-docker-action/stargazers",
"statuses_url": "https://api.github.com/repos/crazy-max/test-docker-action/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscribers",
"subscription_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscription",
"svn_url": "https://github.com/crazy-max/test-docker-action",
"tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/tags",
"teams_url": "https://api.github.com/repos/crazy-max/test-docker-action/teams",
"topics": [],
"trees_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/trees{/sha}",
"updated_at": "2021-10-21T21:44:37Z",
"url": "https://api.github.com/repos/crazy-max/test-docker-action",
"visibility": "private",
"watchers": 0,
"watchers_count": 0
},
"sha": "ce1a91a20f9e2c064bcd76a7b95e091f831cf653",
"user": {
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
"followers_url": "https://api.github.com/users/crazy-max/followers",
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/crazy-max",
"id": 5429470,
"login": "docker",
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
"organizations_url": "https://api.github.com/users/crazy-max/users",
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
"repos_url": "https://api.github.com/users/crazy-max/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
"type": "Organization",
"url": "https://api.github.com/users/crazy-max"
}
},
"body": null,
"changed_files": 0,
"closed_at": null,
"comments": 0,
"comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/7/comments",
"commits": 1,
"commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/7/commits",
"created_at": "2021-10-21T21:46:27Z",
"deletions": 0,
"diff_url": "https://github.com/crazy-max/test-docker-action/pull/7.diff",
"draft": false,
"head": {
"label": "crazy-max:test-pr",
"ref": "test-pr",
"repo": {
"allow_auto_merge": false,
"allow_forking": true,
"allow_merge_commit": true,
"allow_rebase_merge": true,
"allow_squash_merge": true,
"archive_url": "https://api.github.com/repos/crazy-max/test-docker-action/{archive_format}{/ref}",
"archived": false,
"assignees_url": "https://api.github.com/repos/crazy-max/test-docker-action/assignees{/user}",
"blobs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/crazy-max/test-docker-action/branches{/branch}",
"clone_url": "https://github.com/crazy-max/test-docker-action.git",
"collaborators_url": "https://api.github.com/repos/crazy-max/test-docker-action/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/comments{/number}",
"commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/commits{/sha}",
"compare_url": "https://api.github.com/repos/crazy-max/test-docker-action/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/crazy-max/test-docker-action/contents/{+path}",
"contributors_url": "https://api.github.com/repos/crazy-max/test-docker-action/contributors",
"created_at": "2021-07-11T17:34:22Z",
"default_branch": "master",
"delete_branch_on_merge": false,
"deployments_url": "https://api.github.com/repos/crazy-max/test-docker-action/deployments",
"description": "Test \"Docker\" Actions",
"disabled": false,
"downloads_url": "https://api.github.com/repos/crazy-max/test-docker-action/downloads",
"events_url": "https://api.github.com/repos/crazy-max/test-docker-action/events",
"fork": true,
"forks": 0,
"forks_count": 0,
"forks_url": "https://api.github.com/repos/crazy-max/test-docker-action/forks",
"full_name": "crazy-max/test-docker-action",
"git_commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/tags{/sha}",
"git_url": "git://github.com/crazy-max/test-docker-action.git",
"has_downloads": true,
"has_issues": false,
"has_pages": false,
"has_projects": true,
"has_wiki": false,
"homepage": "",
"hooks_url": "https://api.github.com/repos/crazy-max/test-docker-action/hooks",
"html_url": "https://github.com/crazy-max/test-docker-action",
"id": 385013169,
"is_template": false,
"issue_comment_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/events{/number}",
"issues_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues{/number}",
"keys_url": "https://api.github.com/repos/crazy-max/test-docker-action/keys{/key_id}",
"labels_url": "https://api.github.com/repos/crazy-max/test-docker-action/labels{/name}",
"language": "Dockerfile",
"languages_url": "https://api.github.com/repos/crazy-max/test-docker-action/languages",
"license": {
"key": "mit",
"name": "MIT License",
"node_id": "MDc6TGljZW5zZTEz",
"spdx_id": "MIT",
"url": "https://api.github.com/licenses/mit"
},
"merges_url": "https://api.github.com/repos/crazy-max/test-docker-action/merges",
"milestones_url": "https://api.github.com/repos/crazy-max/test-docker-action/milestones{/number}",
"mirror_url": null,
"name": "test-docker-action",
"node_id": "MDEwOlJlcG9zaXRvcnkzODUwMTMxNjk=",
"notifications_url": "https://api.github.com/repos/crazy-max/test-docker-action/notifications{?since,all,participating}",
"open_issues": 0,
"open_issues_count": 0,
"owner": {
"avatar_url": "https://avatars.githubusercontent.com/u/1951866?v=4",
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
"followers_url": "https://api.github.com/users/crazy-max/followers",
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/crazy-max",
"id": 1951866,
"login": "crazy-max",
"node_id": "MDQ6VXNlcjE5NTE4NjY=",
"organizations_url": "https://api.github.com/users/crazy-max/users",
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
"repos_url": "https://api.github.com/users/crazy-max/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
"type": "User",
"url": "https://api.github.com/users/crazy-max"
},
"private": true,
"pulls_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls{/number}",
"pushed_at": "2021-10-21T21:46:11Z",
"releases_url": "https://api.github.com/repos/crazy-max/test-docker-action/releases{/id}",
"size": 151,
"ssh_url": "git@github.com:crazy-max/test-docker-action.git",
"stargazers_count": 0,
"stargazers_url": "https://api.github.com/repos/crazy-max/test-docker-action/stargazers",
"statuses_url": "https://api.github.com/repos/crazy-max/test-docker-action/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscribers",
"subscription_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscription",
"svn_url": "https://github.com/crazy-max/test-docker-action",
"tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/tags",
"teams_url": "https://api.github.com/repos/crazy-max/test-docker-action/teams",
"topics": [],
"trees_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/trees{/sha}",
"updated_at": "2021-07-15T07:56:00Z",
"url": "https://api.github.com/repos/crazy-max/test-docker-action",
"visibility": "private",
"watchers": 0,
"watchers_count": 0
},
"sha": "0337b3a374a0b833cf127b9111ca8c5589d93616",
"user": {
"avatar_url": "https://avatars.githubusercontent.com/u/1951866?v=4",
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
"followers_url": "https://api.github.com/users/crazy-max/followers",
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/crazy-max",
"id": 1951866,
"login": "crazy-max",
"node_id": "MDQ6VXNlcjE5NTE4NjY=",
"organizations_url": "https://api.github.com/users/crazy-max/users",
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
"repos_url": "https://api.github.com/users/crazy-max/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
"type": "User",
"url": "https://api.github.com/users/crazy-max"
}
},
"html_url": "https://github.com/crazy-max/test-docker-action/pull/7",
"id": 763682530,
"issue_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/7",
"labels": [],
"locked": false,
"maintainer_can_modify": true,
"merge_commit_sha": null,
"mergeable": null,
"mergeable_state": "unknown",
"merged": false,
"merged_at": null,
"merged_by": null,
"milestone": null,
"node_id": "PR_kwDOEQjNNc4thN7i",
"number": 7,
"patch_url": "https://github.com/crazy-max/test-docker-action/pull/7.patch",
"rebaseable": null,
"requested_reviewers": [],
"requested_teams": [],
"review_comment_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/comments{/number}",
"review_comments": 0,
"review_comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/7/comments",
"state": "open",
"statuses_url": "https://api.github.com/repos/crazy-max/test-docker-action/statuses/0337b3a374a0b833cf127b9111ca8c5589d93616",
"title": "Trigger notification",
"updated_at": "2021-10-21T21:46:27Z",
"url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/7",
"user": {
"avatar_url": "https://avatars.githubusercontent.com/u/1951866?v=4",
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
"followers_url": "https://api.github.com/users/crazy-max/followers",
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/crazy-max",
"id": 1951866,
"login": "crazy-max",
"node_id": "MDQ6VXNlcjE5NTE4NjY=",
"organizations_url": "https://api.github.com/users/crazy-max/users",
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
"repos_url": "https://api.github.com/users/crazy-max/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
"type": "User",
"url": "https://api.github.com/users/crazy-max"
}
},
"repository": {
"allow_forking": true,
"archive_url": "https://api.github.com/repos/crazy-max/test-docker-action/{archive_format}{/ref}",
"archived": false,
"assignees_url": "https://api.github.com/repos/crazy-max/test-docker-action/assignees{/user}",
"blobs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/crazy-max/test-docker-action/branches{/branch}",
"clone_url": "https://github.com/crazy-max/test-docker-action.git",
"collaborators_url": "https://api.github.com/repos/crazy-max/test-docker-action/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/comments{/number}",
"commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/commits{/sha}",
"compare_url": "https://api.github.com/repos/crazy-max/test-docker-action/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/crazy-max/test-docker-action/contents/{+path}",
"contributors_url": "https://api.github.com/repos/crazy-max/test-docker-action/contributors",
"created_at": "2020-08-07T09:23:00Z",
"default_branch": "master",
"deployments_url": "https://api.github.com/repos/crazy-max/test-docker-action/deployments",
"description": "Test \"Docker\" Actions",
"disabled": false,
"downloads_url": "https://api.github.com/repos/crazy-max/test-docker-action/downloads",
"events_url": "https://api.github.com/repos/crazy-max/test-docker-action/events",
"fork": false,
"forks": 1,
"forks_count": 1,
"forks_url": "https://api.github.com/repos/crazy-max/test-docker-action/forks",
"full_name": "docker/test-docker-action",
"git_commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/tags{/sha}",
"git_url": "git://github.com/crazy-max/test-docker-action.git",
"has_downloads": true,
"has_issues": false,
"has_pages": false,
"has_projects": false,
"has_wiki": false,
"homepage": "",
"hooks_url": "https://api.github.com/repos/crazy-max/test-docker-action/hooks",
"html_url": "https://github.com/crazy-max/test-docker-action",
"id": 285789493,
"is_template": false,
"issue_comment_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/events{/number}",
"issues_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues{/number}",
"keys_url": "https://api.github.com/repos/crazy-max/test-docker-action/keys{/key_id}",
"labels_url": "https://api.github.com/repos/crazy-max/test-docker-action/labels{/name}",
"language": "JavaScript",
"languages_url": "https://api.github.com/repos/crazy-max/test-docker-action/languages",
"license": {
"key": "mit",
"name": "MIT License",
"node_id": "MDc6TGljZW5zZTEz",
"spdx_id": "MIT",
"url": "https://api.github.com/licenses/mit"
},
"merges_url": "https://api.github.com/repos/crazy-max/test-docker-action/merges",
"milestones_url": "https://api.github.com/repos/crazy-max/test-docker-action/milestones{/number}",
"mirror_url": null,
"name": "test-docker-action",
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
"notifications_url": "https://api.github.com/repos/crazy-max/test-docker-action/notifications{?since,all,participating}",
"open_issues": 5,
"open_issues_count": 5,
"owner": {
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
"followers_url": "https://api.github.com/users/crazy-max/followers",
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/crazy-max",
"id": 5429470,
"login": "docker",
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
"organizations_url": "https://api.github.com/users/crazy-max/users",
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
"repos_url": "https://api.github.com/users/crazy-max/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
"type": "Organization",
"url": "https://api.github.com/users/crazy-max"
},
"private": true,
"pulls_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls{/number}",
"pushed_at": "2021-10-21T21:44:34Z",
"releases_url": "https://api.github.com/repos/crazy-max/test-docker-action/releases{/id}",
"size": 714,
"ssh_url": "git@github.com:docker/test-docker-action.git",
"stargazers_count": 0,
"stargazers_url": "https://api.github.com/repos/crazy-max/test-docker-action/stargazers",
"statuses_url": "https://api.github.com/repos/crazy-max/test-docker-action/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscribers",
"subscription_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscription",
"svn_url": "https://github.com/crazy-max/test-docker-action",
"tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/tags",
"teams_url": "https://api.github.com/repos/crazy-max/test-docker-action/teams",
"topics": [],
"trees_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/trees{/sha}",
"updated_at": "2021-10-21T21:44:37Z",
"url": "https://api.github.com/repos/crazy-max/test-docker-action",
"visibility": "private",
"watchers": 0,
"watchers_count": 0
},
"sender": {
"avatar_url": "https://avatars.githubusercontent.com/u/1951866?v=4",
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
"followers_url": "https://api.github.com/users/crazy-max/followers",
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/crazy-max",
"id": 1951866,
"login": "crazy-max",
"node_id": "MDQ6VXNlcjE5NTE4NjY=",
"organizations_url": "https://api.github.com/users/crazy-max/users",
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
"repos_url": "https://api.github.com/users/crazy-max/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
"type": "User",
"url": "https://api.github.com/users/crazy-max"
}
}

View File

@@ -6,7 +6,7 @@ GITHUB_API_URL=https://api.github.com
GITHUB_BASE_REF= GITHUB_BASE_REF=
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_89a016e8-e5b7-4039-a67e-c8da08f87a0c GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_89a016e8-e5b7-4039-a67e-c8da08f87a0c
GITHUB_EVENT_NAME=push GITHUB_EVENT_NAME=push
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json GITHUB_EVENT_PATH=./__tests__/fixtures/event_push.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF= GITHUB_HEAD_REF=
GITHUB_JOB=event GITHUB_JOB=event

View File

@@ -0,0 +1,181 @@
{
"after": "ce1a91a20f9e2c064bcd76a7b95e091f831cf653",
"base_ref": null,
"before": "b0d66d13d5e8c795e0fc4b6c732b6b521807eca7",
"commits": [
{
"author": {
"email": "crazy-max@users.noreply.github.com",
"name": "CrazyMax",
"username": "crazy-max"
},
"committer": {
"email": "crazy-max@users.noreply.github.com",
"name": "CrazyMax",
"username": "crazy-max"
},
"distinct": true,
"id": "ce1a91a20f9e2c064bcd76a7b95e091f831cf653",
"message": "Fix workflow",
"timestamp": "2021-10-21T23:44:33+02:00",
"tree_id": "8e46bf0c7fd95050deb02b11f0bc8c475c7428f3",
"url": "https://github.com/crazy-max/test-docker-action/commit/ce1a91a20f9e2c064bcd76a7b95e091f831cf653"
}
],
"compare": "https://github.com/crazy-max/test-docker-action/compare/b0d66d13d5e8...ce1a91a20f9e",
"created": false,
"deleted": false,
"forced": false,
"head_commit": {
"author": {
"email": "crazy-max@users.noreply.github.com",
"name": "CrazyMax",
"username": "crazy-max"
},
"committer": {
"email": "crazy-max@users.noreply.github.com",
"name": "CrazyMax",
"username": "crazy-max"
},
"distinct": true,
"id": "ce1a91a20f9e2c064bcd76a7b95e091f831cf653",
"message": "Fix workflow",
"timestamp": "2021-10-21T23:44:33+02:00",
"tree_id": "8e46bf0c7fd95050deb02b11f0bc8c475c7428f3",
"url": "https://github.com/crazy-max/test-docker-action/commit/ce1a91a20f9e2c064bcd76a7b95e091f831cf653"
},
"pusher": {
"email": "crazy-max@users.noreply.github.com",
"name": "crazy-max"
},
"ref": "refs/heads/master",
"repository": {
"allow_forking": true,
"archive_url": "https://api.github.com/repos/crazy-max/test-docker-action/{archive_format}{/ref}",
"archived": false,
"assignees_url": "https://api.github.com/repos/crazy-max/test-docker-action/assignees{/user}",
"blobs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/crazy-max/test-docker-action/branches{/branch}",
"clone_url": "https://github.com/crazy-max/test-docker-action.git",
"collaborators_url": "https://api.github.com/repos/crazy-max/test-docker-action/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/comments{/number}",
"commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/commits{/sha}",
"compare_url": "https://api.github.com/repos/crazy-max/test-docker-action/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/crazy-max/test-docker-action/contents/{+path}",
"contributors_url": "https://api.github.com/repos/crazy-max/test-docker-action/contributors",
"created_at": 1596792180,
"default_branch": "master",
"deployments_url": "https://api.github.com/repos/crazy-max/test-docker-action/deployments",
"description": "Test \"Docker\" Actions",
"disabled": false,
"downloads_url": "https://api.github.com/repos/crazy-max/test-docker-action/downloads",
"events_url": "https://api.github.com/repos/crazy-max/test-docker-action/events",
"fork": false,
"forks": 1,
"forks_count": 1,
"forks_url": "https://api.github.com/repos/crazy-max/test-docker-action/forks",
"full_name": "crazy-max/test-docker-action",
"git_commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/tags{/sha}",
"git_url": "git://github.com/crazy-max/test-docker-action.git",
"has_downloads": true,
"has_issues": false,
"has_pages": false,
"has_projects": false,
"has_wiki": false,
"homepage": "",
"hooks_url": "https://api.github.com/repos/crazy-max/test-docker-action/hooks",
"html_url": "https://github.com/crazy-max/test-docker-action",
"id": 285789493,
"is_template": false,
"issue_comment_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/events{/number}",
"issues_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues{/number}",
"keys_url": "https://api.github.com/repos/crazy-max/test-docker-action/keys{/key_id}",
"labels_url": "https://api.github.com/repos/crazy-max/test-docker-action/labels{/name}",
"language": "JavaScript",
"languages_url": "https://api.github.com/repos/crazy-max/test-docker-action/languages",
"license": {
"key": "mit",
"name": "MIT License",
"node_id": "MDc6TGljZW5zZTEz",
"spdx_id": "MIT",
"url": "https://api.github.com/licenses/mit"
},
"master_branch": "master",
"merges_url": "https://api.github.com/repos/crazy-max/test-docker-action/merges",
"milestones_url": "https://api.github.com/repos/crazy-max/test-docker-action/milestones{/number}",
"mirror_url": null,
"name": "test-docker-action",
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
"notifications_url": "https://api.github.com/repos/crazy-max/test-docker-action/notifications{?since,all,participating}",
"open_issues": 4,
"open_issues_count": 4,
"organization": "docker",
"owner": {
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
"email": "info@docker.com",
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
"followers_url": "https://api.github.com/users/crazy-max/followers",
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/crazy-max",
"id": 5429470,
"login": "docker",
"name": "docker",
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
"organizations_url": "https://api.github.com/users/crazy-max/users",
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
"repos_url": "https://api.github.com/users/crazy-max/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
"type": "Organization",
"url": "https://api.github.com/users/crazy-max"
},
"private": true,
"pulls_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls{/number}",
"pushed_at": 1634852674,
"releases_url": "https://api.github.com/repos/crazy-max/test-docker-action/releases{/id}",
"size": 714,
"ssh_url": "git@github.com:crazy-max/test-docker-action.git",
"stargazers": 0,
"stargazers_count": 0,
"stargazers_url": "https://api.github.com/repos/crazy-max/test-docker-action/stargazers",
"statuses_url": "https://api.github.com/repos/crazy-max/test-docker-action/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscribers",
"subscription_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscription",
"svn_url": "https://github.com/crazy-max/test-docker-action",
"tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/tags",
"teams_url": "https://api.github.com/repos/crazy-max/test-docker-action/teams",
"topics": [],
"trees_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/trees{/sha}",
"updated_at": "2021-10-21T21:43:51Z",
"url": "https://github.com/crazy-max/test-docker-action",
"visibility": "private",
"watchers": 0,
"watchers_count": 0
},
"sender": {
"avatar_url": "https://avatars.githubusercontent.com/u/1951866?v=4",
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
"followers_url": "https://api.github.com/users/crazy-max/followers",
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/crazy-max",
"id": 1951866,
"login": "crazy-max",
"node_id": "MDQ6VXNlcjE5NTE4NjY=",
"organizations_url": "https://api.github.com/users/crazy-max/users",
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
"repos_url": "https://api.github.com/users/crazy-max/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
"type": "User",
"url": "https://api.github.com/users/crazy-max"
}
}

View File

@@ -6,7 +6,7 @@ GITHUB_API_URL=https://api.github.com
GITHUB_BASE_REF= GITHUB_BASE_REF=
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_6ee180c2-b331-434a-a867-89534cbefd83 GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_6ee180c2-b331-434a-a867-89534cbefd83
GITHUB_EVENT_NAME=push GITHUB_EVENT_NAME=push
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json GITHUB_EVENT_PATH=./__tests__/fixtures/event_tag_v1.1.1.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF= GITHUB_HEAD_REF=
GITHUB_JOB=event GITHUB_JOB=event

View File

@@ -0,0 +1,162 @@
{
"after": "8415a46e9494b78eca43a2dd8dca716b86b9df85",
"base_ref": "refs/heads/master",
"before": "0000000000000000000000000000000000000000",
"commits": [],
"compare": "https://github.com/crazy-max/test-docker-action/compare/v1.1.1",
"created": true,
"deleted": false,
"forced": false,
"head_commit": {
"author": {
"email": "crazy-max@users.noreply.github.com",
"name": "CrazyMax",
"username": "crazy-max"
},
"committer": {
"email": "noreply@github.com",
"name": "GitHub",
"username": "web-flow"
},
"distinct": true,
"id": "8415a46e9494b78eca43a2dd8dca716b86b9df85",
"message": "Trigger notification (#11)\n\nCo-authored-by: CrazyMax <crazy-max@users.noreply.github.com>",
"timestamp": "2021-10-21T23:47:22+02:00",
"tree_id": "8e46bf0c7fd95050deb02b11f0bc8c475c7428f3",
"url": "https://github.com/crazy-max/test-docker-action/commit/8415a46e9494b78eca43a2dd8dca716b86b9df85"
},
"pusher": {
"email": "crazy-max@users.noreply.github.com",
"name": "crazy-max"
},
"ref": "refs/tags/v1.1.1",
"repository": {
"allow_forking": true,
"archive_url": "https://api.github.com/repos/crazy-max/test-docker-action/{archive_format}{/ref}",
"archived": false,
"assignees_url": "https://api.github.com/repos/crazy-max/test-docker-action/assignees{/user}",
"blobs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/crazy-max/test-docker-action/branches{/branch}",
"clone_url": "https://github.com/crazy-max/test-docker-action.git",
"collaborators_url": "https://api.github.com/repos/crazy-max/test-docker-action/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/comments{/number}",
"commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/commits{/sha}",
"compare_url": "https://api.github.com/repos/crazy-max/test-docker-action/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/crazy-max/test-docker-action/contents/{+path}",
"contributors_url": "https://api.github.com/repos/crazy-max/test-docker-action/contributors",
"created_at": 1596792180,
"default_branch": "master",
"deployments_url": "https://api.github.com/repos/crazy-max/test-docker-action/deployments",
"description": "Test \"Docker\" Actions",
"disabled": false,
"downloads_url": "https://api.github.com/repos/crazy-max/test-docker-action/downloads",
"events_url": "https://api.github.com/repos/crazy-max/test-docker-action/events",
"fork": false,
"forks": 1,
"forks_count": 1,
"forks_url": "https://api.github.com/repos/crazy-max/test-docker-action/forks",
"full_name": "crazy-max/test-docker-action",
"git_commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/tags{/sha}",
"git_url": "git://github.com/crazy-max/test-docker-action.git",
"has_downloads": true,
"has_issues": false,
"has_pages": false,
"has_projects": false,
"has_wiki": false,
"homepage": "",
"hooks_url": "https://api.github.com/repos/crazy-max/test-docker-action/hooks",
"html_url": "https://github.com/crazy-max/test-docker-action",
"id": 285789493,
"is_template": false,
"issue_comment_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/events{/number}",
"issues_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues{/number}",
"keys_url": "https://api.github.com/repos/crazy-max/test-docker-action/keys{/key_id}",
"labels_url": "https://api.github.com/repos/crazy-max/test-docker-action/labels{/name}",
"language": "JavaScript",
"languages_url": "https://api.github.com/repos/crazy-max/test-docker-action/languages",
"license": {
"key": "mit",
"name": "MIT License",
"node_id": "MDc6TGljZW5zZTEz",
"spdx_id": "MIT",
"url": "https://api.github.com/licenses/mit"
},
"master_branch": "master",
"merges_url": "https://api.github.com/repos/crazy-max/test-docker-action/merges",
"milestones_url": "https://api.github.com/repos/crazy-max/test-docker-action/milestones{/number}",
"mirror_url": null,
"name": "test-docker-action",
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
"notifications_url": "https://api.github.com/repos/crazy-max/test-docker-action/notifications{?since,all,participating}",
"open_issues": 4,
"open_issues_count": 4,
"organization": "docker",
"owner": {
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
"email": "info@docker.com",
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
"followers_url": "https://api.github.com/users/crazy-max/followers",
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/crazy-max",
"id": 5429470,
"login": "docker",
"name": "docker",
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
"organizations_url": "https://api.github.com/users/crazy-max/users",
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
"repos_url": "https://api.github.com/users/crazy-max/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
"type": "Organization",
"url": "https://api.github.com/users/crazy-max"
},
"private": true,
"pulls_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls{/number}",
"pushed_at": 1634852872,
"releases_url": "https://api.github.com/repos/crazy-max/test-docker-action/releases{/id}",
"size": 714,
"ssh_url": "git@github.com:crazy-max/test-docker-action.git",
"stargazers": 0,
"stargazers_count": 0,
"stargazers_url": "https://api.github.com/repos/crazy-max/test-docker-action/stargazers",
"statuses_url": "https://api.github.com/repos/crazy-max/test-docker-action/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscribers",
"subscription_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscription",
"svn_url": "https://github.com/crazy-max/test-docker-action",
"tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/tags",
"teams_url": "https://api.github.com/repos/crazy-max/test-docker-action/teams",
"topics": [],
"trees_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/trees{/sha}",
"updated_at": "2021-10-21T21:47:25Z",
"url": "https://github.com/crazy-max/test-docker-action",
"visibility": "private",
"watchers": 0,
"watchers_count": 0
},
"sender": {
"avatar_url": "https://avatars.githubusercontent.com/u/1951866?v=4",
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
"followers_url": "https://api.github.com/users/crazy-max/followers",
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/crazy-max",
"id": 1951866,
"login": "crazy-max",
"node_id": "MDQ6VXNlcjE5NTE4NjY=",
"organizations_url": "https://api.github.com/users/crazy-max/users",
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
"repos_url": "https://api.github.com/users/crazy-max/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
"type": "User",
"url": "https://api.github.com/users/crazy-max"
}
}

View File

@@ -152,6 +152,19 @@ describe('transform', () => {
} as Flavor, } as Flavor,
false false
], ],
[
[
`prefix= `,
],
{
latest: "auto",
prefix: "",
prefixLatest: false,
suffix: "",
suffixLatest: false,
} as Flavor,
false
]
])('given %p attributes ', async (inputs: string[], expected: Flavor, invalid: boolean) => { ])('given %p attributes ', async (inputs: string[], expected: Flavor, invalid: boolean) => {
try { try {
const flavor = Transform(inputs); const flavor = Transform(inputs);

View File

@@ -379,14 +379,12 @@ describe('push', () => {
], ],
} as Inputs, } as Inputs,
{ {
main: 'master', main: 'sha-90dd603',
partial: ['sha-90dd603'], partial: [],
latest: false latest: false
} as Version, } as Version,
[ [
'org/app:master',
'org/app:sha-90dd603', 'org/app:sha-90dd603',
'ghcr.io/user/app:master',
'ghcr.io/user/app:sha-90dd603' 'ghcr.io/user/app:sha-90dd603'
], ],
[ [
@@ -394,7 +392,7 @@ describe('push', () => {
"org.opencontainers.image.description=This your first repo!", "org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World", "org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=master", "org.opencontainers.image.version=sha-90dd603",
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z", "org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071", "org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
"org.opencontainers.image.licenses=MIT" "org.opencontainers.image.licenses=MIT"
@@ -411,14 +409,12 @@ describe('push', () => {
], ],
} as Inputs, } as Inputs,
{ {
main: 'my-feature-1245', main: 'sha-90dd603',
partial: ['sha-90dd603'], partial: [],
latest: false latest: false
} as Version, } as Version,
[ [
'org/app:my-feature-1245',
'org/app:sha-90dd603', 'org/app:sha-90dd603',
'ghcr.io/user/app:my-feature-1245',
'ghcr.io/user/app:sha-90dd603' 'ghcr.io/user/app:sha-90dd603'
], ],
[ [
@@ -426,7 +422,7 @@ describe('push', () => {
"org.opencontainers.image.description=This your first repo!", "org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World", "org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=my-feature-1245", "org.opencontainers.image.version=sha-90dd603",
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z", "org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071", "org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
"org.opencontainers.image.licenses=MIT" "org.opencontainers.image.licenses=MIT"
@@ -444,20 +440,17 @@ describe('push', () => {
], ],
} as Inputs, } as Inputs,
{ {
main: 'my-feature-1245', main: undefined,
partial: [], partial: [],
latest: false latest: false
} as Version, } as Version,
[ [],
'org/app:my-feature-1245',
'ghcr.io/user/app:my-feature-1245'
],
[ [
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.description=This your first repo!", "org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World", "org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=my-feature-1245", "org.opencontainers.image.version=",
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z", "org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071", "org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
"org.opencontainers.image.licenses=MIT" "org.opencontainers.image.licenses=MIT"
@@ -592,17 +585,25 @@ describe('push', () => {
images: ['user/app'], images: ['user/app'],
tags: [ tags: [
`type=raw,value=mytag-{{branch}}`, `type=raw,value=mytag-{{branch}}`,
`type=raw,value=mytag-{{tag}}` `type=raw,value=mytag-{{date 'YYYYMMDD'}}`,
`type=raw,value=mytag-tag-{{tag}}`,
`type=raw,value=mytag-baseref-{{base_ref}}`
], ],
} as Inputs, } as Inputs,
{ {
main: 'mytag-master', main: 'mytag-master',
partial: ['mytag-'], partial: [
'mytag-20200110',
'mytag-tag-',
'mytag-baseref-'
],
latest: false latest: false
} as Version, } as Version,
[ [
'user/app:mytag-master', 'user/app:mytag-master',
'user/app:mytag-' 'user/app:mytag-20200110',
'user/app:mytag-tag-',
'user/app:mytag-baseref-'
], ],
[ [
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
@@ -646,6 +647,37 @@ describe('push', () => {
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071", "org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
"org.opencontainers.image.licenses=MIT" "org.opencontainers.image.licenses=MIT"
] ]
],
[
'push19',
'event_push.env',
{
images: ['org/app', 'ghcr.io/user/app'],
tags: [
`type=edge,branch=master`,
`type=ref,event=branch,enable=false`,
`type=sha,format=long`
],
} as Inputs,
{
main: 'sha-90dd6032fac8bda1b6c4436a2e65de27961ed071',
partial: [],
latest: false
} as Version,
[
'org/app:sha-90dd6032fac8bda1b6c4436a2e65de27961ed071',
'ghcr.io/user/app:sha-90dd6032fac8bda1b6c4436a2e65de27961ed071'
],
[
"org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=sha-90dd6032fac8bda1b6c4436a2e65de27961ed071",
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
"org.opencontainers.image.licenses=MIT"
]
] ]
])('given %p with %p event', tagsLabelsTest); ])('given %p with %p event', tagsLabelsTest);
}); });
@@ -1277,17 +1309,22 @@ describe('tag', () => {
{ {
images: ['org/app', 'ghcr.io/user/app'], images: ['org/app', 'ghcr.io/user/app'],
tags: [ tags: [
`type=raw,{{tag}}-{{sha}}-foo` `type=raw,{{tag}}-{{sha}}-foo`,
`type=raw,{{base_ref}}-foo`
] ]
} as Inputs, } as Inputs,
{ {
main: 'v1.1.1-90dd603-foo', main: 'v1.1.1-90dd603-foo',
partial: [], partial: [
'master-foo'
],
latest: false latest: false
} as Version, } as Version,
[ [
'org/app:v1.1.1-90dd603-foo', 'org/app:v1.1.1-90dd603-foo',
'ghcr.io/user/app:v1.1.1-90dd603-foo' 'org/app:master-foo',
'ghcr.io/user/app:v1.1.1-90dd603-foo',
'ghcr.io/user/app:master-foo'
], ],
[ [
"org.opencontainers.image.title=Hello-World", "org.opencontainers.image.title=Hello-World",
@@ -1377,20 +1414,18 @@ describe('tag', () => {
{ {
images: ['org/app'], images: ['org/app'],
tags: [ tags: [
`type=pep440,pattern={{version}}`, `type=pep440,pattern={{raw}}`,
`type=pep440,pattern={{major}}.{{minor}}`, `type=pep440,pattern={{major}}.{{minor}}`
`type=pep440,pattern={{major}}`
] ]
} as Inputs, } as Inputs,
{ {
main: '1.1.1', main: 'v1.1.1',
partial: ['1.1', '1'], partial: ['1.1'],
latest: true latest: true
} as Version, } as Version,
[ [
'org/app:1.1.1', 'org/app:v1.1.1',
'org/app:1.1', 'org/app:1.1',
'org/app:1',
'org/app:latest' 'org/app:latest'
], ],
[ [
@@ -1398,7 +1433,7 @@ describe('tag', () => {
"org.opencontainers.image.description=This your first repo!", "org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World", "org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World", "org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.1.1", "org.opencontainers.image.version=v1.1.1",
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z", "org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071", "org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
"org.opencontainers.image.licenses=MIT" "org.opencontainers.image.licenses=MIT"
@@ -1886,7 +1921,7 @@ describe('latest', () => {
labels: [ labels: [
"maintainer=CrazyMax", "maintainer=CrazyMax",
"org.opencontainers.image.title=MyCustomTitle", "org.opencontainers.image.title=MyCustomTitle",
"org.opencontainers.image.description=Another description", `org.opencontainers.image.description=this is a "good" example`,
"org.opencontainers.image.vendor=MyCompany", "org.opencontainers.image.vendor=MyCompany",
] ]
} as Inputs, } as Inputs,
@@ -1910,7 +1945,7 @@ describe('latest', () => {
"org.opencontainers.image.licenses=MIT", "org.opencontainers.image.licenses=MIT",
"maintainer=CrazyMax", "maintainer=CrazyMax",
"org.opencontainers.image.title=MyCustomTitle", "org.opencontainers.image.title=MyCustomTitle",
"org.opencontainers.image.description=Another description", `org.opencontainers.image.description=this is a "good" example`,
"org.opencontainers.image.vendor=MyCompany" "org.opencontainers.image.vendor=MyCompany"
] ]
], ],
@@ -2202,7 +2237,63 @@ describe('pr', () => {
"org.opencontainers.image.revision=f24900bfcfee76d8055c8421a164c7e57ad20e68", "org.opencontainers.image.revision=f24900bfcfee76d8055c8421a164c7e57ad20e68",
"org.opencontainers.image.licenses=MIT" "org.opencontainers.image.licenses=MIT"
] ]
],
[
'pr10',
'event_pull_request_target.env',
{
images: ['org/app'],
tags: [
`type=raw,value=mytag-{{base_ref}}`,
] ]
} as Inputs,
{
main: 'mytag-master',
partial: [],
latest: false
} as Version,
[
'org/app:mytag-master'
],
[
"org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=mytag-master",
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.revision=f24900bfcfee76d8055c8421a164c7e57ad20e68",
"org.opencontainers.image.licenses=MIT"
]
],
[
'pr06',
'event_pull_request.env',
{
images: ['org/app'],
tags: [
`type=raw,value=mytag-{{base_ref}}`,
]
} as Inputs,
{
main: 'mytag-master',
partial: [],
latest: false
} as Version,
[
'org/app:mytag-master'
],
[
"org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=mytag-master",
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.revision=1e9249f05bfc090e0688b8fb9c1b347586add504",
"org.opencontainers.image.licenses=MIT"
]
],
])('given %p with %p event', tagsLabelsTest); ])('given %p with %p event', tagsLabelsTest);
}); });

272
dist/index.js generated vendored
View File

@@ -74,6 +74,7 @@ function getInputList(name, ignoreComma) {
} }
for (let output of sync_1.default(items, { for (let output of sync_1.default(items, {
columns: false, columns: false,
relax: true,
relaxColumnCount: true, relaxColumnCount: true,
skipLinesWithEmptyValues: true skipLinesWithEmptyValues: true
})) { })) {
@@ -151,39 +152,44 @@ function Transform(inputs) {
})[0]; })[0];
let onlatestfor = ''; let onlatestfor = '';
for (const field of fields) { for (const field of fields) {
const parts = field.toString().split('=', 2); const parts = field
.toString()
.split('=')
.map(item => item.trim());
if (parts.length == 1) { if (parts.length == 1) {
throw new Error(`Invalid flavor entry: ${input}`); throw new Error(`Invalid flavor entry: ${input}`);
} }
switch (parts[0]) { const key = parts[0].toLowerCase();
const value = parts[1];
switch (key) {
case 'latest': { case 'latest': {
flavor.latest = parts[1]; flavor.latest = value;
if (!['auto', 'true', 'false'].includes(flavor.latest)) { if (!['auto', 'true', 'false'].includes(flavor.latest)) {
throw new Error(`Invalid latest flavor entry: ${input}`); throw new Error(`Invalid latest flavor entry: ${input}`);
} }
break; break;
} }
case 'prefix': { case 'prefix': {
flavor.prefix = parts[1]; flavor.prefix = value;
onlatestfor = 'prefix'; onlatestfor = 'prefix';
break; break;
} }
case 'suffix': { case 'suffix': {
flavor.suffix = parts[1]; flavor.suffix = value;
onlatestfor = 'suffix'; onlatestfor = 'suffix';
break; break;
} }
case 'onlatest': { case 'onlatest': {
if (!['true', 'false'].includes(parts[1])) { if (!['true', 'false'].includes(value)) {
throw new Error(`Invalid value for onlatest attribute: ${parts[1]}`); throw new Error(`Invalid value for onlatest attribute: ${value}`);
} }
switch (onlatestfor) { switch (onlatestfor) {
case 'prefix': { case 'prefix': {
flavor.prefixLatest = /true/i.test(parts[1]); flavor.prefixLatest = /true/i.test(value);
break; break;
} }
case 'suffix': { case 'suffix': {
flavor.suffixLatest = /true/i.test(parts[1]); flavor.suffixLatest = /true/i.test(value);
break; break;
} }
} }
@@ -629,10 +635,10 @@ class Meta {
if (tag.attrs['branch'].length == 0) { if (tag.attrs['branch'].length == 0) {
tag.attrs['branch'] = this.repo.default_branch; tag.attrs['branch'] = this.repo.default_branch;
} }
if (tag.attrs['branch'] === val) { if (tag.attrs['branch'] != val) {
val = 'edge'; return version;
} }
const vraw = this.setValue(val, tag); const vraw = this.setValue('edge', tag);
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true'); return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
} }
procRaw(version, tag) { procRaw(version, tag) {
@@ -682,6 +688,7 @@ class Meta {
} }
setGlobalExp(val) { setGlobalExp(val) {
const ctx = this.context; const ctx = this.context;
const currentDate = this.date;
return handlebars.compile(val)({ return handlebars.compile(val)({
branch: function () { branch: function () {
if (!/^refs\/heads\//.test(ctx.ref)) { if (!/^refs\/heads\//.test(ctx.ref)) {
@@ -697,6 +704,19 @@ class Meta {
}, },
sha: function () { sha: function () {
return ctx.sha.substr(0, 7); return ctx.sha.substr(0, 7);
},
base_ref: function () {
var _a, _b, _c, _d;
if (/^refs\/tags\//.test(ctx.ref)) {
return (_a = ctx.payload) === null || _a === void 0 ? void 0 : _a.base_ref.replace(/^refs\/heads\//g, '').replace(/\//g, '-');
}
if (/^refs\/pull\//.test(ctx.ref)) {
return (_d = (_c = (_b = ctx.payload) === null || _b === void 0 ? void 0 : _b.pull_request) === null || _c === void 0 ? void 0 : _c.base) === null || _d === void 0 ? void 0 : _d.ref;
}
return '';
},
date: function (format) {
return moment_1.default(currentDate).utc().format(format);
} }
}); });
} }
@@ -888,13 +908,16 @@ function Parse(s) {
})[0]; })[0];
const tag = new Tag(); const tag = new Tag();
for (const field of fields) { for (const field of fields) {
const parts = field.toString().split('=', 2); const parts = field
.toString()
.split('=')
.map(item => item.trim());
if (parts.length == 1) { if (parts.length == 1) {
tag.attrs['value'] = parts[0].trim(); tag.attrs['value'] = parts[0];
} }
else { else {
const key = parts[0].trim().toLowerCase(); const key = parts[0].toLowerCase();
const value = parts[1].trim(); const value = parts[1];
switch (key) { switch (key) {
case 'type': { case 'type': {
if (!Object.values(Type).includes(value)) { if (!Object.values(Type).includes(value)) {
@@ -1135,12 +1158,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
const command_1 = __nccwpck_require__(7351); const command_1 = __nccwpck_require__(7351);
const file_command_1 = __nccwpck_require__(717); const file_command_1 = __nccwpck_require__(717);
const utils_1 = __nccwpck_require__(5278); const utils_1 = __nccwpck_require__(5278);
const os = __importStar(__nccwpck_require__(2087)); const os = __importStar(__nccwpck_require__(2087));
const path = __importStar(__nccwpck_require__(5622)); const path = __importStar(__nccwpck_require__(5622));
const oidc_utils_1 = __nccwpck_require__(8041);
/** /**
* The code to exit an action * The code to exit an action
*/ */
@@ -1313,19 +1337,30 @@ exports.debug = debug;
/** /**
* Adds an error issue * Adds an error issue
* @param message error issue message. Errors will be converted to string via toString() * @param message error issue message. Errors will be converted to string via toString()
* @param properties optional properties to add to the annotation.
*/ */
function error(message) { function error(message, properties = {}) {
command_1.issue('error', message instanceof Error ? message.toString() : message); command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
} }
exports.error = error; exports.error = error;
/** /**
* Adds an warning issue * Adds a warning issue
* @param message warning issue message. Errors will be converted to string via toString() * @param message warning issue message. Errors will be converted to string via toString()
* @param properties optional properties to add to the annotation.
*/ */
function warning(message) { function warning(message, properties = {}) {
command_1.issue('warning', message instanceof Error ? message.toString() : message); command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
} }
exports.warning = warning; exports.warning = warning;
/**
* Adds a notice issue
* @param message notice issue message. Errors will be converted to string via toString()
* @param properties optional properties to add to the annotation.
*/
function notice(message, properties = {}) {
command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
}
exports.notice = notice;
/** /**
* Writes info to log with console.log. * Writes info to log with console.log.
* @param message info message * @param message info message
@@ -1398,6 +1433,12 @@ function getState(name) {
return process.env[`STATE_${name}`] || ''; return process.env[`STATE_${name}`] || '';
} }
exports.getState = getState; exports.getState = getState;
function getIDToken(aud) {
return __awaiter(this, void 0, void 0, function* () {
return yield oidc_utils_1.OidcClient.getIDToken(aud);
});
}
exports.getIDToken = getIDToken;
//# sourceMappingURL=core.js.map //# sourceMappingURL=core.js.map
/***/ }), /***/ }),
@@ -1451,6 +1492,90 @@ exports.issueCommand = issueCommand;
/***/ }), /***/ }),
/***/ 8041:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.OidcClient = void 0;
const http_client_1 = __nccwpck_require__(9925);
const auth_1 = __nccwpck_require__(3702);
const core_1 = __nccwpck_require__(2186);
class OidcClient {
static createHttpClient(allowRetry = true, maxRetry = 10) {
const requestOptions = {
allowRetries: allowRetry,
maxRetries: maxRetry
};
return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions);
}
static getRequestToken() {
const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'];
if (!token) {
throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable');
}
return token;
}
static getIDTokenUrl() {
const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL'];
if (!runtimeUrl) {
throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable');
}
return runtimeUrl;
}
static getCall(id_token_url) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const httpclient = OidcClient.createHttpClient();
const res = yield httpclient
.getJson(id_token_url)
.catch(error => {
throw new Error(`Failed to get ID Token. \n
Error Code : ${error.statusCode}\n
Error Message: ${error.result.message}`);
});
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
if (!id_token) {
throw new Error('Response json body do not have ID Token field');
}
return id_token;
});
}
static getIDToken(audience) {
return __awaiter(this, void 0, void 0, function* () {
try {
// New ID Token is requested from action service
let id_token_url = OidcClient.getIDTokenUrl();
if (audience) {
const encodedAudience = encodeURIComponent(audience);
id_token_url = `${id_token_url}&audience=${encodedAudience}`;
}
core_1.debug(`ID token url is ${id_token_url}`);
const id_token = yield OidcClient.getCall(id_token_url);
core_1.setSecret(id_token);
return id_token;
}
catch (error) {
throw new Error(`Error message: ${error.message}`);
}
});
}
}
exports.OidcClient = OidcClient;
//# sourceMappingURL=oidc-utils.js.map
/***/ }),
/***/ 5278: /***/ 5278:
/***/ ((__unused_webpack_module, exports) => { /***/ ((__unused_webpack_module, exports) => {
@@ -1459,7 +1584,7 @@ exports.issueCommand = issueCommand;
// We use any as a valid input type // We use any as a valid input type
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.toCommandValue = void 0; exports.toCommandProperties = exports.toCommandValue = void 0;
/** /**
* Sanitizes an input into a string so it can be passed into issueCommand safely * Sanitizes an input into a string so it can be passed into issueCommand safely
* @param input input to sanitize into a string * @param input input to sanitize into a string
@@ -1474,6 +1599,26 @@ function toCommandValue(input) {
return JSON.stringify(input); return JSON.stringify(input);
} }
exports.toCommandValue = toCommandValue; exports.toCommandValue = toCommandValue;
/**
*
* @param annotationProperties
* @returns The command properties to send with the actual annotation command
* See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
*/
function toCommandProperties(annotationProperties) {
if (!Object.keys(annotationProperties).length) {
return {};
}
return {
title: annotationProperties.title,
file: annotationProperties.file,
line: annotationProperties.startLine,
endLine: annotationProperties.endLine,
col: annotationProperties.startColumn,
endColumn: annotationProperties.endColumn
};
}
exports.toCommandProperties = toCommandProperties;
//# sourceMappingURL=utils.js.map //# sourceMappingURL=utils.js.map
/***/ }), /***/ }),
@@ -1691,6 +1836,72 @@ function getOctokitOptions(token, options) {
exports.getOctokitOptions = getOctokitOptions; exports.getOctokitOptions = getOctokitOptions;
//# sourceMappingURL=utils.js.map //# sourceMappingURL=utils.js.map
/***/ }),
/***/ 3702:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
class BasicCredentialHandler {
constructor(username, password) {
this.username = username;
this.password = password;
}
prepareRequest(options) {
options.headers['Authorization'] =
'Basic ' +
Buffer.from(this.username + ':' + this.password).toString('base64');
}
// This handler cannot handle 401
canHandleAuthentication(response) {
return false;
}
handleAuthentication(httpClient, requestInfo, objs) {
return null;
}
}
exports.BasicCredentialHandler = BasicCredentialHandler;
class BearerCredentialHandler {
constructor(token) {
this.token = token;
}
// currently implements pre-authorization
// TODO: support preAuth = false where it hooks on 401
prepareRequest(options) {
options.headers['Authorization'] = 'Bearer ' + this.token;
}
// This handler cannot handle 401
canHandleAuthentication(response) {
return false;
}
handleAuthentication(httpClient, requestInfo, objs) {
return null;
}
}
exports.BearerCredentialHandler = BearerCredentialHandler;
class PersonalAccessTokenCredentialHandler {
constructor(token) {
this.token = token;
}
// currently implements pre-authorization
// TODO: support preAuth = false where it hooks on 401
prepareRequest(options) {
options.headers['Authorization'] =
'Basic ' + Buffer.from('PAT:' + this.token).toString('base64');
}
// This handler cannot handle 401
canHandleAuthentication(response) {
return false;
}
handleAuthentication(httpClient, requestInfo, objs) {
return null;
}
}
exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;
/***/ }), /***/ }),
/***/ 9925: /***/ 9925:
@@ -10344,7 +10555,7 @@ class Parser extends Transform {
const date = Date.parse(value) const date = Date.parse(value)
return !isNaN(date) ? new Date(date) : value return !isNaN(date) ? new Date(date) : value
} }
}else if(typeof options.cast_date !== 'function'){ }else{
throw new CsvError('CSV_INVALID_OPTION_CAST_DATE', [ throw new CsvError('CSV_INVALID_OPTION_CAST_DATE', [
'Invalid option cast_date:', 'cast_date must be true or a function,', 'Invalid option cast_date:', 'cast_date must be true or a function,',
`got ${JSON.stringify(options.cast_date)}` `got ${JSON.stringify(options.cast_date)}`
@@ -10680,6 +10891,7 @@ class Parser extends Transform {
} }
} }
this.info = { this.info = {
bytes: 0,
comment_lines: 0, comment_lines: 0,
empty_lines: 0, empty_lines: 0,
invalid_field_length: 0, invalid_field_length: 0,
@@ -10689,6 +10901,7 @@ class Parser extends Transform {
this.options = options this.options = options
this.state = { this.state = {
bomSkipped: false, bomSkipped: false,
bufBytesStart: 0,
castField: fnCastField, castField: fnCastField,
commenting: false, commenting: false,
// Current error encountered by a record // Current error encountered by a record
@@ -10775,7 +10988,9 @@ class Parser extends Transform {
for(let encoding in boms){ for(let encoding in boms){
if(boms[encoding].compare(buf, 0, boms[encoding].length) === 0){ if(boms[encoding].compare(buf, 0, boms[encoding].length) === 0){
// Skip BOM // Skip BOM
buf = buf.slice(boms[encoding].length) let bomLength = boms[encoding].length
this.state.bufBytesStart += bomLength
buf = buf.slice(bomLength)
// Renormalize original options with the new encoding // Renormalize original options with the new encoding
this.__normalizeOptions({...this.__originalOptions, encoding: encoding}) this.__normalizeOptions({...this.__originalOptions, encoding: encoding})
break break
@@ -10915,8 +11130,10 @@ class Parser extends Transform {
pos += recordDelimiterLength - 1 pos += recordDelimiterLength - 1
continue continue
} }
this.info.bytes = this.state.bufBytesStart + pos;
const errField = this.__onField() const errField = this.__onField()
if(errField !== undefined) return errField if(errField !== undefined) return errField
this.info.bytes = this.state.bufBytesStart + pos + recordDelimiterLength;
const errRecord = this.__onRecord() const errRecord = this.__onRecord()
if(errRecord !== undefined) return errRecord if(errRecord !== undefined) return errRecord
if(to !== -1 && this.info.records >= to){ if(to !== -1 && this.info.records >= to){
@@ -10939,6 +11156,7 @@ class Parser extends Transform {
} }
let delimiterLength = this.__isDelimiter(buf, pos, chr) let delimiterLength = this.__isDelimiter(buf, pos, chr)
if(delimiterLength !== 0){ if(delimiterLength !== 0){
this.info.bytes = this.state.bufBytesStart + pos;
const errField = this.__onField() const errField = this.__onField()
if(errField !== undefined) return errField if(errField !== undefined) return errField
pos += delimiterLength - 1 pos += delimiterLength - 1
@@ -10988,6 +11206,7 @@ class Parser extends Transform {
}else{ }else{
// Skip last line if it has no characters // Skip last line if it has no characters
if(this.state.wasQuoting === true || this.state.record.length !== 0 || this.state.field.length !== 0){ if(this.state.wasQuoting === true || this.state.record.length !== 0 || this.state.field.length !== 0){
this.info.bytes = this.state.bufBytesStart + pos;
const errField = this.__onField() const errField = this.__onField()
if(errField !== undefined) return errField if(errField !== undefined) return errField
const errRecord = this.__onRecord() const errRecord = this.__onRecord()
@@ -10999,6 +11218,7 @@ class Parser extends Transform {
} }
} }
}else{ }else{
this.state.bufBytesStart += pos
this.state.previousBuf = buf.slice(pos) this.state.previousBuf = buf.slice(pos)
} }
if(this.state.wasRowDelimiter === true){ if(this.state.wasRowDelimiter === true){
@@ -11413,7 +11633,7 @@ const parse = function(){
throw new CsvError('CSV_INVALID_ARGUMENT', [ throw new CsvError('CSV_INVALID_ARGUMENT', [
'Invalid argument:', 'Invalid argument:',
`got ${JSON.stringify(argument)} at index ${i}` `got ${JSON.stringify(argument)} at index ${i}`
], this.options) ], options || {})
} }
} }
const parser = new Parser(options) const parser = new Parser(options)

View File

@@ -31,6 +31,7 @@ target "build-validate" {
inherits = ["node-version"] inherits = ["node-version"]
dockerfile = "./hack/build.Dockerfile" dockerfile = "./hack/build.Dockerfile"
target = "build-validate" target = "build-validate"
output = ["type=cacheonly"]
} }
target "format" { target "format" {
@@ -44,24 +45,26 @@ target "format-validate" {
inherits = ["node-version"] inherits = ["node-version"]
dockerfile = "./hack/build.Dockerfile" dockerfile = "./hack/build.Dockerfile"
target = "format-validate" target = "format-validate"
output = ["type=cacheonly"]
} }
target "vendor-update" { target "vendor-update" {
inherits = ["node-version"] inherits = ["node-version"]
dockerfile = "./hack/vendor.Dockerfile" dockerfile = "./hack/build.Dockerfile"
target = "update" target = "vendor-update"
output = ["."] output = ["."]
} }
target "vendor-validate" { target "vendor-validate" {
inherits = ["node-version"] inherits = ["node-version"]
dockerfile = "./hack/vendor.Dockerfile" dockerfile = "./hack/build.Dockerfile"
target = "validate" target = "vendor-validate"
output = ["type=cacheonly"]
} }
target "test" { target "test" {
inherits = ["node-version"] inherits = ["node-version"]
dockerfile = "./hack/test.Dockerfile" dockerfile = "./hack/build.Dockerfile"
target = "test-coverage" target = "test-coverage"
output = ["./coverage"] output = ["./coverage"]
} }

View File

@@ -1,4 +1,5 @@
# syntax=docker/dockerfile:1.2 # syntax=docker/dockerfile:1.3-labs
ARG NODE_VERSION ARG NODE_VERSION
FROM node:${NODE_VERSION}-alpine AS base FROM node:${NODE_VERSION}-alpine AS base
@@ -8,7 +9,22 @@ WORKDIR /src
FROM base AS deps FROM base AS deps
RUN --mount=type=bind,target=.,rw \ RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/node_modules \ --mount=type=cache,target=/src/node_modules \
yarn install yarn install && mkdir /vendor && cp yarn.lock /vendor
FROM scratch AS vendor-update
COPY --from=deps /vendor /
FROM deps AS vendor-validate
RUN --mount=type=bind,target=.,rw <<EOT
set -e
git add -A
cp -rf /vendor/* .
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'
git status --porcelain -- yarn.lock
exit 1
fi
EOT
FROM deps AS build FROM deps AS build
RUN --mount=type=bind,target=.,rw \ RUN --mount=type=bind,target=.,rw \
@@ -19,13 +35,16 @@ FROM scratch AS build-update
COPY --from=build /out / COPY --from=build /out /
FROM build AS build-validate FROM build AS build-validate
RUN --mount=type=bind,target=.,rw \ RUN --mount=type=bind,target=.,rw <<EOT
git add -A && cp -rf /out/* .; \ set -e
if [ -n "$(git status --porcelain -- dist)" ]; then \ git add -A
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'; \ cp -rf /out/* .
git status --porcelain -- dist; \ if [ -n "$(git status --porcelain -- dist)" ]; then
exit 1; \ echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
fi git status --porcelain -- dist
exit 1
fi
EOT
FROM deps AS format FROM deps AS format
RUN --mount=type=bind,target=.,rw \ RUN --mount=type=bind,target=.,rw \
@@ -39,4 +58,14 @@ COPY --from=format /out /
FROM deps AS format-validate FROM deps AS format-validate
RUN --mount=type=bind,target=.,rw \ RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/node_modules \ --mount=type=cache,target=/src/node_modules \
yarn run format-check \ yarn run format-check
FROM deps AS test
ENV RUNNER_TEMP=/tmp/github_runner
ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/node_modules \
yarn run test --coverageDirectory=/tmp/coverage
FROM scratch AS test-coverage
COPY --from=test /tmp/coverage /

View File

@@ -1,21 +0,0 @@
# syntax=docker/dockerfile:1.2
ARG NODE_VERSION
FROM node:${NODE_VERSION}-alpine AS base
RUN apk add --no-cache git
WORKDIR /src
FROM base AS deps
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/node_modules \
yarn install
FROM deps AS test
ENV RUNNER_TEMP=/tmp/github_runner
ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/node_modules \
yarn run test --coverageDirectory=/tmp/coverage
FROM scratch AS test-coverage
COPY --from=test /tmp/coverage /

View File

@@ -1,23 +0,0 @@
# syntax=docker/dockerfile:1.2
ARG NODE_VERSION
FROM node:${NODE_VERSION}-alpine AS base
RUN apk add --no-cache git
WORKDIR /src
FROM base AS vendored
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/node_modules \
yarn install && mkdir /out && cp yarn.lock /out
FROM scratch AS update
COPY --from=vendored /out /
FROM vendored AS validate
RUN --mount=type=bind,target=.,rw \
git add -A && cp -rf /out/* .; \
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then \
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'; \
git status --porcelain -- yarn.lock; \
exit 1; \
fi

View File

@@ -29,10 +29,10 @@
], ],
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@actions/core": "^1.4.0", "@actions/core": "^1.6.0",
"@actions/github": "^5.0.0", "@actions/github": "^5.0.0",
"@renovate/pep440": "^1.0.0", "@renovate/pep440": "^1.0.0",
"csv-parse": "^4.16.0", "csv-parse": "^4.16.3",
"handlebars": "^4.7.7", "handlebars": "^4.7.7",
"moment": "^2.29.1", "moment": "^2.29.1",
"semver": "^7.3.5" "semver": "^7.3.5"

View File

@@ -48,6 +48,7 @@ export function getInputList(name: string, ignoreComma?: boolean): string[] {
for (let output of csvparse(items, { for (let output of csvparse(items, {
columns: false, columns: false,
relax: true,
relaxColumnCount: true, relaxColumnCount: true,
skipLinesWithEmptyValues: true skipLinesWithEmptyValues: true
}) as Array<string[]>) { }) as Array<string[]>) {

View File

@@ -25,39 +25,44 @@ export function Transform(inputs: string[]): Flavor {
})[0]; })[0];
let onlatestfor = ''; let onlatestfor = '';
for (const field of fields) { for (const field of fields) {
const parts = field.toString().split('=', 2); const parts = field
.toString()
.split('=')
.map(item => item.trim());
if (parts.length == 1) { if (parts.length == 1) {
throw new Error(`Invalid flavor entry: ${input}`); throw new Error(`Invalid flavor entry: ${input}`);
} }
switch (parts[0]) { const key = parts[0].toLowerCase();
const value = parts[1];
switch (key) {
case 'latest': { case 'latest': {
flavor.latest = parts[1]; flavor.latest = value;
if (!['auto', 'true', 'false'].includes(flavor.latest)) { if (!['auto', 'true', 'false'].includes(flavor.latest)) {
throw new Error(`Invalid latest flavor entry: ${input}`); throw new Error(`Invalid latest flavor entry: ${input}`);
} }
break; break;
} }
case 'prefix': { case 'prefix': {
flavor.prefix = parts[1]; flavor.prefix = value;
onlatestfor = 'prefix'; onlatestfor = 'prefix';
break; break;
} }
case 'suffix': { case 'suffix': {
flavor.suffix = parts[1]; flavor.suffix = value;
onlatestfor = 'suffix'; onlatestfor = 'suffix';
break; break;
} }
case 'onlatest': { case 'onlatest': {
if (!['true', 'false'].includes(parts[1])) { if (!['true', 'false'].includes(value)) {
throw new Error(`Invalid value for onlatest attribute: ${parts[1]}`); throw new Error(`Invalid value for onlatest attribute: ${value}`);
} }
switch (onlatestfor) { switch (onlatestfor) {
case 'prefix': { case 'prefix': {
flavor.prefixLatest = /true/i.test(parts[1]); flavor.prefixLatest = /true/i.test(value);
break; break;
} }
case 'suffix': { case 'suffix': {
flavor.suffixLatest = /true/i.test(parts[1]); flavor.suffixLatest = /true/i.test(value);
break; break;
} }
} }

View File

@@ -265,11 +265,11 @@ export class Meta {
if (tag.attrs['branch'].length == 0) { if (tag.attrs['branch'].length == 0) {
tag.attrs['branch'] = this.repo.default_branch; tag.attrs['branch'] = this.repo.default_branch;
} }
if (tag.attrs['branch'] === val) { if (tag.attrs['branch'] != val) {
val = 'edge'; return version;
} }
const vraw = this.setValue(val, tag); const vraw = this.setValue('edge', tag);
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true'); return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
} }
@@ -323,6 +323,7 @@ export class Meta {
private setGlobalExp(val): string { private setGlobalExp(val): string {
const ctx = this.context; const ctx = this.context;
const currentDate = this.date;
return handlebars.compile(val)({ return handlebars.compile(val)({
branch: function () { branch: function () {
if (!/^refs\/heads\//.test(ctx.ref)) { if (!/^refs\/heads\//.test(ctx.ref)) {
@@ -338,6 +339,18 @@ export class Meta {
}, },
sha: function () { sha: function () {
return ctx.sha.substr(0, 7); return ctx.sha.substr(0, 7);
},
base_ref: function () {
if (/^refs\/tags\//.test(ctx.ref)) {
return ctx.payload?.base_ref.replace(/^refs\/heads\//g, '').replace(/\//g, '-');
}
if (/^refs\/pull\//.test(ctx.ref)) {
return ctx.payload?.pull_request?.base?.ref;
}
return '';
},
date: function (format) {
return moment(currentDate).utc().format(format);
} }
}); });
} }

View File

@@ -93,12 +93,15 @@ export function Parse(s: string): Tag {
const tag = new Tag(); const tag = new Tag();
for (const field of fields) { for (const field of fields) {
const parts = field.toString().split('=', 2); const parts = field
.toString()
.split('=')
.map(item => item.trim());
if (parts.length == 1) { if (parts.length == 1) {
tag.attrs['value'] = parts[0].trim(); tag.attrs['value'] = parts[0];
} else { } else {
const key = parts[0].trim().toLowerCase(); const key = parts[0].toLowerCase();
const value = parts[1].trim(); const value = parts[1];
switch (key) { switch (key) {
case 'type': { case 'type': {
if (!Object.values(Type).includes(value)) { if (!Object.values(Type).includes(value)) {

View File

@@ -2,10 +2,12 @@
# yarn lockfile v1 # yarn lockfile v1
"@actions/core@^1.4.0": "@actions/core@^1.6.0":
version "1.4.0" version "1.6.0"
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.4.0.tgz#cf2e6ee317e314b03886adfeb20e448d50d6e524" resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.6.0.tgz#0568e47039bfb6a9170393a73f3b7eb3b22462cb"
integrity sha512-CGx2ilGq5i7zSLgiiGUtBCxhRRxibJYU6Fim0Q1Wg2aQL2LTnF27zbqZOrxfvFQ55eSBW0L8uVStgtKMpa0Qlg== integrity sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==
dependencies:
"@actions/http-client" "^1.0.11"
"@actions/github@^5.0.0": "@actions/github@^5.0.0":
version "5.0.0" version "5.0.0"
@@ -819,9 +821,9 @@ ansi-escapes@^4.2.1:
type-fest "^0.21.3" type-fest "^0.21.3"
ansi-regex@^5.0.0: ansi-regex@^5.0.0:
version "5.0.0" version "5.0.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
ansi-styles@^3.2.1: ansi-styles@^3.2.1:
version "3.2.1" version "3.2.1"
@@ -1256,10 +1258,10 @@ cssstyle@^2.3.0:
dependencies: dependencies:
cssom "~0.3.6" cssom "~0.3.6"
csv-parse@^4.16.0: csv-parse@^4.16.3:
version "4.16.0" version "4.16.3"
resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-4.16.0.tgz#b4c875e288a41f7ff917cb0d7d45880d563034f6" resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-4.16.3.tgz#7ca624d517212ebc520a36873c3478fa66efbaf7"
integrity sha512-Zb4tGPANH4SW0LgC9+s9Mnequs9aqn7N3/pCqNbVjs2XhEF6yWNU2Vm4OGl1v2Go9nw8rXt87Cm2QN/o6Vpqgg== integrity sha512-cO1I/zmz4w2dcKHVvpCr7JVRu8/FymG5OEpmvsZYlccYolPBLoVGKUHgNoc4ZGkFeFlWGEDmMyBM+TTqRdW/wg==
data-urls@^2.0.0: data-urls@^2.0.0:
version "2.0.0" version "2.0.0"
@@ -3395,9 +3397,9 @@ throat@^5.0.0:
integrity sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA== integrity sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==
tmpl@1.0.x: tmpl@1.0.x:
version "1.0.4" version "1.0.5"
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc"
integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==
to-fast-properties@^2.0.0: to-fast-properties@^2.0.0:
version "2.0.0" version "2.0.0"