mirror of
https://github.com/docker/metadata-action.git
synced 2024-11-22 20:15:41 +01:00
Merge pull request #142 from crazy-max/baseref-global-expr
`base_ref` global expression
This commit is contained in:
commit
110426b173
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1,2 +1,3 @@
|
|||||||
|
/__tests__/fixtures/** -linguist-detectable
|
||||||
/dist/** linguist-generated=true
|
/dist/** linguist-generated=true
|
||||||
/lib/** linguist-generated=true
|
/lib/** linguist-generated=true
|
||||||
|
@ -613,6 +613,7 @@ 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` |
|
| `{{date 'YYYYMMDD'}}` | `20210326` |
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
@ -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
|
||||||
|
488
__tests__/fixtures/event_pull_request.json
Normal file
488
__tests__/fixtures/event_pull_request.json
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
@ -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
|
||||||
|
181
__tests__/fixtures/event_push.json
Normal file
181
__tests__/fixtures/event_push.json
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
@ -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
|
||||||
|
162
__tests__/fixtures/event_tag_v1.1.1.json
Normal file
162
__tests__/fixtures/event_tag_v1.1.1.json
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
@ -586,18 +586,24 @@ describe('push', () => {
|
|||||||
tags: [
|
tags: [
|
||||||
`type=raw,value=mytag-{{branch}}`,
|
`type=raw,value=mytag-{{branch}}`,
|
||||||
`type=raw,value=mytag-{{date 'YYYYMMDD'}}`,
|
`type=raw,value=mytag-{{date 'YYYYMMDD'}}`,
|
||||||
`type=raw,value=mytag-{{tag}}`
|
`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-20200110', '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-20200110',
|
'user/app:mytag-20200110',
|
||||||
'user/app:mytag-'
|
'user/app:mytag-tag-',
|
||||||
|
'user/app:mytag-baseref-'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"org.opencontainers.image.title=Hello-World",
|
"org.opencontainers.image.title=Hello-World",
|
||||||
@ -1303,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",
|
||||||
@ -2226,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);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
10
dist/index.js
generated
vendored
10
dist/index.js
generated
vendored
@ -699,6 +699,16 @@ 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) {
|
date: function (format) {
|
||||||
return moment_1.default(currentDate).utc().format(format);
|
return moment_1.default(currentDate).utc().format(format);
|
||||||
}
|
}
|
||||||
|
@ -340,6 +340,15 @@ 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) {
|
date: function (format) {
|
||||||
return moment(currentDate).utc().format(format);
|
return moment(currentDate).utc().format(format);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user