Skip to content

Commit d8823bf

Browse files
committed
switch to actions-toolkit implementation
Signed-off-by: CrazyMax <[email protected]>
1 parent 7944f9a commit d8823bf

18 files changed

+847
-1083
lines changed

.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"env": {
33
"node": true,
44
"es2021": true,
5-
"jest/globals": true
5+
"jest": true
66
},
77
"extends": [
88
"eslint:recommended",

.gitignore

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
node_modules
22
lib
33

4-
# Jetbrains
5-
/.idea
6-
/*.iml
7-
84
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
95
# Logs
106
logs

__mocks__/@actions/github.ts

+207
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
import {jest} from '@jest/globals';
2+
3+
export const context = {
4+
repo: {
5+
owner: 'docker',
6+
repo: 'build-push-action'
7+
},
8+
ref: 'refs/heads/master',
9+
runId: 123456789,
10+
payload: {
11+
after: '860c1904a1ce19322e91ac35af1ab07466440c37',
12+
base_ref: null,
13+
before: '5f3331d7f7044c18ca9f12c77d961c4d7cf3276a',
14+
commits: [
15+
{
16+
author: {
17+
18+
name: 'CrazyMax',
19+
username: 'crazy-max'
20+
},
21+
committer: {
22+
23+
name: 'CrazyMax',
24+
username: 'crazy-max'
25+
},
26+
distinct: true,
27+
id: '860c1904a1ce19322e91ac35af1ab07466440c37',
28+
message: 'hello dev',
29+
timestamp: '2022-04-19T11:27:24+02:00',
30+
tree_id: 'd2c60af597e863787d2d27f569e30495b0b92820',
31+
url: 'https://github.com/docker/test-docker-action/commit/860c1904a1ce19322e91ac35af1ab07466440c37'
32+
}
33+
],
34+
compare: 'https://github.com/docker/test-docker-action/compare/5f3331d7f704...860c1904a1ce',
35+
created: false,
36+
deleted: false,
37+
forced: false,
38+
head_commit: {
39+
author: {
40+
41+
name: 'CrazyMax',
42+
username: 'crazy-max'
43+
},
44+
committer: {
45+
46+
name: 'CrazyMax',
47+
username: 'crazy-max'
48+
},
49+
distinct: true,
50+
id: '860c1904a1ce19322e91ac35af1ab07466440c37',
51+
message: 'hello dev',
52+
timestamp: '2022-04-19T11:27:24+02:00',
53+
tree_id: 'd2c60af597e863787d2d27f569e30495b0b92820',
54+
url: 'https://github.com/docker/test-docker-action/commit/860c1904a1ce19322e91ac35af1ab07466440c37'
55+
},
56+
organization: {
57+
avatar_url: 'https://avatars.githubusercontent.com/u/5429470?v=4',
58+
description: 'Docker helps developers bring their ideas to life by conquering the complexity of app development.',
59+
events_url: 'https://api.github.com/orgs/docker/events',
60+
hooks_url: 'https://api.github.com/orgs/docker/hooks',
61+
id: 5429470,
62+
issues_url: 'https://api.github.com/orgs/docker/issues',
63+
login: 'docker',
64+
members_url: 'https://api.github.com/orgs/docker/members{/member}',
65+
node_id: 'MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=',
66+
public_members_url: 'https://api.github.com/orgs/docker/public_members{/member}',
67+
repos_url: 'https://api.github.com/orgs/docker/repos',
68+
url: 'https://api.github.com/orgs/docker'
69+
},
70+
pusher: {
71+
72+
name: 'crazy-max'
73+
},
74+
ref: 'refs/heads/dev',
75+
repository: {
76+
allow_forking: true,
77+
archive_url: 'https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}',
78+
archived: false,
79+
assignees_url: 'https://api.github.com/repos/docker/test-docker-action/assignees{/user}',
80+
blobs_url: 'https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}',
81+
branches_url: 'https://api.github.com/repos/docker/test-docker-action/branches{/branch}',
82+
clone_url: 'https://github.com/docker/test-docker-action.git',
83+
collaborators_url: 'https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}',
84+
comments_url: 'https://api.github.com/repos/docker/test-docker-action/comments{/number}',
85+
commits_url: 'https://api.github.com/repos/docker/test-docker-action/commits{/sha}',
86+
compare_url: 'https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}',
87+
contents_url: 'https://api.github.com/repos/docker/test-docker-action/contents/{+path}',
88+
contributors_url: 'https://api.github.com/repos/docker/test-docker-action/contributors',
89+
created_at: 1596792180,
90+
default_branch: 'master',
91+
deployments_url: 'https://api.github.com/repos/docker/test-docker-action/deployments',
92+
description: 'Test "Docker" Actions',
93+
disabled: false,
94+
downloads_url: 'https://api.github.com/repos/docker/test-docker-action/downloads',
95+
events_url: 'https://api.github.com/repos/docker/test-docker-action/events',
96+
fork: false,
97+
forks: 1,
98+
forks_count: 1,
99+
forks_url: 'https://api.github.com/repos/docker/test-docker-action/forks',
100+
full_name: 'docker/test-docker-action',
101+
git_commits_url: 'https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}',
102+
git_refs_url: 'https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}',
103+
git_tags_url: 'https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}',
104+
git_url: 'git://github.com/docker/test-docker-action.git',
105+
has_downloads: true,
106+
has_issues: true,
107+
has_pages: false,
108+
has_projects: true,
109+
has_wiki: true,
110+
homepage: '',
111+
hooks_url: 'https://api.github.com/repos/docker/test-docker-action/hooks',
112+
html_url: 'https://github.com/docker/test-docker-action',
113+
id: 285789493,
114+
is_template: false,
115+
issue_comment_url: 'https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}',
116+
issue_events_url: 'https://api.github.com/repos/docker/test-docker-action/issues/events{/number}',
117+
issues_url: 'https://api.github.com/repos/docker/test-docker-action/issues{/number}',
118+
keys_url: 'https://api.github.com/repos/docker/test-docker-action/keys{/key_id}',
119+
labels_url: 'https://api.github.com/repos/docker/test-docker-action/labels{/name}',
120+
language: 'JavaScript',
121+
languages_url: 'https://api.github.com/repos/docker/test-docker-action/languages',
122+
license: {
123+
key: 'mit',
124+
name: 'MIT License',
125+
node_id: 'MDc6TGljZW5zZTEz',
126+
spdx_id: 'MIT',
127+
url: 'https://api.github.com/licenses/mit'
128+
},
129+
master_branch: 'master',
130+
merges_url: 'https://api.github.com/repos/docker/test-docker-action/merges',
131+
milestones_url: 'https://api.github.com/repos/docker/test-docker-action/milestones{/number}',
132+
mirror_url: null,
133+
name: 'test-docker-action',
134+
node_id: 'MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=',
135+
notifications_url: 'https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}',
136+
open_issues: 6,
137+
open_issues_count: 6,
138+
organization: 'docker',
139+
owner: {
140+
avatar_url: 'https://avatars.githubusercontent.com/u/5429470?v=4',
141+
142+
events_url: 'https://api.github.com/users/docker/events{/privacy}',
143+
followers_url: 'https://api.github.com/users/docker/followers',
144+
following_url: 'https://api.github.com/users/docker/following{/other_user}',
145+
gists_url: 'https://api.github.com/users/docker/gists{/gist_id}',
146+
gravatar_id: '',
147+
html_url: 'https://github.com/docker',
148+
id: 5429470,
149+
login: 'docker',
150+
name: 'docker',
151+
node_id: 'MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=',
152+
organizations_url: 'https://api.github.com/users/docker/orgs',
153+
received_events_url: 'https://api.github.com/users/docker/received_events',
154+
repos_url: 'https://api.github.com/users/docker/repos',
155+
site_admin: false,
156+
starred_url: 'https://api.github.com/users/docker/starred{/owner}{/repo}',
157+
subscriptions_url: 'https://api.github.com/users/docker/subscriptions',
158+
type: 'Organization',
159+
url: 'https://api.github.com/users/docker'
160+
},
161+
private: true,
162+
pulls_url: 'https://api.github.com/repos/docker/test-docker-action/pulls{/number}',
163+
pushed_at: 1650360446,
164+
releases_url: 'https://api.github.com/repos/docker/test-docker-action/releases{/id}',
165+
size: 796,
166+
ssh_url: '[email protected]:docker/test-docker-action.git',
167+
stargazers: 0,
168+
stargazers_count: 0,
169+
stargazers_url: 'https://api.github.com/repos/docker/test-docker-action/stargazers',
170+
statuses_url: 'https://api.github.com/repos/docker/test-docker-action/statuses/{sha}',
171+
subscribers_url: 'https://api.github.com/repos/docker/test-docker-action/subscribers',
172+
subscription_url: 'https://api.github.com/repos/docker/test-docker-action/subscription',
173+
svn_url: 'https://github.com/docker/test-docker-action',
174+
tags_url: 'https://api.github.com/repos/docker/test-docker-action/tags',
175+
teams_url: 'https://api.github.com/repos/docker/test-docker-action/teams',
176+
topics: [],
177+
trees_url: 'https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}',
178+
updated_at: '2022-04-19T09:05:09Z',
179+
url: 'https://github.com/docker/test-docker-action',
180+
visibility: 'private',
181+
watchers: 0,
182+
watchers_count: 0
183+
},
184+
sender: {
185+
avatar_url: 'https://avatars.githubusercontent.com/u/1951866?v=4',
186+
events_url: 'https://api.github.com/users/crazy-max/events{/privacy}',
187+
followers_url: 'https://api.github.com/users/crazy-max/followers',
188+
following_url: 'https://api.github.com/users/crazy-max/following{/other_user}',
189+
gists_url: 'https://api.github.com/users/crazy-max/gists{/gist_id}',
190+
gravatar_id: '',
191+
html_url: 'https://github.com/crazy-max',
192+
id: 1951866,
193+
login: 'crazy-max',
194+
node_id: 'MDQ6VXNlcjE5NTE4NjY=',
195+
organizations_url: 'https://api.github.com/users/crazy-max/orgs',
196+
received_events_url: 'https://api.github.com/users/crazy-max/received_events',
197+
repos_url: 'https://api.github.com/users/crazy-max/repos',
198+
site_admin: false,
199+
starred_url: 'https://api.github.com/users/crazy-max/starred{/owner}{/repo}',
200+
subscriptions_url: 'https://api.github.com/users/crazy-max/subscriptions',
201+
type: 'User',
202+
url: 'https://api.github.com/users/crazy-max'
203+
}
204+
}
205+
};
206+
207+
export const getOctokit = jest.fn();

__tests__/buildx.test.ts

-146
This file was deleted.

0 commit comments

Comments
 (0)