mirror of
https://github.com/docker/metadata-action.git
synced 2025-04-04 09:10:25 +02:00
Compare commits
517 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
902fa8ec7d | ||
|
c30b9c27e6 | ||
|
0698804aab | ||
|
bb3eecaaf8 | ||
|
94a839cf6a | ||
|
ecd51a0f6a | ||
|
a85b1dbfe6 | ||
|
5a76a0efcf | ||
|
1cc4a9856a | ||
|
d84de1e022 | ||
|
092f0474e9 | ||
|
8b68062745 | ||
|
0eaca2ee4e | ||
|
db44dfae7a | ||
|
2bd8a81e96 | ||
|
10ff2155d8 | ||
|
a1a78f1e24 | ||
|
95438bc6e5 | ||
|
0e4a06e6a2 | ||
|
a550435c60 | ||
|
b539e14bf6 | ||
|
d931b83008 | ||
|
8e1d5461f0 | ||
|
2af3007824 | ||
|
0d820067b8 | ||
|
906ecf0fc0 | ||
|
f78c299c14 | ||
|
87ff116aea | ||
|
b53be03109 | ||
|
3da9c47fb9 | ||
|
f5d655ce8b | ||
|
369eb591f4 | ||
|
7d870ce854 | ||
|
e44a9cd788 | ||
|
8cb0002d6a | ||
|
e01ddd3e3c | ||
|
861d98a3bd | ||
|
359e915ab3 | ||
|
0c395ebe62 | ||
|
115662203e | ||
|
95ea8d0c40 | ||
|
a4c10ad2ed | ||
|
c85c22ab59 | ||
|
526d40319b | ||
|
86622a92ee | ||
|
44d81d6d2a | ||
|
9aaeb628e0 | ||
|
32323e53fe | ||
|
3d8d1d9406 | ||
|
1b250aecdc | ||
|
bd26c982ee | ||
|
f574002aaf | ||
|
30c2f0a1f0 | ||
|
0de3687b53 | ||
|
3229e62531 | ||
|
f829da7245 | ||
|
9b90a2e882 | ||
|
aa662cf9eb | ||
|
c6cb763bee | ||
|
bb9c6dd583 | ||
|
d31acd5065 | ||
|
6df88e4e75 | ||
|
70b2cdc648 | ||
|
1a52488bd8 | ||
|
60a0d343a0 | ||
|
b3bc5a6d84 | ||
|
e6e95c28a4 | ||
|
9ec63a7555 | ||
|
6970301b80 | ||
|
d155f767a3 | ||
|
b5b2c1dec6 | ||
|
a64d0487d7 | ||
|
68e4cac93d | ||
|
7ba3606742 | ||
|
2331fdf258 | ||
|
24ce540669 | ||
|
d729db4f91 | ||
|
f7b4ed1238 | ||
|
33c4e25305 | ||
|
b83177b368 | ||
|
839b70f9d5 | ||
|
dbacb9a831 | ||
|
247cc9691a | ||
|
4c92c35ca9 | ||
|
9ca1efb941 | ||
|
0170173c39 | ||
|
dab39f1537 | ||
|
f402fd6ae4 | ||
|
b0bbce7f66 | ||
|
2ee3d3070b | ||
|
6e3a986a06 | ||
|
4fde7ad49c | ||
|
24b670ad98 | ||
|
1294d94f8e | ||
|
4ab8e580e1 | ||
|
3617daf484 | ||
|
b5cd5676d4 | ||
|
204ddf0626 | ||
|
588ab464f7 | ||
|
6ed49e6282 | ||
|
499da83ec1 | ||
|
1bc39885c1 | ||
|
c314eea2b2 | ||
|
22d80c023d | ||
|
38b3677383 | ||
|
3c91de3093 | ||
|
75359341f6 | ||
|
2432cf717c | ||
|
c77859c8ba | ||
|
60ab7b421c | ||
|
7ce1a14667 | ||
|
d06e52bc52 | ||
|
66f0185bb8 | ||
|
232fc64e3a | ||
|
1b08479748 | ||
|
3a28db68be | ||
|
6bb43c8680 | ||
|
41050ffe08 | ||
|
8e5442c4ef | ||
|
eda41b71bf | ||
|
388c08f740 | ||
|
dbef88086f | ||
|
b73e7a71ac | ||
|
b9fba690eb | ||
|
ac82374ba6 | ||
|
c92519a44e | ||
|
3b4179d34d | ||
|
0784993ef8 | ||
|
52c3e9e410 | ||
|
82a5e6726c | ||
|
41e1fe3437 | ||
|
48cce1cba0 | ||
|
61879b94bc | ||
|
36ea4ee555 | ||
|
74fa878183 | ||
|
9dc751fe24 | ||
|
c94c54c4e6 | ||
|
187f09259d | ||
|
6d6eaf3451 | ||
|
1484a7ec95 | ||
|
31cebacef4 | ||
|
394bbab10c | ||
|
ee4c9054ec | ||
|
e6428a5c4e | ||
|
26b4721af7 | ||
|
352ce8b7fe | ||
|
cb0becceaf | ||
|
91224bc155 | ||
|
f19c3691d5 | ||
|
4066f0cede | ||
|
d6a296c454 | ||
|
aacea38e07 | ||
|
051f7ea71b | ||
|
2fc083a3a4 | ||
|
488568d6fa | ||
|
f33ad1e20d | ||
|
6bbe00c7bc | ||
|
f0ad8701de | ||
|
2a4836ac76 | ||
|
9bdb15d11e | ||
|
b94479639a | ||
|
f3c3cad8ad | ||
|
3b632771f9 | ||
|
62339db73c | ||
|
f13510ee59 | ||
|
6796a85d36 | ||
|
1ec392100e | ||
|
15f2689f92 | ||
|
ad9adab519 | ||
|
28aeae210e | ||
|
5f160a25bd | ||
|
05d3089a30 | ||
|
b8c52fa5a7 | ||
|
fa851f2008 | ||
|
879dcbb708 | ||
|
167d566053 | ||
|
6dfb6f1404 | ||
|
62a438bd07 | ||
|
ee5ff41fc8 | ||
|
c0f15f0bfe | ||
|
2c2bddef07 | ||
|
00dcdd5da5 | ||
|
bd87541fe8 | ||
|
b87668a573 | ||
|
407b95c632 | ||
|
0668f8e3c4 | ||
|
d0efd7f63f | ||
|
672cd7b637 | ||
|
1f35ebc704 | ||
|
413e9a9a6a | ||
|
96383f4557 | ||
|
f138b9677b | ||
|
9cf7015b15 | ||
|
5a8a5ff8df | ||
|
2279d9af58 | ||
|
c659933213 | ||
|
48d23ccc05 | ||
|
b83ffb48d6 | ||
|
3207f2405f | ||
|
63f4a263e5 | ||
|
547dcd6d67 | ||
|
450eef4207 | ||
|
903f5af663 | ||
|
3634bd57d7 | ||
|
d3faf0d1af | ||
|
ff376f4737 | ||
|
79f06a31c0 | ||
|
6f69513dab | ||
|
b67fef219a | ||
|
51990f24d1 | ||
|
4af6ba2231 | ||
|
59de4866c5 | ||
|
0f8c876baf | ||
|
389ff6bdd5 | ||
|
2bcfca25d5 | ||
|
05b244eb76 | ||
|
35e9aff4f5 | ||
|
1586898b63 | ||
|
7a273586e1 | ||
|
ef25336f42 | ||
|
0ab15faee8 | ||
|
1ea1b02f9b | ||
|
818d4b7b91 | ||
|
948134af5e | ||
|
ef7eee951a | ||
|
8ec80c3be6 | ||
|
38650bbf6b | ||
|
ebbd9b4df7 | ||
|
2dadb92b6b | ||
|
2c0bd771b4 | ||
|
b10b364e15 | ||
|
40a1c6ff52 | ||
|
be8ea87c5a | ||
|
dbbf01822b | ||
|
72b4ec2b60 | ||
|
00e2c9d34e | ||
|
c4ee3adeed | ||
|
3bea1eeada | ||
|
88c7f0d3f6 | ||
|
101f9cbeaf | ||
|
0e44559303 | ||
|
517f8b0c3b | ||
|
bfaa9197f7 | ||
|
16dbdc96f6 | ||
|
bf095b87d3 | ||
|
2ed3c45f27 | ||
|
5076359ba6 | ||
|
d8f57c18fa | ||
|
80530e08c5 | ||
|
da933fb889 | ||
|
3f6690a76c | ||
|
dda839d15b | ||
|
37f1d84442 | ||
|
1ce942256d | ||
|
8f8c795666 | ||
|
9ec57ed1fc | ||
|
2bdac1078b | ||
|
9e02960866 | ||
|
ea910e3ad4 | ||
|
8b6629002b | ||
|
1db8e21e35 | ||
|
b30cff8c11 | ||
|
916b4b90e3 | ||
|
0ef9f130fa | ||
|
f5c49ece12 | ||
|
18df8a69c4 | ||
|
3343011071 | ||
|
0524f79273 | ||
|
b5c378621c | ||
|
a103499e09 | ||
|
766400ca14 | ||
|
e2ffd4cc94 | ||
|
6c3ca5dfa6 | ||
|
235becadd8 | ||
|
507c2f2dc5 | ||
|
04861f5102 | ||
|
6729545cde | ||
|
05d22bf317 | ||
|
70b403b46b | ||
|
9e6ae02878 | ||
|
3d239e8b8a | ||
|
7cb52e2750 | ||
|
90a1d5cf21 | ||
|
c98ac5e987 | ||
|
44d853bc0a | ||
|
d1abf80723 | ||
|
3358a27538 | ||
|
314ddf6d4a | ||
|
b91e8f52b0 | ||
|
fbac5f9bca | ||
|
57396166ad | ||
|
473bdc561c | ||
|
ebedea2c18 | ||
|
d00b20e38f | ||
|
a99e71cdc7 | ||
|
12cce9efe0 | ||
|
f17e188860 | ||
|
210d783f42 | ||
|
5f26473e44 | ||
|
49e79e3532 | ||
|
5ebec4fd21 | ||
|
8ed470c7f1 | ||
|
61ddee1921 | ||
|
8671a4f8ec | ||
|
3862a1b70f | ||
|
f7c31b1e79 | ||
|
55b0d953e7 | ||
|
4c6a2cafd0 | ||
|
6c51f019f8 | ||
|
5c9aa83b20 | ||
|
30af4d7327 | ||
|
594a555a35 | ||
|
7fa87ab51a | ||
|
02d1a10cce | ||
|
58061722cc | ||
|
1c9aacf050 | ||
|
1f87faac28 | ||
|
59bc9ddfd5 | ||
|
286660a061 | ||
|
139c7584e2 | ||
|
ee266832e5 | ||
|
ae052be62f | ||
|
98045504c7 | ||
|
97c170d70b | ||
|
44ecceaf69 | ||
|
e4d14b2070 | ||
|
f66710ef6c | ||
|
d6cc766711 | ||
|
9c37b1c855 | ||
|
e518b0e7bb | ||
|
7bf589e898 | ||
|
bc6cb60a8a | ||
|
4db6eea5ea | ||
|
b5ee2f25f6 | ||
|
8d56fe93cf | ||
|
59267481d9 | ||
|
69f6fc9d46 | ||
|
2f5b5ae8bf | ||
|
f206c36955 | ||
|
a20adfa74e | ||
|
26b9439ce3 | ||
|
467883f452 | ||
|
5edf56f2c4 | ||
|
678218f2be | ||
|
e44c1fbe6e | ||
|
b2391d37b4 | ||
|
2f4dd1462a | ||
|
a5680a6642 | ||
|
be6d2cc1df | ||
|
0a72be43da | ||
|
72fe50e2af | ||
|
aca951f8f5 | ||
|
0978a0678a | ||
|
c2905fbd8c | ||
|
7d7a22a682 | ||
|
89bf6c030f | ||
|
e1a45f6e54 | ||
|
535130561a | ||
|
4b640abb3a | ||
|
b7ad32e4f5 | ||
|
2a96a96c9c | ||
|
a3ea951e65 | ||
|
476e707f24 | ||
|
e29c9db4aa | ||
|
7fa3798e58 | ||
|
ba827041a4 | ||
|
0950af0d7c | ||
|
5f62bc0532 | ||
|
d0dafecc74 | ||
|
f2a13332ac | ||
|
56b3641ca3 | ||
|
6738eba24d | ||
|
0d161f4ba7 | ||
|
0504cbc543 | ||
|
0569027ca5 | ||
|
04da149653 | ||
|
2f5d0666ec | ||
|
776adc0187 | ||
|
96b9d26bf5 | ||
|
1237c3e3d6 | ||
|
e99ab50e6c | ||
|
47c365107c | ||
|
f3476d2252 | ||
|
c6cd4388a1 | ||
|
9b5093b231 | ||
|
5485056c35 | ||
|
51c741cfbc | ||
|
14422d356e | ||
|
1068b75f65 | ||
|
a66dbeb1e8 | ||
|
f3c886e26b | ||
|
535a299de5 | ||
|
2cad85de24 | ||
|
5949fa2b94 | ||
|
e5622373a3 | ||
|
aad230bbd9 | ||
|
6d7c94a41e | ||
|
52100c89dd | ||
|
9a42503205 | ||
|
a2e02890a0 | ||
|
59e3d70a23 | ||
|
5220b23112 | ||
|
8d0937e440 | ||
|
548e2346a9 | ||
|
b69dce7fed | ||
|
110426b173 | ||
|
09666f941b | ||
|
a287d15e54 | ||
|
7e983ea6f6 | ||
|
4f95a04c21 | ||
|
48b55c14a8 | ||
|
b1925560ed | ||
|
09dffb9c1c | ||
|
2d7c9d2045 | ||
|
c4edafbb78 | ||
|
931213b773 | ||
|
be7d35970b | ||
|
70fc13ca64 | ||
|
6d43bfb301 | ||
|
59b75ee1a1 | ||
|
c729e26a57 | ||
|
f595d60eab | ||
|
22924852dc | ||
|
3a3bb3a817 | ||
|
6200091c0f | ||
|
d26b8cd003 | ||
|
03cec7cbca | ||
|
e4f548552d | ||
|
a67f45cb0f | ||
|
66b9054417 | ||
|
b127c18eb4 | ||
|
401bfc308e | ||
|
ad2fba2495 | ||
|
8b842e721d | ||
|
4cb9252fa6 | ||
|
f6efe56d56 | ||
|
c15e83fc17 | ||
|
6c228c637c | ||
|
a1770d2eba | ||
|
8a0bc9fddd | ||
|
375e313280 | ||
|
aa7478bca1 | ||
|
02e4d042a9 | ||
|
49953f2c88 | ||
|
46312756ac | ||
|
d43d662db8 | ||
|
98bffa7b6d | ||
|
94c9b333c5 | ||
|
32a4b475ff | ||
|
98669ae865 | ||
|
85f4f732f2 | ||
|
013e892d4a | ||
|
4a03258546 | ||
|
3c951ec458 | ||
|
84dbd57663 | ||
|
28d7c8bbcd | ||
|
e5c54f2159 | ||
|
4742d2f661 | ||
|
d605601d46 | ||
|
9987462005 | ||
|
4d088f5efc | ||
|
e856afadf9 | ||
|
e6f3e4aa91 | ||
|
01dc739d69 | ||
|
a1417fcdec | ||
|
12528c4f05 | ||
|
8841ef4bb7 | ||
|
2af9c6a52b | ||
|
1239e23120 | ||
|
8d3d13fe48 | ||
|
ed01528979 | ||
|
c8b87a08b5 | ||
|
280367084a | ||
|
c0bab712bd | ||
|
9ceaaf86cd | ||
|
f02d9f4f9b | ||
|
400bd87b5a | ||
|
e4fc7e9e11 | ||
|
9583a0f404 | ||
|
5e6d5157fb | ||
|
e09df4df3c | ||
|
72e5d60481 | ||
|
ae431178c1 | ||
|
34ebfd6e6b | ||
|
94641ff1bb | ||
|
40bfc8b527 | ||
|
2e1a5c7fa4 | ||
|
1a678de43d | ||
|
84b9e75d44 | ||
|
f39f06a624 | ||
|
36ae18e02c | ||
|
e87dd9466c | ||
|
9da1e66de9 | ||
|
521a3c5ada | ||
|
7433b42479 | ||
|
1a8a264b95 | ||
|
e04b4d01a9 | ||
|
ac90ddf06e | ||
|
972129059a | ||
|
b909bd34ef | ||
|
72654174f7 | ||
|
4545671ec8 | ||
|
5c38e5df03 | ||
|
2cbde9dffa | ||
|
2f83320d17 | ||
|
9be43f076d | ||
|
d541d2c17f | ||
|
cffefcd230 | ||
|
00e310993c | ||
|
e696b8439a | ||
|
b334567bf3 | ||
|
7b49f7ed90 | ||
|
e08ef4ca63 | ||
|
5f29dbc7d7 | ||
|
94e634192d | ||
|
cae03854eb | ||
|
0a412843f8 |
@ -1,5 +1,12 @@
|
||||
/.dev
|
||||
/coverage
|
||||
/dist
|
||||
/lib
|
||||
/node_modules
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# yarn v2
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
3
.eslintignore
Normal file
3
.eslintignore
Normal file
@ -0,0 +1,3 @@
|
||||
/dist/**
|
||||
/coverage/**
|
||||
/node_modules/**
|
24
.eslintrc.json
Normal file
24
.eslintrc.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true,
|
||||
"jest": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:jest/recommended",
|
||||
"plugin:prettier/recommended"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2023,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"@typescript-eslint",
|
||||
"jest",
|
||||
"prettier"
|
||||
]
|
||||
}
|
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -1,2 +1,5 @@
|
||||
/.yarn/releases/** binary
|
||||
/.yarn/plugins/** binary
|
||||
/__tests__/fixtures/** -linguist-detectable
|
||||
/dist/** linguist-generated=true
|
||||
/lib/** linguist-generated=true
|
||||
|
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@ -1 +0,0 @@
|
||||
* @crazy-max
|
3
.github/CODE_OF_CONDUCT.md
vendored
Normal file
3
.github/CODE_OF_CONDUCT.md
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Code of conduct
|
||||
|
||||
- [Moby community guidelines](https://github.com/moby/moby/blob/master/CONTRIBUTING.md#moby-community-guidelines)
|
10
.github/CONTRIBUTING.md
vendored
10
.github/CONTRIBUTING.md
vendored
@ -2,19 +2,19 @@
|
||||
|
||||
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
|
||||
|
||||
Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license)
|
||||
Contributions to this project are [released](https://docs.github.com/en/github/site-policy/github-terms-of-service#6-contributions-under-repository-license)
|
||||
to the public under the [project's open source license](LICENSE).
|
||||
|
||||
## Submitting a pull request
|
||||
|
||||
1. [Fork](https://github.com/crazy-max/ghaction-docker-meta/fork) and clone the repository
|
||||
1. [Fork](https://github.com/docker/metadata-action/fork) and clone the repository
|
||||
2. Configure and install the dependencies: `yarn install`
|
||||
3. Create a new branch: `git checkout -b my-branch-name`
|
||||
4. Make your changes
|
||||
5. Make sure the tests pass: `docker buildx bake test`
|
||||
6. Format code and build javascript artifacts: `docker buildx bake pre-checkin`
|
||||
7. Validate all code has correctly formatted and built: `docker buildx bake validate`
|
||||
8. Push to your fork and [submit a pull request](https://github.com/crazy-max/ghaction-docker-meta/compare)
|
||||
8. Push to your fork and [submit a pull request](https://github.com/docker/metadata-action/compare)
|
||||
9. Pat your self on the back and wait for your pull request to be reviewed and merged.
|
||||
|
||||
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
|
||||
@ -28,5 +28,5 @@ Here are a few things you can do that will increase the likelihood of your pull
|
||||
## Resources
|
||||
|
||||
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
|
||||
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
|
||||
- [GitHub Help](https://help.github.com)
|
||||
- [Using Pull Requests](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests)
|
||||
- [GitHub Help](https://docs.github.com/en)
|
||||
|
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@ -1,2 +0,0 @@
|
||||
github: crazy-max
|
||||
custom: https://www.paypal.me/crazyws
|
101
.github/ISSUE_TEMPLATE/bug.yml
vendored
Normal file
101
.github/ISSUE_TEMPLATE/bug.yml
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
|
||||
name: Bug Report
|
||||
description: Report a bug
|
||||
labels:
|
||||
- status/triage
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for taking the time to report a bug!
|
||||
If this is a security issue please report it to the [Docker Security team](mailto:security@docker.com).
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Contributing guidelines
|
||||
description: >
|
||||
Make sure you've read the contributing guidelines before proceeding.
|
||||
options:
|
||||
- label: I've read the [contributing guidelines](https://github.com/docker/metadata-action/blob/master/.github/CONTRIBUTING.md) and wholeheartedly agree
|
||||
required: true
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: "I've found a bug, and:"
|
||||
description: |
|
||||
Make sure that your request fulfills all of the following requirements.
|
||||
If one requirement cannot be satisfied, explain in detail why.
|
||||
options:
|
||||
- label: The documentation does not mention anything about my problem
|
||||
- label: There are no open or closed issues that are related to my problem
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Description
|
||||
description: >
|
||||
Provide a brief description of the bug in 1-2 sentences.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Expected behaviour
|
||||
description: >
|
||||
Describe precisely what you'd expect to happen.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Actual behaviour
|
||||
description: >
|
||||
Describe precisely what is actually happening.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Repository URL
|
||||
description: >
|
||||
Enter the URL of the repository where you are experiencing the
|
||||
issue. If your repository is private, provide a link to a minimal
|
||||
repository that reproduces the issue.
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Workflow run URL
|
||||
description: >
|
||||
Enter the URL of the GitHub Action workflow run if public (e.g.
|
||||
`https://github.com/<user>/<repo>/actions/runs/<id>`)
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: YAML workflow
|
||||
description: |
|
||||
Provide the YAML of the workflow that's causing the issue.
|
||||
Make sure to remove any sensitive information.
|
||||
render: yaml
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Workflow logs
|
||||
description: >
|
||||
[Attach](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/attaching-files)
|
||||
the [log file of your workflow run](https://docs.github.com/en/actions/managing-workflow-runs/using-workflow-run-logs#downloading-logs)
|
||||
and make sure to remove any sensitive information.
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: BuildKit logs
|
||||
description: >
|
||||
If applicable, provide the [BuildKit container logs](https://docs.docker.com/build/ci/github-actions/configure-builder/#buildkit-container-logs)
|
||||
render: text
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional info
|
||||
description: |
|
||||
Provide any additional information that could be useful.
|
33
.github/ISSUE_TEMPLATE/bug_report.md
vendored
33
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -1,33 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
---
|
||||
|
||||
### Behaviour
|
||||
|
||||
#### Steps to reproduce this issue
|
||||
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
#### Expected behaviour
|
||||
|
||||
> Tell me what should happen
|
||||
|
||||
#### Actual behaviour
|
||||
|
||||
> Tell me what happens instead
|
||||
|
||||
### Configuration
|
||||
|
||||
* Repository URL (if public):
|
||||
* Build URL (if public):
|
||||
|
||||
```yml
|
||||
# paste your YAML workflow file here and remove sensitive data
|
||||
```
|
||||
|
||||
### Logs
|
||||
|
||||
> Download the [log file of your build](https://help.github.com/en/actions/configuring-and-managing-workflows/managing-a-workflow-run#downloading-logs) and [attach it](https://help.github.com/en/github/managing-your-work-on-github/file-attachments-on-issues-and-pull-requests) to this issue.
|
9
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
9
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
|
||||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
- name: Questions and Discussions
|
||||
url: https://github.com/docker/metadata-action/discussions/new
|
||||
about: Use Github Discussions to ask questions and/or open discussion topics.
|
||||
- name: Documentation
|
||||
url: https://docs.docker.com/build/ci/github-actions/
|
||||
about: Read the documentation.
|
15
.github/ISSUE_TEMPLATE/feature.yml
vendored
Normal file
15
.github/ISSUE_TEMPLATE/feature.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
|
||||
name: Feature request
|
||||
description: Missing functionality? Come tell us about it!
|
||||
labels:
|
||||
- kind/enhancement
|
||||
- status/triage
|
||||
|
||||
body:
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: What is the feature you want to see?
|
||||
validations:
|
||||
required: true
|
12
.github/SECURITY.md
vendored
Normal file
12
.github/SECURITY.md
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
# Reporting security issues
|
||||
|
||||
The project maintainers take security seriously. If you discover a security
|
||||
issue, please bring it to their attention right away!
|
||||
|
||||
**Please _DO NOT_ file a public issue**, instead send your report privately to
|
||||
[security@docker.com](mailto:security@docker.com).
|
||||
|
||||
Security reports are greatly appreciated, and we will publicly thank you for it.
|
||||
We also like to send gifts—if you'd like Docker swag, make sure to let
|
||||
us know. We currently do not offer a paid security bounty program, but are not
|
||||
ruling it out in the future.
|
29
.github/SUPPORT.md
vendored
29
.github/SUPPORT.md
vendored
@ -1,29 +0,0 @@
|
||||
# Support [](https://isitmaintained.com/project/crazy-max/ghaction-docker-meta)
|
||||
|
||||
## Reporting an issue
|
||||
|
||||
Please do a search in [open issues](https://github.com/crazy-max/ghaction-docker-meta/issues?utf8=%E2%9C%93&q=) to see if the issue or feature request has already been filed.
|
||||
|
||||
If you find your issue already exists, make relevant comments and add your [reaction](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments). Use a reaction in place of a "+1" comment.
|
||||
|
||||
:+1: - upvote
|
||||
|
||||
:-1: - downvote
|
||||
|
||||
If you cannot find an existing issue that describes your bug or feature, submit an issue using the guidelines below.
|
||||
|
||||
## Writing good bug reports and feature requests
|
||||
|
||||
File a single issue per problem and feature request.
|
||||
|
||||
* Do not enumerate multiple bugs or feature requests in the same issue.
|
||||
* Do not add your issue as a comment to an existing issue unless it's for the identical input. Many issues look similar, but have different causes.
|
||||
|
||||
The more information you can provide, the more likely someone will be successful reproducing the issue and finding a fix.
|
||||
|
||||
You are now ready to [create a new issue](https://github.com/crazy-max/ghaction-docker-meta/issues/new/choose)!
|
||||
|
||||
## Closure policy
|
||||
|
||||
* Issues that don't have the information requested above (when applicable) will be closed immediately and the poster directed to the support guidelines.
|
||||
* Issues that go a week without a response from original poster are subject to closure at my discretion.
|
13
.github/dependabot.yml
vendored
13
.github/dependabot.yml
vendored
@ -4,19 +4,16 @@ updates:
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
time: "06:00"
|
||||
timezone: "Europe/Paris"
|
||||
labels:
|
||||
- ":game_die: dependencies"
|
||||
- ":robot: bot"
|
||||
- "dependencies"
|
||||
- "bot"
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
time: "06:00"
|
||||
timezone: "Europe/Paris"
|
||||
versioning-strategy: "increase"
|
||||
allow:
|
||||
- dependency-type: "production"
|
||||
labels:
|
||||
- ":game_die: dependencies"
|
||||
- ":robot: bot"
|
||||
- "dependencies"
|
||||
- "bot"
|
||||
|
BIN
.github/ghaction-docker-meta.png
vendored
BIN
.github/ghaction-docker-meta.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 6.5 KiB |
77
.github/labels.yml
vendored
77
.github/labels.yml
vendored
@ -1,77 +0,0 @@
|
||||
## more info https://github.com/crazy-max/ghaction-github-labeler
|
||||
- # automerge
|
||||
name: ":bell: automerge"
|
||||
color: "8f4fbc"
|
||||
description: ""
|
||||
- # bot
|
||||
name: ":robot: bot"
|
||||
color: "69cde9"
|
||||
description: ""
|
||||
- # bug
|
||||
name: ":bug: bug"
|
||||
color: "b60205"
|
||||
description: ""
|
||||
- # dependencies
|
||||
name: ":game_die: dependencies"
|
||||
color: "0366d6"
|
||||
description: ""
|
||||
- # documentation
|
||||
name: ":memo: documentation"
|
||||
color: "c5def5"
|
||||
description: ""
|
||||
- # duplicate
|
||||
name: ":busts_in_silhouette: duplicate"
|
||||
color: "cccccc"
|
||||
description: ""
|
||||
- # enhancement
|
||||
name: ":sparkles: enhancement"
|
||||
color: "0054ca"
|
||||
description: ""
|
||||
- # feature request
|
||||
name: ":bulb: feature request"
|
||||
color: "0e8a16"
|
||||
description: ""
|
||||
- # feedback
|
||||
name: ":mega: feedback"
|
||||
color: "03a9f4"
|
||||
description: ""
|
||||
- # future maybe
|
||||
name: ":rocket: future maybe"
|
||||
color: "fef2c0"
|
||||
description: ""
|
||||
- # good first issue
|
||||
name: ":hatching_chick: good first issue"
|
||||
color: "7057ff"
|
||||
description: ""
|
||||
- # help wanted
|
||||
name: ":pray: help wanted"
|
||||
color: "4caf50"
|
||||
description: ""
|
||||
- # hold
|
||||
name: ":hand: hold"
|
||||
color: "24292f"
|
||||
description: ""
|
||||
- # invalid
|
||||
name: ":no_entry_sign: invalid"
|
||||
color: "e6e6e6"
|
||||
description: ""
|
||||
- # maybe bug
|
||||
name: ":interrobang: maybe bug"
|
||||
color: "ff5722"
|
||||
description: ""
|
||||
- # needs more info
|
||||
name: ":thinking: needs more info"
|
||||
color: "795548"
|
||||
description: ""
|
||||
- # question
|
||||
name: ":question: question"
|
||||
color: "3f51b5"
|
||||
description: ""
|
||||
- # upstream
|
||||
name: ":eyes: upstream"
|
||||
color: "fbca04"
|
||||
description: ""
|
||||
- # wontfix
|
||||
name: ":coffin: wontfix"
|
||||
color: "ffffff"
|
||||
description: ""
|
BIN
.github/metadata-action.png
vendored
Normal file
BIN
.github/metadata-action.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
18
.github/stale.yml
vendored
18
.github/stale.yml
vendored
@ -1,18 +0,0 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 30
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 7
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- ":hand: hold"
|
||||
# Set to true to ignore issues in a milestone (defaults to false)
|
||||
exemptMilestones: true
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: ":skull: stale"
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: false
|
539
.github/workflows/ci.yml
vendored
539
.github/workflows/ci.yml
vendored
@ -1,25 +1,55 @@
|
||||
name: ci
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 */4 * * *' # every 4 hours
|
||||
- cron: '0 10 * * *'
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
- 'master'
|
||||
- 'releases/v*'
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
DOCKER_IMAGE: localhost:5000/name/app
|
||||
BUILDX_VERSION: latest
|
||||
|
||||
jobs:
|
||||
context:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
context:
|
||||
- workflow
|
||||
- git
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Docker meta
|
||||
uses: ./
|
||||
with:
|
||||
context: ${{ matrix.context }}
|
||||
|
||||
multi-images:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: ${{ env.BUILDX_VERSION }}
|
||||
driver: docker
|
||||
-
|
||||
name: Docker meta
|
||||
uses: ./
|
||||
@ -27,7 +57,15 @@ jobs:
|
||||
images: |
|
||||
${{ env.DOCKER_IMAGE }}
|
||||
ghcr.io/name/app
|
||||
tag-sha: true
|
||||
tags: |
|
||||
type=schedule
|
||||
type=ref,event=branch
|
||||
type=ref,event=tag
|
||||
type=ref,event=pr
|
||||
type=sha
|
||||
-
|
||||
name: Print envs
|
||||
run: env|sort
|
||||
|
||||
tag-schedule:
|
||||
runs-on: ubuntu-latest
|
||||
@ -42,7 +80,13 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: ${{ env.BUILDX_VERSION }}
|
||||
driver: docker
|
||||
-
|
||||
name: Docker meta
|
||||
uses: ./
|
||||
@ -50,8 +94,12 @@ jobs:
|
||||
images: |
|
||||
${{ env.DOCKER_IMAGE }}
|
||||
ghcr.io/name/app
|
||||
tag-sha: true
|
||||
tag-schedule: ${{ matrix.tag-schedule }}
|
||||
tags: |
|
||||
type=schedule,pattern=${{ matrix.tag-schedule }}
|
||||
type=ref,event=branch
|
||||
type=ref,event=tag
|
||||
type=ref,event=pr
|
||||
type=sha
|
||||
|
||||
tag-match:
|
||||
runs-on: ubuntu-latest
|
||||
@ -59,16 +107,22 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- tag-match: '\d{1,3}.\d{1,3}.\d{1,3}'
|
||||
- tag-match: '\d.\d.\d'
|
||||
tag-match-group: '0'
|
||||
- tag-match: '\d{1,3}.\d{1,3}'
|
||||
- tag-match: '\d.\d'
|
||||
tag-match-group: '0'
|
||||
- tag-match: 'v(.*)'
|
||||
tag-match-group: '1'
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: ${{ env.BUILDX_VERSION }}
|
||||
driver: docker
|
||||
-
|
||||
name: Docker meta
|
||||
uses: ./
|
||||
@ -76,22 +130,33 @@ jobs:
|
||||
images: |
|
||||
${{ env.DOCKER_IMAGE }}
|
||||
ghcr.io/name/app
|
||||
tag-sha: true
|
||||
tag-match: ${{ matrix.tag-match }}
|
||||
tag-match-group: ${{ matrix.tag-match-group }}
|
||||
tags: |
|
||||
type=schedule
|
||||
type=ref,event=branch
|
||||
type=ref,event=tag
|
||||
type=ref,event=pr
|
||||
type=match,"pattern=${{ matrix.tag-match }}",group=${{ matrix.tag-match-group }}
|
||||
type=sha
|
||||
|
||||
tag-semver:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
tag-latest:
|
||||
- 'true'
|
||||
- 'false'
|
||||
flavor-latest:
|
||||
- "auto"
|
||||
- "true"
|
||||
- "false"
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: ${{ env.BUILDX_VERSION }}
|
||||
driver: docker
|
||||
-
|
||||
name: Docker meta
|
||||
uses: ./
|
||||
@ -99,18 +164,30 @@ jobs:
|
||||
images: |
|
||||
${{ env.DOCKER_IMAGE }}
|
||||
ghcr.io/name/app
|
||||
tag-semver: |
|
||||
{{raw}}
|
||||
{{version}}
|
||||
{{major}}.{{minor}}.{{patch}}
|
||||
tag-latest: ${{ matrix.tag-latest }}
|
||||
tags: |
|
||||
type=schedule
|
||||
type=ref,event=branch
|
||||
type=ref,event=tag
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{raw}}
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}.{{patch}}
|
||||
type=sha
|
||||
flavor: |
|
||||
latest=${{ matrix.flavor-latest }}
|
||||
|
||||
label-custom:
|
||||
flavor:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: ${{ env.BUILDX_VERSION }}
|
||||
driver: docker
|
||||
-
|
||||
name: Docker meta
|
||||
uses: ./
|
||||
@ -118,11 +195,119 @@ jobs:
|
||||
images: |
|
||||
${{ env.DOCKER_IMAGE }}
|
||||
ghcr.io/name/app
|
||||
label-custom: |
|
||||
flavor: |
|
||||
prefix=foo-
|
||||
suffix=-bar
|
||||
|
||||
images:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: ${{ env.BUILDX_VERSION }}
|
||||
driver: docker
|
||||
-
|
||||
name: Docker meta
|
||||
uses: ./
|
||||
with:
|
||||
images: |
|
||||
name=${{ env.DOCKER_IMAGE }}
|
||||
name=ghcr.io/name/app,enable=${{ github.event_name == 'pull_request' }}
|
||||
name=ghcr.io/name/release,enable=${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
|
||||
custom-labels-annotations:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: ${{ env.BUILDX_VERSION }}
|
||||
driver: docker
|
||||
-
|
||||
name: Docker meta
|
||||
uses: ./
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKER_IMAGE }}
|
||||
ghcr.io/name/app
|
||||
labels: |
|
||||
maintainer=CrazyMax
|
||||
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
|
||||
annotations: |
|
||||
maintainer=Foo
|
||||
org.opencontainers.image.title=MyFooTitle
|
||||
org.opencontainers.image.description=this is a "foo" example
|
||||
org.opencontainers.image.vendor=MyFooCompany
|
||||
|
||||
global-exps:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: ${{ env.BUILDX_VERSION }}
|
||||
driver: docker
|
||||
-
|
||||
name: Docker meta
|
||||
uses: ./
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKER_IMAGE }}
|
||||
ghcr.io/name/app
|
||||
labels: |
|
||||
org.opencontainers.image.created={{commit_date 'YYYY-MM-DDTHH:mm:ss.SSS[Z]'}}
|
||||
tags: |
|
||||
type=sha
|
||||
type=raw,value=gexp-branch-{{branch}}
|
||||
type=raw,value=gexp-date-{{date 'YYYYMMDD'}}
|
||||
type=raw,value=gexp-tag-{{tag}}
|
||||
type=raw,value=gexp-baseref-{{base_ref}}
|
||||
type=raw,value=gexp-defbranch,enable={{is_default_branch}}
|
||||
|
||||
json:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: ${{ env.BUILDX_VERSION }}
|
||||
driver: docker
|
||||
-
|
||||
name: Docker meta
|
||||
id: meta
|
||||
uses: ./
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKER_IMAGE }}
|
||||
ghcr.io/name/app
|
||||
labels: |
|
||||
maintainer=CrazyMax
|
||||
-
|
||||
name: JSON output
|
||||
run: |
|
||||
echo "maintainer=${{ fromJSON(steps.meta.outputs.json).labels['maintainer'] }}"
|
||||
echo "version=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}"
|
||||
echo "revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}"
|
||||
echo "created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}"
|
||||
|
||||
docker-push:
|
||||
runs-on: ubuntu-latest
|
||||
@ -134,29 +319,32 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: ${{ env.BUILDX_VERSION }}
|
||||
driver-opts: network=host
|
||||
-
|
||||
name: Docker meta
|
||||
id: docker_meta
|
||||
uses: ./
|
||||
with:
|
||||
images: ${{ env.DOCKER_IMAGE }}
|
||||
tag-sha: true
|
||||
tag-semver: |
|
||||
v{{version}}
|
||||
v{{major}}.{{minor}}
|
||||
v{{major}}
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
driver-opts: network=host
|
||||
images: |
|
||||
${{ env.DOCKER_IMAGE }}
|
||||
tags: |
|
||||
type=schedule
|
||||
type=ref,event=branch
|
||||
type=ref,event=tag
|
||||
type=ref,event=pr
|
||||
type=semver,pattern=v{{version}}
|
||||
type=semver,pattern=v{{major}}.{{minor}}
|
||||
type=semver,pattern=v{{major}}
|
||||
type=sha
|
||||
-
|
||||
name: Build and push to local registry
|
||||
uses: docker/build-push-action@v2
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./test
|
||||
file: ./test/Dockerfile
|
||||
@ -173,17 +361,18 @@ jobs:
|
||||
name: Check manifest
|
||||
run: |
|
||||
docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
|
||||
-
|
||||
name: Dump context
|
||||
if: always()
|
||||
uses: crazy-max/ghaction-dump-context@v1
|
||||
|
||||
bake:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: ${{ env.BUILDX_VERSION }}
|
||||
-
|
||||
name: Docker meta
|
||||
id: docker_meta
|
||||
@ -192,23 +381,253 @@ jobs:
|
||||
images: |
|
||||
${{ env.DOCKER_IMAGE }}
|
||||
ghcr.io/name/app
|
||||
tag-sha: true
|
||||
tag-semver: |
|
||||
{{version}}
|
||||
{{major}}.{{minor}}
|
||||
{{major}}
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
tags: |
|
||||
type=schedule
|
||||
type=ref,event=branch
|
||||
type=ref,event=tag
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha
|
||||
-
|
||||
name: Build
|
||||
uses: crazy-max/ghaction-docker-buildx-bake@v1
|
||||
uses: docker/bake-action@v6
|
||||
with:
|
||||
files: |
|
||||
./test/docker-bake.hcl
|
||||
${{ steps.docker_meta.outputs.bake-file }}
|
||||
cwd://${{ steps.docker_meta.outputs.bake-file-tags }}
|
||||
cwd://${{ steps.docker_meta.outputs.bake-file-labels }}
|
||||
targets: |
|
||||
release
|
||||
|
||||
sep-tags:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sep:
|
||||
- " "
|
||||
- ","
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: ${{ env.BUILDX_VERSION }}
|
||||
driver: docker
|
||||
-
|
||||
name: Docker meta
|
||||
id: meta
|
||||
uses: ./
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKER_IMAGE }}
|
||||
ghcr.io/name/app
|
||||
sep-tags: ${{ matrix.sep }}
|
||||
-
|
||||
name: Tags
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
console.log(`${{ steps.meta.outputs.tags }}`);
|
||||
|
||||
output-env:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: ${{ env.BUILDX_VERSION }}
|
||||
driver: docker
|
||||
-
|
||||
name: Docker meta
|
||||
id: meta
|
||||
uses: ./
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKER_IMAGE }}
|
||||
ghcr.io/name/app
|
||||
labels: |
|
||||
maintainer=CrazyMax
|
||||
annotations: |
|
||||
maintainer=Foo
|
||||
-
|
||||
name: Build
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./test
|
||||
file: ./test/output.Dockerfile
|
||||
build-args: |
|
||||
DOCKER_METADATA_OUTPUT_VERSION
|
||||
DOCKER_METADATA_OUTPUT_TAGS
|
||||
DOCKER_METADATA_OUTPUT_LABELS
|
||||
DOCKER_METADATA_OUTPUT_ANNOTATIONS
|
||||
DOCKER_METADATA_OUTPUT_JSON
|
||||
|
||||
no-output-env:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DOCKER_METADATA_SET_OUTPUT_ENV: false
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Docker meta
|
||||
id: meta
|
||||
uses: ./
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKER_IMAGE }}
|
||||
ghcr.io/name/app
|
||||
labels: |
|
||||
maintainer=CrazyMax
|
||||
annotations: |
|
||||
maintainer=Foo
|
||||
-
|
||||
name: No output environment variables set
|
||||
shell: bash
|
||||
run: |
|
||||
[[ "$(printenv | grep "^DOCKER_METADATA_OUTPUT_" | wc -l)" -eq 0 ]] || exit 1
|
||||
|
||||
bake-annotations:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: ${{ env.BUILDX_VERSION }}
|
||||
-
|
||||
name: Docker meta
|
||||
id: docker_meta
|
||||
uses: ./
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKER_IMAGE }}
|
||||
ghcr.io/name/app
|
||||
tags: |
|
||||
type=schedule
|
||||
type=ref,event=branch
|
||||
type=ref,event=tag
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha
|
||||
env:
|
||||
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
|
||||
-
|
||||
name: Build
|
||||
uses: docker/bake-action@v6
|
||||
with:
|
||||
files: |
|
||||
./test/docker-bake.hcl
|
||||
cwd://${{ steps.docker_meta.outputs.bake-file-tags }}
|
||||
cwd://${{ steps.docker_meta.outputs.bake-file-annotations }}
|
||||
targets: |
|
||||
release
|
||||
|
||||
no-images:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: ${{ env.BUILDX_VERSION }}
|
||||
driver: docker
|
||||
-
|
||||
name: Docker meta
|
||||
uses: ./
|
||||
with:
|
||||
tags: |
|
||||
type=schedule
|
||||
type=ref,event=branch
|
||||
type=ref,event=tag
|
||||
type=ref,event=pr
|
||||
type=sha
|
||||
-
|
||||
name: Print envs
|
||||
run: env|sort
|
||||
|
||||
bake-path-context:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: latest
|
||||
-
|
||||
name: Docker meta
|
||||
id: docker_meta
|
||||
uses: ./
|
||||
-
|
||||
name: Build
|
||||
uses: docker/bake-action@v6
|
||||
with:
|
||||
source: .
|
||||
files: |
|
||||
./test/docker-bake.hcl
|
||||
${{ steps.docker_meta.outputs.bake-file-tags }}
|
||||
${{ steps.docker_meta.outputs.bake-file-labels }}
|
||||
targets: |
|
||||
release
|
||||
|
||||
sha-short:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
short-length:
|
||||
- ''
|
||||
- 16
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: ${{ env.BUILDX_VERSION }}
|
||||
driver: docker
|
||||
-
|
||||
name: Docker meta
|
||||
uses: ./
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKER_IMAGE }}
|
||||
ghcr.io/name/app
|
||||
tags: |
|
||||
type=sha
|
||||
env:
|
||||
DOCKER_METADATA_SHORT_SHA_LENGTH: ${{ matrix.short-length }}
|
||||
|
||||
dump:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Dump context
|
||||
uses: crazy-max/ghaction-dump-context@v2
|
||||
|
20
.github/workflows/labels.yml
vendored
20
.github/workflows/labels.yml
vendored
@ -1,20 +0,0 @@
|
||||
name: labels
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
paths:
|
||||
- '.github/labels.yml'
|
||||
- '.github/workflows/labels.yml'
|
||||
|
||||
jobs:
|
||||
labeler:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Run Labeler
|
||||
uses: crazy-max/ghaction-github-labeler@v3
|
21
.github/workflows/publish.yml
vendored
Normal file
21
.github/workflows/publish.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
name: publish
|
||||
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
packages: write
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Publish
|
||||
uses: actions/publish-immutable-action@v0.0.4
|
21
.github/workflows/test.yml
vendored
21
.github/workflows/test.yml
vendored
@ -1,31 +1,28 @@
|
||||
name: test
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'releases/v*'
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
pull_request:
|
||||
branches:
|
||||
- 'master'
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Test
|
||||
run: docker buildx bake test
|
||||
uses: docker/bake-action@v6
|
||||
with:
|
||||
targets: test
|
||||
-
|
||||
name: Upload coverage
|
||||
uses: codecov/codecov-action@v1
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
file: ./coverage/clover.xml
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
36
.github/workflows/validate.yml
vendored
36
.github/workflows/validate.yml
vendored
@ -1,25 +1,43 @@
|
||||
name: validate
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'releases/v*'
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
pull_request:
|
||||
branches:
|
||||
- 'master'
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
prepare:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
targets: ${{ steps.generate.outputs.targets }}
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: List targets
|
||||
id: generate
|
||||
uses: docker/bake-action/subaction/list-targets@v6
|
||||
with:
|
||||
target: validate
|
||||
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- prepare
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target: ${{ fromJson(needs.prepare.outputs.targets) }}
|
||||
steps:
|
||||
-
|
||||
name: Validate
|
||||
run: docker buildx bake validate
|
||||
uses: docker/bake-action@v6
|
||||
with:
|
||||
targets: ${{ matrix.target }}
|
||||
|
71
.gitignore
vendored
71
.gitignore
vendored
@ -1,12 +1,5 @@
|
||||
/.dev
|
||||
node_modules/
|
||||
lib
|
||||
# https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
|
||||
|
||||
# Jetbrains
|
||||
/.idea
|
||||
/*.iml
|
||||
|
||||
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
@ -14,6 +7,7 @@ npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
@ -24,34 +18,14 @@ pids
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
@ -61,36 +35,19 @@ typings/
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.test
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# next.js build output
|
||||
.next
|
||||
|
||||
# nuxt.js build output
|
||||
.nuxt
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
# yarn v2
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
6
.prettierignore
Normal file
6
.prettierignore
Normal file
@ -0,0 +1,6 @@
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# yarn v2
|
||||
.yarn/
|
541
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
Normal file
541
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
Normal file
File diff suppressed because one or more lines are too long
13
.yarnrc.yml
Normal file
13
.yarnrc.yml
Normal file
@ -0,0 +1,13 @@
|
||||
logFilters:
|
||||
- code: YN0013
|
||||
level: discard
|
||||
- code: YN0019
|
||||
level: discard
|
||||
- code: YN0076
|
||||
level: discard
|
||||
|
||||
nodeLinker: node-modules
|
||||
|
||||
plugins:
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||
spec: "@yarnpkg/plugin-interactive-tools"
|
87
CHANGELOG.md
87
CHANGELOG.md
@ -1,87 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
## 1.11.0 (2020/12/24)
|
||||
|
||||
* Inject `DOCKER_META_IMAGES` and `DOCKER_META_VERSION` args in bake definition (#37)
|
||||
|
||||
## 1.10.1 (2020/12/24)
|
||||
|
||||
* Missing entry in `action.yml`
|
||||
|
||||
## 1.10.0 (2020/12/24)
|
||||
|
||||
* Add `bake-file` output (#36)
|
||||
* Add `label-custom` input (#35)
|
||||
* Bump node-notifier from 8.0.0 to 8.0.1 (#33)
|
||||
* Update dev workflow (#32)
|
||||
|
||||
## 1.9.1 (2020/12/07)
|
||||
|
||||
* Replace forbidden chars derived from branch name (#31)
|
||||
* Bump semver from 7.3.2 to 7.3.4 (#26)
|
||||
|
||||
## 1.9.0 (2020/12/04)
|
||||
|
||||
* Allow to add custom tags (#24)
|
||||
* Allow to disable latest tag (#23)
|
||||
* Warn on invalid semver (#22)
|
||||
* Avoid unnecessary calls to version (#21)
|
||||
|
||||
## 1.8.5 (2020/11/24)
|
||||
|
||||
* Use sepLabels when joining labels for output (#17)
|
||||
|
||||
## 1.8.4 (2020/11/20)
|
||||
|
||||
* Pre-release (rc, beta, alpha) will only extend `{{version}}` as tag for `tag-semver`
|
||||
|
||||
## 1.8.3 (2020/11/20)
|
||||
|
||||
* Lowercase image name (#16)
|
||||
|
||||
## 1.8.2 (2020/11/18)
|
||||
|
||||
* Remove duplicated tags
|
||||
|
||||
## 1.8.1 (2020/11/18)
|
||||
|
||||
* Missing input in `action.yml`
|
||||
|
||||
## 1.8.0 (2020/11/17)
|
||||
|
||||
* Handle semver tags (#14)
|
||||
|
||||
## 1.7.0 (2020/10/31)
|
||||
|
||||
* Use `repo.html_url` for `org.opencontainers.image.source` label to be able to display README on GHCR
|
||||
* Handle `tag-match-latest` on Git tag event (#8)
|
||||
|
||||
## 1.6.0 (2020/10/28)
|
||||
|
||||
* Generate latest tag by default on push tag event (#5)
|
||||
|
||||
## 1.5.0 (2020/10/27)
|
||||
|
||||
* Add `tag-match-group` input to choose group to get if `tag-match` matches
|
||||
* Check `tag-match` is a valid regex
|
||||
|
||||
## 1.4.0 (2020/10/27)
|
||||
|
||||
* Use RegExp to match against a Git tag instead of coerce
|
||||
|
||||
## 1.3.0 (2020/10/26)
|
||||
|
||||
* Set latest tag only if matches with a pattern
|
||||
|
||||
## 1.2.0 (2020/10/26)
|
||||
|
||||
* Coerces Git tag to semver (#3)
|
||||
|
||||
## 1.1.0 (2020/10/25)
|
||||
|
||||
* Allow to templatize schedule tag (#1)
|
||||
* Allow to disable edge branch tagging (#2)
|
||||
|
||||
## 1.0.0 (2020/10/25)
|
||||
|
||||
* Initial version
|
@ -1,51 +0,0 @@
|
||||
#syntax=docker/dockerfile:1.2
|
||||
|
||||
FROM node:12 AS deps
|
||||
WORKDIR /src
|
||||
COPY package.json yarn.lock ./
|
||||
RUN --mount=type=cache,target=/src/node_modules \
|
||||
yarn install
|
||||
|
||||
FROM scratch AS update-yarn
|
||||
COPY --from=deps /src/yarn.lock /
|
||||
|
||||
FROM deps AS validate-yarn
|
||||
COPY .git .git
|
||||
RUN status=$(git status --porcelain -- yarn.lock); if [ -n "$status" ]; then echo $status; exit 1; fi
|
||||
|
||||
FROM deps AS base
|
||||
COPY . .
|
||||
|
||||
FROM base AS build
|
||||
RUN --mount=type=cache,target=/src/node_modules \
|
||||
yarn build
|
||||
|
||||
FROM deps AS test
|
||||
ENV RUNNER_TEMP=/tmp/github_runner
|
||||
ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
|
||||
COPY . .
|
||||
RUN --mount=type=cache,target=/src/node_modules \
|
||||
yarn run test
|
||||
|
||||
FROM scratch AS test-coverage
|
||||
COPY --from=test /src/coverage /coverage/
|
||||
|
||||
FROM base AS run-format
|
||||
RUN --mount=type=cache,target=/src/node_modules \
|
||||
yarn run format
|
||||
|
||||
FROM scratch AS format
|
||||
COPY --from=run-format /src/src/*.ts /src/
|
||||
|
||||
FROM base AS validate-format
|
||||
RUN --mount=type=cache,target=/src/node_modules \
|
||||
yarn run format-check
|
||||
|
||||
FROM scratch AS dist
|
||||
COPY --from=build /src/dist/ /dist/
|
||||
|
||||
FROM build AS validate-build
|
||||
RUN status=$(git status --porcelain -- dist); if [ -n "$status" ]; then echo $status; exit 1; fi
|
||||
|
||||
FROM base AS dev
|
||||
ENTRYPOINT ["bash"]
|
204
LICENSE
204
LICENSE
@ -1,21 +1,191 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 CrazyMax
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
https://www.apache.org/licenses/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
1. Definitions.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Copyright 2013-2018 Docker, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
223
__mocks__/@actions/github.ts
Normal file
223
__mocks__/@actions/github.ts
Normal file
@ -0,0 +1,223 @@
|
||||
import {jest} from '@jest/globals';
|
||||
|
||||
export const context = {
|
||||
repo: {
|
||||
owner: 'docker',
|
||||
repo: 'actions-toolkit'
|
||||
},
|
||||
ref: 'refs/heads/master',
|
||||
runId: 123,
|
||||
payload: {
|
||||
after: '860c1904a1ce19322e91ac35af1ab07466440c37',
|
||||
base_ref: null,
|
||||
before: '5f3331d7f7044c18ca9f12c77d961c4d7cf3276a',
|
||||
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: '860c1904a1ce19322e91ac35af1ab07466440c37',
|
||||
message: 'hello dev',
|
||||
timestamp: '2022-04-19T11:27:24+02:00',
|
||||
tree_id: 'd2c60af597e863787d2d27f569e30495b0b92820',
|
||||
url: 'https://github.com/docker/test-docker-action/commit/860c1904a1ce19322e91ac35af1ab07466440c37'
|
||||
}
|
||||
],
|
||||
compare: 'https://github.com/docker/test-docker-action/compare/5f3331d7f704...860c1904a1ce',
|
||||
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: '860c1904a1ce19322e91ac35af1ab07466440c37',
|
||||
message: 'hello dev',
|
||||
timestamp: '2022-04-19T11:27:24+02:00',
|
||||
tree_id: 'd2c60af597e863787d2d27f569e30495b0b92820',
|
||||
url: 'https://github.com/docker/test-docker-action/commit/860c1904a1ce19322e91ac35af1ab07466440c37'
|
||||
},
|
||||
organization: {
|
||||
avatar_url: 'https://avatars.githubusercontent.com/u/5429470?v=4',
|
||||
description: 'Docker helps developers bring their ideas to life by conquering the complexity of app development.',
|
||||
events_url: 'https://api.github.com/orgs/docker/events',
|
||||
hooks_url: 'https://api.github.com/orgs/docker/hooks',
|
||||
id: 5429470,
|
||||
issues_url: 'https://api.github.com/orgs/docker/issues',
|
||||
login: 'docker',
|
||||
members_url: 'https://api.github.com/orgs/docker/members{/member}',
|
||||
node_id: 'MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=',
|
||||
public_members_url: 'https://api.github.com/orgs/docker/public_members{/member}',
|
||||
repos_url: 'https://api.github.com/orgs/docker/repos',
|
||||
url: 'https://api.github.com/orgs/docker'
|
||||
},
|
||||
pusher: {
|
||||
email: 'github@crazymax.dev',
|
||||
name: 'crazy-max'
|
||||
},
|
||||
ref: 'refs/heads/dev',
|
||||
repository: {
|
||||
allow_forking: true,
|
||||
archive_url: 'https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}',
|
||||
archived: false,
|
||||
assignees_url: 'https://api.github.com/repos/docker/test-docker-action/assignees{/user}',
|
||||
blobs_url: 'https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}',
|
||||
branches_url: 'https://api.github.com/repos/docker/test-docker-action/branches{/branch}',
|
||||
clone_url: 'https://github.com/docker/test-docker-action.git',
|
||||
collaborators_url: 'https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}',
|
||||
comments_url: 'https://api.github.com/repos/docker/test-docker-action/comments{/number}',
|
||||
commits_url: 'https://api.github.com/repos/docker/test-docker-action/commits{/sha}',
|
||||
compare_url: 'https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}',
|
||||
contents_url: 'https://api.github.com/repos/docker/test-docker-action/contents/{+path}',
|
||||
contributors_url: 'https://api.github.com/repos/docker/test-docker-action/contributors',
|
||||
created_at: 1596792180,
|
||||
default_branch: 'master',
|
||||
deployments_url: 'https://api.github.com/repos/docker/test-docker-action/deployments',
|
||||
description: 'Test "Docker" Actions',
|
||||
disabled: false,
|
||||
downloads_url: 'https://api.github.com/repos/docker/test-docker-action/downloads',
|
||||
events_url: 'https://api.github.com/repos/docker/test-docker-action/events',
|
||||
fork: false,
|
||||
forks: 1,
|
||||
forks_count: 1,
|
||||
forks_url: 'https://api.github.com/repos/docker/test-docker-action/forks',
|
||||
full_name: 'docker/test-docker-action',
|
||||
git_commits_url: 'https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}',
|
||||
git_refs_url: 'https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}',
|
||||
git_tags_url: 'https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}',
|
||||
git_url: 'git://github.com/docker/test-docker-action.git',
|
||||
has_downloads: true,
|
||||
has_issues: true,
|
||||
has_pages: false,
|
||||
has_projects: true,
|
||||
has_wiki: true,
|
||||
homepage: '',
|
||||
hooks_url: 'https://api.github.com/repos/docker/test-docker-action/hooks',
|
||||
html_url: 'https://github.com/docker/test-docker-action',
|
||||
id: 285789493,
|
||||
is_template: false,
|
||||
issue_comment_url: 'https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}',
|
||||
issue_events_url: 'https://api.github.com/repos/docker/test-docker-action/issues/events{/number}',
|
||||
issues_url: 'https://api.github.com/repos/docker/test-docker-action/issues{/number}',
|
||||
keys_url: 'https://api.github.com/repos/docker/test-docker-action/keys{/key_id}',
|
||||
labels_url: 'https://api.github.com/repos/docker/test-docker-action/labels{/name}',
|
||||
language: 'JavaScript',
|
||||
languages_url: 'https://api.github.com/repos/docker/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/docker/test-docker-action/merges',
|
||||
milestones_url: 'https://api.github.com/repos/docker/test-docker-action/milestones{/number}',
|
||||
mirror_url: null,
|
||||
name: 'test-docker-action',
|
||||
node_id: 'MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=',
|
||||
notifications_url: 'https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}',
|
||||
open_issues: 6,
|
||||
open_issues_count: 6,
|
||||
organization: 'docker',
|
||||
owner: {
|
||||
avatar_url: 'https://avatars.githubusercontent.com/u/5429470?v=4',
|
||||
email: 'info@docker.com',
|
||||
events_url: 'https://api.github.com/users/docker/events{/privacy}',
|
||||
followers_url: 'https://api.github.com/users/docker/followers',
|
||||
following_url: 'https://api.github.com/users/docker/following{/other_user}',
|
||||
gists_url: 'https://api.github.com/users/docker/gists{/gist_id}',
|
||||
gravatar_id: '',
|
||||
html_url: 'https://github.com/docker',
|
||||
id: 5429470,
|
||||
login: 'docker',
|
||||
name: 'docker',
|
||||
node_id: 'MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=',
|
||||
organizations_url: 'https://api.github.com/users/docker/orgs',
|
||||
received_events_url: 'https://api.github.com/users/docker/received_events',
|
||||
repos_url: 'https://api.github.com/users/docker/repos',
|
||||
site_admin: false,
|
||||
starred_url: 'https://api.github.com/users/docker/starred{/owner}{/repo}',
|
||||
subscriptions_url: 'https://api.github.com/users/docker/subscriptions',
|
||||
type: 'Organization',
|
||||
url: 'https://api.github.com/users/docker'
|
||||
},
|
||||
private: true,
|
||||
pulls_url: 'https://api.github.com/repos/docker/test-docker-action/pulls{/number}',
|
||||
pushed_at: 1650360446,
|
||||
releases_url: 'https://api.github.com/repos/docker/test-docker-action/releases{/id}',
|
||||
size: 796,
|
||||
ssh_url: 'git@github.com:docker/test-docker-action.git',
|
||||
stargazers: 0,
|
||||
stargazers_count: 0,
|
||||
stargazers_url: 'https://api.github.com/repos/docker/test-docker-action/stargazers',
|
||||
statuses_url: 'https://api.github.com/repos/docker/test-docker-action/statuses/{sha}',
|
||||
subscribers_url: 'https://api.github.com/repos/docker/test-docker-action/subscribers',
|
||||
subscription_url: 'https://api.github.com/repos/docker/test-docker-action/subscription',
|
||||
svn_url: 'https://github.com/docker/test-docker-action',
|
||||
tags_url: 'https://api.github.com/repos/docker/test-docker-action/tags',
|
||||
teams_url: 'https://api.github.com/repos/docker/test-docker-action/teams',
|
||||
topics: [],
|
||||
trees_url: 'https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}',
|
||||
updated_at: '2022-04-19T09:05:09Z',
|
||||
url: 'https://github.com/docker/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/orgs',
|
||||
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'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const getOctokit = jest.fn(() => ({
|
||||
rest: {
|
||||
repos: {
|
||||
getCommit: jest.fn(() =>
|
||||
Promise.resolve({
|
||||
data: {
|
||||
commit: {
|
||||
committer: {
|
||||
date: '2024-11-13T13:42:28Z'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
}));
|
@ -1,173 +1,141 @@
|
||||
import {afterEach, beforeEach, describe, expect, test, it, jest} from '@jest/globals';
|
||||
import * as dotenv from 'dotenv';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import {Context} from '@actions/github/lib/context';
|
||||
import {Git} from '@docker/actions-toolkit/lib/git';
|
||||
import {GitHub} from '@docker/actions-toolkit/lib/github';
|
||||
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
|
||||
|
||||
import * as context from '../src/context';
|
||||
import {ContextSource, getContext, getInputs, Inputs} from '../src/context';
|
||||
|
||||
jest.spyOn(context, 'tmpDir').mockImplementation((): string => {
|
||||
const tmpDir = path.join('/tmp/.ghaction-docker-meta-jest').split(path.sep).join(path.posix.sep);
|
||||
if (!fs.existsSync(tmpDir)) {
|
||||
fs.mkdirSync(tmpDir, {recursive: true});
|
||||
}
|
||||
return tmpDir;
|
||||
});
|
||||
const toolkit = new Toolkit({githubToken: 'fake-github-token'});
|
||||
|
||||
describe('getInputList', () => {
|
||||
it('single line correctly', async () => {
|
||||
await setInput('foo', 'bar');
|
||||
const res = await context.getInputList('foo');
|
||||
console.log(res);
|
||||
expect(res).toEqual(['bar']);
|
||||
});
|
||||
|
||||
it('multiline correctly', async () => {
|
||||
setInput('foo', 'bar\nbaz');
|
||||
const res = await context.getInputList('foo');
|
||||
console.log(res);
|
||||
expect(res).toEqual(['bar', 'baz']);
|
||||
});
|
||||
|
||||
it('empty lines correctly', async () => {
|
||||
setInput('foo', 'bar\n\nbaz');
|
||||
const res = await context.getInputList('foo');
|
||||
console.log(res);
|
||||
expect(res).toEqual(['bar', 'baz']);
|
||||
});
|
||||
|
||||
it('comma correctly', async () => {
|
||||
setInput('foo', 'bar,baz');
|
||||
const res = await context.getInputList('foo');
|
||||
console.log(res);
|
||||
expect(res).toEqual(['bar', 'baz']);
|
||||
});
|
||||
|
||||
it('empty result correctly', async () => {
|
||||
setInput('foo', 'bar,baz,');
|
||||
const res = await context.getInputList('foo');
|
||||
console.log(res);
|
||||
expect(res).toEqual(['bar', 'baz']);
|
||||
});
|
||||
|
||||
it('different new lines correctly', async () => {
|
||||
setInput('foo', 'bar\r\nbaz');
|
||||
const res = await context.getInputList('foo');
|
||||
console.log(res);
|
||||
expect(res).toEqual(['bar', 'baz']);
|
||||
});
|
||||
|
||||
it('different new lines and comma correctly', async () => {
|
||||
setInput('foo', 'bar\r\nbaz,bat');
|
||||
const res = await context.getInputList('foo');
|
||||
console.log(res);
|
||||
expect(res).toEqual(['bar', 'baz', 'bat']);
|
||||
});
|
||||
|
||||
it('multiline and ignoring comma correctly', async () => {
|
||||
setInput('cache-from', 'user/app:cache\ntype=local,src=path/to/dir');
|
||||
const res = await context.getInputList('cache-from', true);
|
||||
console.log(res);
|
||||
expect(res).toEqual(['user/app:cache', 'type=local,src=path/to/dir']);
|
||||
});
|
||||
|
||||
it('different new lines and ignoring comma correctly', async () => {
|
||||
setInput('cache-from', 'user/app:cache\r\ntype=local,src=path/to/dir');
|
||||
const res = await context.getInputList('cache-from', true);
|
||||
console.log(res);
|
||||
expect(res).toEqual(['user/app:cache', 'type=local,src=path/to/dir']);
|
||||
});
|
||||
|
||||
it('multiline values', async () => {
|
||||
setInput(
|
||||
'secrets',
|
||||
`GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789
|
||||
"MYSECRET=aaaaaaaa
|
||||
bbbbbbb
|
||||
ccccccccc"
|
||||
FOO=bar`
|
||||
);
|
||||
const res = await context.getInputList('secrets', true);
|
||||
console.log(res);
|
||||
expect(res).toEqual([
|
||||
'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789',
|
||||
`MYSECRET=aaaaaaaa
|
||||
bbbbbbb
|
||||
ccccccccc`,
|
||||
'FOO=bar'
|
||||
]);
|
||||
});
|
||||
|
||||
it('multiline values with empty lines', async () => {
|
||||
setInput(
|
||||
'secrets',
|
||||
`GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789
|
||||
"MYSECRET=aaaaaaaa
|
||||
bbbbbbb
|
||||
ccccccccc"
|
||||
FOO=bar
|
||||
"EMPTYLINE=aaaa
|
||||
|
||||
bbbb
|
||||
ccc"`
|
||||
);
|
||||
const res = await context.getInputList('secrets', true);
|
||||
console.log(res);
|
||||
expect(res).toEqual([
|
||||
'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789',
|
||||
`MYSECRET=aaaaaaaa
|
||||
bbbbbbb
|
||||
ccccccccc`,
|
||||
'FOO=bar',
|
||||
`EMPTYLINE=aaaa
|
||||
|
||||
bbbb
|
||||
ccc`
|
||||
]);
|
||||
});
|
||||
|
||||
it('multiline values without quotes', async () => {
|
||||
setInput(
|
||||
'secrets',
|
||||
`GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789
|
||||
MYSECRET=aaaaaaaa
|
||||
bbbbbbb
|
||||
ccccccccc
|
||||
FOO=bar`
|
||||
);
|
||||
const res = await context.getInputList('secrets', true);
|
||||
console.log(res);
|
||||
expect(res).toEqual(['GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789', 'MYSECRET=aaaaaaaa', 'bbbbbbb', 'ccccccccc', 'FOO=bar']);
|
||||
});
|
||||
|
||||
it('multiline values escape quotes', async () => {
|
||||
setInput(
|
||||
'secrets',
|
||||
`GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789
|
||||
"MYSECRET=aaaaaaaa
|
||||
bbbb""bbb
|
||||
ccccccccc"
|
||||
FOO=bar`
|
||||
);
|
||||
const res = await context.getInputList('secrets', true);
|
||||
console.log(res);
|
||||
expect(res).toEqual([
|
||||
'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789',
|
||||
`MYSECRET=aaaaaaaa
|
||||
bbbb\"bbb
|
||||
ccccccccc`,
|
||||
'FOO=bar'
|
||||
]);
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.spyOn(GitHub, 'context', 'get').mockImplementation((): Context => {
|
||||
return new Context();
|
||||
});
|
||||
});
|
||||
|
||||
describe('asyncForEach', () => {
|
||||
it('executes async tasks sequentially', async () => {
|
||||
const testValues = [1, 2, 3, 4, 5];
|
||||
const results: number[] = [];
|
||||
describe('getInputs', () => {
|
||||
beforeEach(() => {
|
||||
process.env = Object.keys(process.env).reduce((object, key) => {
|
||||
if (!key.startsWith('INPUT_')) {
|
||||
object[key] = process.env[key];
|
||||
}
|
||||
return object;
|
||||
}, {});
|
||||
});
|
||||
|
||||
await context.asyncForEach(testValues, async value => {
|
||||
results.push(value);
|
||||
// prettier-ignore
|
||||
test.each([
|
||||
[
|
||||
0,
|
||||
new Map<string, string>([
|
||||
['images', 'moby/buildkit\nghcr.io/moby/mbuildkit'],
|
||||
]),
|
||||
{
|
||||
context: ContextSource.workflow,
|
||||
bakeTarget: 'docker-metadata-action',
|
||||
flavor: [],
|
||||
githubToken: '',
|
||||
images: ['moby/buildkit', 'ghcr.io/moby/mbuildkit'],
|
||||
labels: [],
|
||||
annotations: [],
|
||||
sepLabels: '\n',
|
||||
sepTags: '\n',
|
||||
sepAnnotations: '\n',
|
||||
tags: [],
|
||||
} as Inputs
|
||||
],
|
||||
[
|
||||
1,
|
||||
new Map<string, string>([
|
||||
['bake-target', 'metadata'],
|
||||
['images', 'moby/buildkit'],
|
||||
['sep-labels', ','],
|
||||
['sep-tags', ','],
|
||||
['sep-annotations', ',']
|
||||
]),
|
||||
{
|
||||
context: ContextSource.workflow,
|
||||
bakeTarget: 'metadata',
|
||||
flavor: [],
|
||||
githubToken: '',
|
||||
images: ['moby/buildkit'],
|
||||
labels: [],
|
||||
annotations: [],
|
||||
sepLabels: ',',
|
||||
sepTags: ',',
|
||||
sepAnnotations: ',',
|
||||
tags: [],
|
||||
} as Inputs
|
||||
],
|
||||
[
|
||||
2,
|
||||
new Map<string, string>([
|
||||
['images', 'moby/buildkit\n#comment\nghcr.io/moby/mbuildkit'],
|
||||
]),
|
||||
{
|
||||
context: ContextSource.workflow,
|
||||
bakeTarget: 'docker-metadata-action',
|
||||
flavor: [],
|
||||
githubToken: '',
|
||||
images: ['moby/buildkit', 'ghcr.io/moby/mbuildkit'],
|
||||
labels: [],
|
||||
annotations: [],
|
||||
sepLabels: '\n',
|
||||
sepTags: '\n',
|
||||
sepAnnotations: '\n',
|
||||
tags: [],
|
||||
} as Inputs
|
||||
],
|
||||
])(
|
||||
'[%d] given %p as inputs, returns %p',
|
||||
async (num: number, inputs: Map<string, string>, expected: Inputs) => {
|
||||
inputs.forEach((value: string, name: string) => {
|
||||
setInput(name, value);
|
||||
});
|
||||
expect(await getInputs()).toEqual(expected);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
describe('getContext', () => {
|
||||
const originalEnv = process.env;
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
process.env = {
|
||||
...originalEnv,
|
||||
...dotenv.parse(fs.readFileSync(path.join(__dirname, 'fixtures/event_create_branch.env')))
|
||||
};
|
||||
});
|
||||
afterEach(() => {
|
||||
process.env = originalEnv;
|
||||
});
|
||||
|
||||
it('workflow', async () => {
|
||||
const context = await getContext(ContextSource.workflow, toolkit);
|
||||
expect(context.ref).toEqual('refs/heads/dev');
|
||||
expect(context.sha).toEqual('5f3331d7f7044c18ca9f12c77d961c4d7cf3276a');
|
||||
expect(context.commitDate).toEqual(new Date('2024-11-13T13:42:28.000Z'));
|
||||
});
|
||||
|
||||
it('git', async () => {
|
||||
jest.spyOn(Git, 'context').mockImplementation((): Promise<Context> => {
|
||||
return Promise.resolve({
|
||||
ref: 'refs/heads/git-test',
|
||||
sha: 'git-test-sha'
|
||||
} as Context);
|
||||
});
|
||||
|
||||
expect(results).toEqual(testValues);
|
||||
jest.spyOn(Git, 'commitDate').mockImplementation(async (): Promise<Date> => {
|
||||
return new Date('2023-01-01T13:42:28.000Z');
|
||||
});
|
||||
const context = await getContext(ContextSource.git, toolkit);
|
||||
expect(context.ref).toEqual('refs/heads/git-test');
|
||||
expect(context.sha).toEqual('git-test-sha');
|
||||
expect(context.commitDate).toEqual(new Date('2023-01-01T13:42:28.000Z'));
|
||||
});
|
||||
});
|
||||
|
||||
|
30
__tests__/fixtures/event_create_branch.env
Normal file
30
__tests__/fixtures/event_create_branch.env
Normal file
@ -0,0 +1,30 @@
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_49ba9b4e-1733-447c-b700-1cea19f95b82
|
||||
GITHUB_EVENT_NAME=create
|
||||
GITHUB_EVENT_PATH=./__tests__/fixtures/event_create_branch.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_49ba9b4e-1733-447c-b700-1cea19f95b82
|
||||
GITHUB_REF=refs/heads/dev
|
||||
GITHUB_REF_NAME=dev
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=branch
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188731929
|
||||
GITHUB_RUN_NUMBER=14
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=5f3331d7f7044c18ca9f12c77d961c4d7cf3276a
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_49ba9b4e-1733-447c-b700-1cea19f95b82
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
145
__tests__/fixtures/event_create_branch.json
Normal file
145
__tests__/fixtures/event_create_branch.json
Normal file
@ -0,0 +1,145 @@
|
||||
{
|
||||
"description": "Test \"Docker\" Actions",
|
||||
"master_branch": "master",
|
||||
"organization": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"description": "Docker helps developers bring their ideas to life by conquering the complexity of app development.",
|
||||
"events_url": "https://api.github.com/orgs/docker/events",
|
||||
"hooks_url": "https://api.github.com/orgs/docker/hooks",
|
||||
"id": 5429470,
|
||||
"issues_url": "https://api.github.com/orgs/docker/issues",
|
||||
"login": "docker",
|
||||
"members_url": "https://api.github.com/orgs/docker/members{/member}",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"public_members_url": "https://api.github.com/orgs/docker/public_members{/member}",
|
||||
"repos_url": "https://api.github.com/orgs/docker/repos",
|
||||
"url": "https://api.github.com/orgs/docker"
|
||||
},
|
||||
"pusher_type": "user",
|
||||
"ref": "dev",
|
||||
"ref_type": "branch",
|
||||
"repository": {
|
||||
"allow_forking": true,
|
||||
"archive_url": "https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}",
|
||||
"archived": false,
|
||||
"assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}",
|
||||
"blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}",
|
||||
"branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}",
|
||||
"clone_url": "https://github.com/docker/test-docker-action.git",
|
||||
"collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}",
|
||||
"comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}",
|
||||
"commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}",
|
||||
"compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}",
|
||||
"contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}",
|
||||
"contributors_url": "https://api.github.com/repos/docker/test-docker-action/contributors",
|
||||
"created_at": "2020-08-07T09:23:00Z",
|
||||
"default_branch": "master",
|
||||
"deployments_url": "https://api.github.com/repos/docker/test-docker-action/deployments",
|
||||
"description": "Test \"Docker\" Actions",
|
||||
"disabled": false,
|
||||
"downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads",
|
||||
"events_url": "https://api.github.com/repos/docker/test-docker-action/events",
|
||||
"fork": false,
|
||||
"forks": 1,
|
||||
"forks_count": 1,
|
||||
"forks_url": "https://api.github.com/repos/docker/test-docker-action/forks",
|
||||
"full_name": "docker/test-docker-action",
|
||||
"git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}",
|
||||
"git_url": "git://github.com/docker/test-docker-action.git",
|
||||
"has_downloads": true,
|
||||
"has_issues": true,
|
||||
"has_pages": false,
|
||||
"has_projects": true,
|
||||
"has_wiki": true,
|
||||
"homepage": "",
|
||||
"hooks_url": "https://api.github.com/repos/docker/test-docker-action/hooks",
|
||||
"html_url": "https://github.com/docker/test-docker-action",
|
||||
"id": 285789493,
|
||||
"is_template": false,
|
||||
"issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}",
|
||||
"issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}",
|
||||
"issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}",
|
||||
"keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}",
|
||||
"labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}",
|
||||
"language": "JavaScript",
|
||||
"languages_url": "https://api.github.com/repos/docker/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/docker/test-docker-action/merges",
|
||||
"milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}",
|
||||
"mirror_url": null,
|
||||
"name": "test-docker-action",
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||
"notifications_url": "https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}",
|
||||
"open_issues": 6,
|
||||
"open_issues_count": 6,
|
||||
"owner": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"events_url": "https://api.github.com/users/docker/events{/privacy}",
|
||||
"followers_url": "https://api.github.com/users/docker/followers",
|
||||
"following_url": "https://api.github.com/users/docker/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/docker/gists{/gist_id}",
|
||||
"gravatar_id": "",
|
||||
"html_url": "https://github.com/docker",
|
||||
"id": 5429470,
|
||||
"login": "docker",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"organizations_url": "https://api.github.com/users/docker/orgs",
|
||||
"received_events_url": "https://api.github.com/users/docker/received_events",
|
||||
"repos_url": "https://api.github.com/users/docker/repos",
|
||||
"site_admin": false,
|
||||
"starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/docker/subscriptions",
|
||||
"type": "Organization",
|
||||
"url": "https://api.github.com/users/docker"
|
||||
},
|
||||
"private": true,
|
||||
"pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}",
|
||||
"pushed_at": "2022-04-19T09:24:14Z",
|
||||
"releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}",
|
||||
"size": 796,
|
||||
"ssh_url": "git@github.com:docker/test-docker-action.git",
|
||||
"stargazers_count": 0,
|
||||
"stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers",
|
||||
"statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}",
|
||||
"subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription",
|
||||
"svn_url": "https://github.com/docker/test-docker-action",
|
||||
"tags_url": "https://api.github.com/repos/docker/test-docker-action/tags",
|
||||
"teams_url": "https://api.github.com/repos/docker/test-docker-action/teams",
|
||||
"topics": [],
|
||||
"trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}",
|
||||
"updated_at": "2022-04-19T09:05:09Z",
|
||||
"url": "https://api.github.com/repos/docker/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/orgs",
|
||||
"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"
|
||||
}
|
||||
}
|
30
__tests__/fixtures/event_create_tag.env
Normal file
30
__tests__/fixtures/event_create_tag.env
Normal file
@ -0,0 +1,30 @@
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_06751acb-da10-4e54-916a-60749556fc8b
|
||||
GITHUB_EVENT_NAME=create
|
||||
GITHUB_EVENT_PATH=./__tests__/fixtures/event_create_tag.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_06751acb-da10-4e54-916a-60749556fc8b
|
||||
GITHUB_REF=refs/tags/v2.1.8-beta.67
|
||||
GITHUB_REF_NAME=v2.1.8-beta.67
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=tag
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188815957
|
||||
GITHUB_RUN_NUMBER=22
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=860c1904a1ce19322e91ac35af1ab07466440c37
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_06751acb-da10-4e54-916a-60749556fc8b
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
145
__tests__/fixtures/event_create_tag.json
Normal file
145
__tests__/fixtures/event_create_tag.json
Normal file
@ -0,0 +1,145 @@
|
||||
{
|
||||
"description": "Test \"Docker\" Actions",
|
||||
"master_branch": "master",
|
||||
"organization": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"description": "Docker helps developers bring their ideas to life by conquering the complexity of app development.",
|
||||
"events_url": "https://api.github.com/orgs/docker/events",
|
||||
"hooks_url": "https://api.github.com/orgs/docker/hooks",
|
||||
"id": 5429470,
|
||||
"issues_url": "https://api.github.com/orgs/docker/issues",
|
||||
"login": "docker",
|
||||
"members_url": "https://api.github.com/orgs/docker/members{/member}",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"public_members_url": "https://api.github.com/orgs/docker/public_members{/member}",
|
||||
"repos_url": "https://api.github.com/orgs/docker/repos",
|
||||
"url": "https://api.github.com/orgs/docker"
|
||||
},
|
||||
"pusher_type": "user",
|
||||
"ref": "v2.1.8-beta.67",
|
||||
"ref_type": "tag",
|
||||
"repository": {
|
||||
"allow_forking": true,
|
||||
"archive_url": "https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}",
|
||||
"archived": false,
|
||||
"assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}",
|
||||
"blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}",
|
||||
"branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}",
|
||||
"clone_url": "https://github.com/docker/test-docker-action.git",
|
||||
"collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}",
|
||||
"comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}",
|
||||
"commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}",
|
||||
"compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}",
|
||||
"contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}",
|
||||
"contributors_url": "https://api.github.com/repos/docker/test-docker-action/contributors",
|
||||
"created_at": "2020-08-07T09:23:00Z",
|
||||
"default_branch": "master",
|
||||
"deployments_url": "https://api.github.com/repos/docker/test-docker-action/deployments",
|
||||
"description": "Test \"Docker\" Actions",
|
||||
"disabled": false,
|
||||
"downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads",
|
||||
"events_url": "https://api.github.com/repos/docker/test-docker-action/events",
|
||||
"fork": false,
|
||||
"forks": 1,
|
||||
"forks_count": 1,
|
||||
"forks_url": "https://api.github.com/repos/docker/test-docker-action/forks",
|
||||
"full_name": "docker/test-docker-action",
|
||||
"git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}",
|
||||
"git_url": "git://github.com/docker/test-docker-action.git",
|
||||
"has_downloads": true,
|
||||
"has_issues": true,
|
||||
"has_pages": false,
|
||||
"has_projects": true,
|
||||
"has_wiki": true,
|
||||
"homepage": "",
|
||||
"hooks_url": "https://api.github.com/repos/docker/test-docker-action/hooks",
|
||||
"html_url": "https://github.com/docker/test-docker-action",
|
||||
"id": 285789493,
|
||||
"is_template": false,
|
||||
"issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}",
|
||||
"issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}",
|
||||
"issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}",
|
||||
"keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}",
|
||||
"labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}",
|
||||
"language": "JavaScript",
|
||||
"languages_url": "https://api.github.com/repos/docker/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/docker/test-docker-action/merges",
|
||||
"milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}",
|
||||
"mirror_url": null,
|
||||
"name": "test-docker-action",
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||
"notifications_url": "https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}",
|
||||
"open_issues": 6,
|
||||
"open_issues_count": 6,
|
||||
"owner": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"events_url": "https://api.github.com/users/docker/events{/privacy}",
|
||||
"followers_url": "https://api.github.com/users/docker/followers",
|
||||
"following_url": "https://api.github.com/users/docker/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/docker/gists{/gist_id}",
|
||||
"gravatar_id": "",
|
||||
"html_url": "https://github.com/docker",
|
||||
"id": 5429470,
|
||||
"login": "docker",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"organizations_url": "https://api.github.com/users/docker/orgs",
|
||||
"received_events_url": "https://api.github.com/users/docker/received_events",
|
||||
"repos_url": "https://api.github.com/users/docker/repos",
|
||||
"site_admin": false,
|
||||
"starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/docker/subscriptions",
|
||||
"type": "Organization",
|
||||
"url": "https://api.github.com/users/docker"
|
||||
},
|
||||
"private": true,
|
||||
"pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}",
|
||||
"pushed_at": "2022-04-19T09:41:03Z",
|
||||
"releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}",
|
||||
"size": 796,
|
||||
"ssh_url": "git@github.com:docker/test-docker-action.git",
|
||||
"stargazers_count": 0,
|
||||
"stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers",
|
||||
"statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}",
|
||||
"subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription",
|
||||
"svn_url": "https://github.com/docker/test-docker-action",
|
||||
"tags_url": "https://api.github.com/repos/docker/test-docker-action/tags",
|
||||
"teams_url": "https://api.github.com/repos/docker/test-docker-action/teams",
|
||||
"topics": [],
|
||||
"trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}",
|
||||
"updated_at": "2022-04-19T09:05:09Z",
|
||||
"url": "https://api.github.com/repos/docker/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/orgs",
|
||||
"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"
|
||||
}
|
||||
}
|
30
__tests__/fixtures/event_discussion_created.env
Normal file
30
__tests__/fixtures/event_discussion_created.env
Normal file
@ -0,0 +1,30 @@
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_5f8f9da1-1c58-4a8e-bef4-dba436a05edf
|
||||
GITHUB_EVENT_NAME=discussion
|
||||
GITHUB_EVENT_PATH=./__tests__/fixtures/event_discussion_created.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_5f8f9da1-1c58-4a8e-bef4-dba436a05edf
|
||||
GITHUB_REF=refs/heads/master
|
||||
GITHUB_REF_NAME=master
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=branch
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188642055
|
||||
GITHUB_RUN_NUMBER=7
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=266574110acf203503badf966df2ea24b5d732d7
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_5f8f9da1-1c58-4a8e-bef4-dba436a05edf
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
205
__tests__/fixtures/event_discussion_created.json
Normal file
205
__tests__/fixtures/event_discussion_created.json
Normal file
@ -0,0 +1,205 @@
|
||||
{
|
||||
"action": "created",
|
||||
"discussion": {
|
||||
"active_lock_reason": null,
|
||||
"answer_chosen_at": null,
|
||||
"answer_chosen_by": null,
|
||||
"answer_html_url": null,
|
||||
"author_association": "COLLABORATOR",
|
||||
"body": "bar",
|
||||
"category": {
|
||||
"created_at": "2022-04-19T11:05:12.000+02:00",
|
||||
"description": "Chat about anything and everything here",
|
||||
"emoji": ":speech_balloon:",
|
||||
"id": 37396924,
|
||||
"is_answerable": false,
|
||||
"name": "General",
|
||||
"node_id": "DIC_kwDOEQjNNc4COqG8",
|
||||
"repository_id": 285789493,
|
||||
"slug": "general",
|
||||
"updated_at": "2022-04-19T11:05:12.000+02:00"
|
||||
},
|
||||
"comments": 0,
|
||||
"created_at": "2022-04-19T09:07:32Z",
|
||||
"html_url": "https://github.com/docker/test-docker-action/discussions/13",
|
||||
"id": 4019118,
|
||||
"locked": false,
|
||||
"node_id": "D_kwDOEQjNNc4APVOu",
|
||||
"number": 13,
|
||||
"reactions": {
|
||||
"+1": 0,
|
||||
"-1": 0,
|
||||
"confused": 0,
|
||||
"eyes": 0,
|
||||
"heart": 0,
|
||||
"hooray": 0,
|
||||
"laugh": 0,
|
||||
"rocket": 0,
|
||||
"total_count": 0,
|
||||
"url": "https://api.github.com/repos/docker/test-docker-action/discussions/13/reactions"
|
||||
},
|
||||
"repository_url": "https://api.github.com/repos/docker/test-docker-action",
|
||||
"state": "open",
|
||||
"timeline_url": "https://api.github.com/repos/docker/test-docker-action/discussions/13/timeline",
|
||||
"title": "foo",
|
||||
"updated_at": "2022-04-19T09:07:32Z",
|
||||
"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/orgs",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"organization": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"description": "Docker helps developers bring their ideas to life by conquering the complexity of app development.",
|
||||
"events_url": "https://api.github.com/orgs/docker/events",
|
||||
"hooks_url": "https://api.github.com/orgs/docker/hooks",
|
||||
"id": 5429470,
|
||||
"issues_url": "https://api.github.com/orgs/docker/issues",
|
||||
"login": "docker",
|
||||
"members_url": "https://api.github.com/orgs/docker/members{/member}",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"public_members_url": "https://api.github.com/orgs/docker/public_members{/member}",
|
||||
"repos_url": "https://api.github.com/orgs/docker/repos",
|
||||
"url": "https://api.github.com/orgs/docker"
|
||||
},
|
||||
"repository": {
|
||||
"allow_forking": true,
|
||||
"archive_url": "https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}",
|
||||
"archived": false,
|
||||
"assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}",
|
||||
"blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}",
|
||||
"branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}",
|
||||
"clone_url": "https://github.com/docker/test-docker-action.git",
|
||||
"collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}",
|
||||
"comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}",
|
||||
"commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}",
|
||||
"compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}",
|
||||
"contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}",
|
||||
"contributors_url": "https://api.github.com/repos/docker/test-docker-action/contributors",
|
||||
"created_at": "2020-08-07T09:23:00Z",
|
||||
"default_branch": "master",
|
||||
"deployments_url": "https://api.github.com/repos/docker/test-docker-action/deployments",
|
||||
"description": "Test \"Docker\" Actions",
|
||||
"disabled": false,
|
||||
"downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads",
|
||||
"events_url": "https://api.github.com/repos/docker/test-docker-action/events",
|
||||
"fork": false,
|
||||
"forks": 1,
|
||||
"forks_count": 1,
|
||||
"forks_url": "https://api.github.com/repos/docker/test-docker-action/forks",
|
||||
"full_name": "docker/test-docker-action",
|
||||
"git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}",
|
||||
"git_url": "git://github.com/docker/test-docker-action.git",
|
||||
"has_downloads": true,
|
||||
"has_issues": true,
|
||||
"has_pages": false,
|
||||
"has_projects": true,
|
||||
"has_wiki": true,
|
||||
"homepage": "",
|
||||
"hooks_url": "https://api.github.com/repos/docker/test-docker-action/hooks",
|
||||
"html_url": "https://github.com/docker/test-docker-action",
|
||||
"id": 285789493,
|
||||
"is_template": false,
|
||||
"issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}",
|
||||
"issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}",
|
||||
"issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}",
|
||||
"keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}",
|
||||
"labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}",
|
||||
"language": "JavaScript",
|
||||
"languages_url": "https://api.github.com/repos/docker/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/docker/test-docker-action/merges",
|
||||
"milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}",
|
||||
"mirror_url": null,
|
||||
"name": "test-docker-action",
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||
"notifications_url": "https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}",
|
||||
"open_issues": 4,
|
||||
"open_issues_count": 4,
|
||||
"owner": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"events_url": "https://api.github.com/users/docker/events{/privacy}",
|
||||
"followers_url": "https://api.github.com/users/docker/followers",
|
||||
"following_url": "https://api.github.com/users/docker/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/docker/gists{/gist_id}",
|
||||
"gravatar_id": "",
|
||||
"html_url": "https://github.com/docker",
|
||||
"id": 5429470,
|
||||
"login": "docker",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"organizations_url": "https://api.github.com/users/docker/orgs",
|
||||
"received_events_url": "https://api.github.com/users/docker/received_events",
|
||||
"repos_url": "https://api.github.com/users/docker/repos",
|
||||
"site_admin": false,
|
||||
"starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/docker/subscriptions",
|
||||
"type": "Organization",
|
||||
"url": "https://api.github.com/users/docker"
|
||||
},
|
||||
"private": true,
|
||||
"pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}",
|
||||
"pushed_at": "2022-04-19T09:04:50Z",
|
||||
"releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}",
|
||||
"size": 796,
|
||||
"ssh_url": "git@github.com:docker/test-docker-action.git",
|
||||
"stargazers_count": 0,
|
||||
"stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers",
|
||||
"statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}",
|
||||
"subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription",
|
||||
"svn_url": "https://github.com/docker/test-docker-action",
|
||||
"tags_url": "https://api.github.com/repos/docker/test-docker-action/tags",
|
||||
"teams_url": "https://api.github.com/repos/docker/test-docker-action/teams",
|
||||
"topics": [],
|
||||
"trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}",
|
||||
"updated_at": "2022-04-19T09:05:09Z",
|
||||
"url": "https://api.github.com/repos/docker/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/orgs",
|
||||
"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"
|
||||
}
|
||||
}
|
30
__tests__/fixtures/event_discussion_pinned.env
Normal file
30
__tests__/fixtures/event_discussion_pinned.env
Normal file
@ -0,0 +1,30 @@
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_940c04a5-537a-4401-afe6-1f044e1d3836
|
||||
GITHUB_EVENT_NAME=discussion
|
||||
GITHUB_EVENT_PATH=./__tests__/fixtures/event_discussion_pinned.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_940c04a5-537a-4401-afe6-1f044e1d3836
|
||||
GITHUB_REF=refs/heads/master
|
||||
GITHUB_REF_NAME=master
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=branch
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188642074
|
||||
GITHUB_RUN_NUMBER=8
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=266574110acf203503badf966df2ea24b5d732d7
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_940c04a5-537a-4401-afe6-1f044e1d3836
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
205
__tests__/fixtures/event_discussion_pinned.json
Normal file
205
__tests__/fixtures/event_discussion_pinned.json
Normal file
@ -0,0 +1,205 @@
|
||||
{
|
||||
"action": "pinned",
|
||||
"discussion": {
|
||||
"active_lock_reason": null,
|
||||
"answer_chosen_at": null,
|
||||
"answer_chosen_by": null,
|
||||
"answer_html_url": null,
|
||||
"author_association": "COLLABORATOR",
|
||||
"body": "bar",
|
||||
"category": {
|
||||
"created_at": "2022-04-19T11:05:12.000+02:00",
|
||||
"description": "Chat about anything and everything here",
|
||||
"emoji": ":speech_balloon:",
|
||||
"id": 37396924,
|
||||
"is_answerable": false,
|
||||
"name": "General",
|
||||
"node_id": "DIC_kwDOEQjNNc4COqG8",
|
||||
"repository_id": 285789493,
|
||||
"slug": "general",
|
||||
"updated_at": "2022-04-19T11:05:12.000+02:00"
|
||||
},
|
||||
"comments": 0,
|
||||
"created_at": "2022-04-19T09:07:32Z",
|
||||
"html_url": "https://github.com/docker/test-docker-action/discussions/13",
|
||||
"id": 4019118,
|
||||
"locked": false,
|
||||
"node_id": "D_kwDOEQjNNc4APVOu",
|
||||
"number": 13,
|
||||
"reactions": {
|
||||
"+1": 0,
|
||||
"-1": 0,
|
||||
"confused": 0,
|
||||
"eyes": 0,
|
||||
"heart": 0,
|
||||
"hooray": 0,
|
||||
"laugh": 0,
|
||||
"rocket": 0,
|
||||
"total_count": 0,
|
||||
"url": "https://api.github.com/repos/docker/test-docker-action/discussions/13/reactions"
|
||||
},
|
||||
"repository_url": "https://api.github.com/repos/docker/test-docker-action",
|
||||
"state": "open",
|
||||
"timeline_url": "https://api.github.com/repos/docker/test-docker-action/discussions/13/timeline",
|
||||
"title": "foo",
|
||||
"updated_at": "2022-04-19T09:07:32Z",
|
||||
"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/orgs",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"organization": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"description": "Docker helps developers bring their ideas to life by conquering the complexity of app development.",
|
||||
"events_url": "https://api.github.com/orgs/docker/events",
|
||||
"hooks_url": "https://api.github.com/orgs/docker/hooks",
|
||||
"id": 5429470,
|
||||
"issues_url": "https://api.github.com/orgs/docker/issues",
|
||||
"login": "docker",
|
||||
"members_url": "https://api.github.com/orgs/docker/members{/member}",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"public_members_url": "https://api.github.com/orgs/docker/public_members{/member}",
|
||||
"repos_url": "https://api.github.com/orgs/docker/repos",
|
||||
"url": "https://api.github.com/orgs/docker"
|
||||
},
|
||||
"repository": {
|
||||
"allow_forking": true,
|
||||
"archive_url": "https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}",
|
||||
"archived": false,
|
||||
"assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}",
|
||||
"blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}",
|
||||
"branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}",
|
||||
"clone_url": "https://github.com/docker/test-docker-action.git",
|
||||
"collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}",
|
||||
"comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}",
|
||||
"commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}",
|
||||
"compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}",
|
||||
"contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}",
|
||||
"contributors_url": "https://api.github.com/repos/docker/test-docker-action/contributors",
|
||||
"created_at": "2020-08-07T09:23:00Z",
|
||||
"default_branch": "master",
|
||||
"deployments_url": "https://api.github.com/repos/docker/test-docker-action/deployments",
|
||||
"description": "Test \"Docker\" Actions",
|
||||
"disabled": false,
|
||||
"downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads",
|
||||
"events_url": "https://api.github.com/repos/docker/test-docker-action/events",
|
||||
"fork": false,
|
||||
"forks": 1,
|
||||
"forks_count": 1,
|
||||
"forks_url": "https://api.github.com/repos/docker/test-docker-action/forks",
|
||||
"full_name": "docker/test-docker-action",
|
||||
"git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}",
|
||||
"git_url": "git://github.com/docker/test-docker-action.git",
|
||||
"has_downloads": true,
|
||||
"has_issues": true,
|
||||
"has_pages": false,
|
||||
"has_projects": true,
|
||||
"has_wiki": true,
|
||||
"homepage": "",
|
||||
"hooks_url": "https://api.github.com/repos/docker/test-docker-action/hooks",
|
||||
"html_url": "https://github.com/docker/test-docker-action",
|
||||
"id": 285789493,
|
||||
"is_template": false,
|
||||
"issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}",
|
||||
"issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}",
|
||||
"issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}",
|
||||
"keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}",
|
||||
"labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}",
|
||||
"language": "JavaScript",
|
||||
"languages_url": "https://api.github.com/repos/docker/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/docker/test-docker-action/merges",
|
||||
"milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}",
|
||||
"mirror_url": null,
|
||||
"name": "test-docker-action",
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||
"notifications_url": "https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}",
|
||||
"open_issues": 4,
|
||||
"open_issues_count": 4,
|
||||
"owner": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"events_url": "https://api.github.com/users/docker/events{/privacy}",
|
||||
"followers_url": "https://api.github.com/users/docker/followers",
|
||||
"following_url": "https://api.github.com/users/docker/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/docker/gists{/gist_id}",
|
||||
"gravatar_id": "",
|
||||
"html_url": "https://github.com/docker",
|
||||
"id": 5429470,
|
||||
"login": "docker",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"organizations_url": "https://api.github.com/users/docker/orgs",
|
||||
"received_events_url": "https://api.github.com/users/docker/received_events",
|
||||
"repos_url": "https://api.github.com/users/docker/repos",
|
||||
"site_admin": false,
|
||||
"starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/docker/subscriptions",
|
||||
"type": "Organization",
|
||||
"url": "https://api.github.com/users/docker"
|
||||
},
|
||||
"private": true,
|
||||
"pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}",
|
||||
"pushed_at": "2022-04-19T09:04:50Z",
|
||||
"releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}",
|
||||
"size": 796,
|
||||
"ssh_url": "git@github.com:docker/test-docker-action.git",
|
||||
"stargazers_count": 0,
|
||||
"stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers",
|
||||
"statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}",
|
||||
"subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription",
|
||||
"svn_url": "https://github.com/docker/test-docker-action",
|
||||
"tags_url": "https://api.github.com/repos/docker/test-docker-action/tags",
|
||||
"teams_url": "https://api.github.com/repos/docker/test-docker-action/teams",
|
||||
"topics": [],
|
||||
"trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}",
|
||||
"updated_at": "2022-04-19T09:05:09Z",
|
||||
"url": "https://api.github.com/repos/docker/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/orgs",
|
||||
"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"
|
||||
}
|
||||
}
|
30
__tests__/fixtures/event_issue_opened.env
Normal file
30
__tests__/fixtures/event_issue_opened.env
Normal file
@ -0,0 +1,30 @@
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_b598b668-2cad-465a-b526-d21912b7d2b2
|
||||
GITHUB_EVENT_NAME=issues
|
||||
GITHUB_EVENT_PATH=./__tests__/fixtures/event_issue_opened.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_b598b668-2cad-465a-b526-d21912b7d2b2
|
||||
GITHUB_REF=refs/heads/master
|
||||
GITHUB_REF_NAME=master
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=branch
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188657159
|
||||
GITHUB_RUN_NUMBER=9
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=266574110acf203503badf966df2ea24b5d732d7
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_b598b668-2cad-465a-b526-d21912b7d2b2
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
200
__tests__/fixtures/event_issue_opened.json
Normal file
200
__tests__/fixtures/event_issue_opened.json
Normal file
@ -0,0 +1,200 @@
|
||||
{
|
||||
"action": "opened",
|
||||
"issue": {
|
||||
"active_lock_reason": null,
|
||||
"assignee": null,
|
||||
"assignees": [],
|
||||
"author_association": "COLLABORATOR",
|
||||
"body": "bar",
|
||||
"closed_at": null,
|
||||
"comments": 0,
|
||||
"comments_url": "https://api.github.com/repos/docker/test-docker-action/issues/14/comments",
|
||||
"created_at": "2022-04-19T09:10:26Z",
|
||||
"events_url": "https://api.github.com/repos/docker/test-docker-action/issues/14/events",
|
||||
"html_url": "https://github.com/docker/test-docker-action/issues/14",
|
||||
"id": 1208034626,
|
||||
"labels": [],
|
||||
"labels_url": "https://api.github.com/repos/docker/test-docker-action/issues/14/labels{/name}",
|
||||
"locked": false,
|
||||
"milestone": null,
|
||||
"node_id": "I_kwDOEQjNNc5IASVC",
|
||||
"number": 14,
|
||||
"performed_via_github_app": null,
|
||||
"reactions": {
|
||||
"+1": 0,
|
||||
"-1": 0,
|
||||
"confused": 0,
|
||||
"eyes": 0,
|
||||
"heart": 0,
|
||||
"hooray": 0,
|
||||
"laugh": 0,
|
||||
"rocket": 0,
|
||||
"total_count": 0,
|
||||
"url": "https://api.github.com/repos/docker/test-docker-action/issues/14/reactions"
|
||||
},
|
||||
"repository_url": "https://api.github.com/repos/docker/test-docker-action",
|
||||
"state": "open",
|
||||
"timeline_url": "https://api.github.com/repos/docker/test-docker-action/issues/14/timeline",
|
||||
"title": "foo",
|
||||
"updated_at": "2022-04-19T09:10:26Z",
|
||||
"url": "https://api.github.com/repos/docker/test-docker-action/issues/14",
|
||||
"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/orgs",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"organization": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"description": "Docker helps developers bring their ideas to life by conquering the complexity of app development.",
|
||||
"events_url": "https://api.github.com/orgs/docker/events",
|
||||
"hooks_url": "https://api.github.com/orgs/docker/hooks",
|
||||
"id": 5429470,
|
||||
"issues_url": "https://api.github.com/orgs/docker/issues",
|
||||
"login": "docker",
|
||||
"members_url": "https://api.github.com/orgs/docker/members{/member}",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"public_members_url": "https://api.github.com/orgs/docker/public_members{/member}",
|
||||
"repos_url": "https://api.github.com/orgs/docker/repos",
|
||||
"url": "https://api.github.com/orgs/docker"
|
||||
},
|
||||
"repository": {
|
||||
"allow_forking": true,
|
||||
"archive_url": "https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}",
|
||||
"archived": false,
|
||||
"assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}",
|
||||
"blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}",
|
||||
"branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}",
|
||||
"clone_url": "https://github.com/docker/test-docker-action.git",
|
||||
"collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}",
|
||||
"comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}",
|
||||
"commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}",
|
||||
"compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}",
|
||||
"contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}",
|
||||
"contributors_url": "https://api.github.com/repos/docker/test-docker-action/contributors",
|
||||
"created_at": "2020-08-07T09:23:00Z",
|
||||
"default_branch": "master",
|
||||
"deployments_url": "https://api.github.com/repos/docker/test-docker-action/deployments",
|
||||
"description": "Test \"Docker\" Actions",
|
||||
"disabled": false,
|
||||
"downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads",
|
||||
"events_url": "https://api.github.com/repos/docker/test-docker-action/events",
|
||||
"fork": false,
|
||||
"forks": 1,
|
||||
"forks_count": 1,
|
||||
"forks_url": "https://api.github.com/repos/docker/test-docker-action/forks",
|
||||
"full_name": "docker/test-docker-action",
|
||||
"git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}",
|
||||
"git_url": "git://github.com/docker/test-docker-action.git",
|
||||
"has_downloads": true,
|
||||
"has_issues": true,
|
||||
"has_pages": false,
|
||||
"has_projects": true,
|
||||
"has_wiki": true,
|
||||
"homepage": "",
|
||||
"hooks_url": "https://api.github.com/repos/docker/test-docker-action/hooks",
|
||||
"html_url": "https://github.com/docker/test-docker-action",
|
||||
"id": 285789493,
|
||||
"is_template": false,
|
||||
"issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}",
|
||||
"issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}",
|
||||
"issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}",
|
||||
"keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}",
|
||||
"labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}",
|
||||
"language": "JavaScript",
|
||||
"languages_url": "https://api.github.com/repos/docker/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/docker/test-docker-action/merges",
|
||||
"milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}",
|
||||
"mirror_url": null,
|
||||
"name": "test-docker-action",
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||
"notifications_url": "https://api.github.com/repos/docker/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/docker/events{/privacy}",
|
||||
"followers_url": "https://api.github.com/users/docker/followers",
|
||||
"following_url": "https://api.github.com/users/docker/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/docker/gists{/gist_id}",
|
||||
"gravatar_id": "",
|
||||
"html_url": "https://github.com/docker",
|
||||
"id": 5429470,
|
||||
"login": "docker",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"organizations_url": "https://api.github.com/users/docker/orgs",
|
||||
"received_events_url": "https://api.github.com/users/docker/received_events",
|
||||
"repos_url": "https://api.github.com/users/docker/repos",
|
||||
"site_admin": false,
|
||||
"starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/docker/subscriptions",
|
||||
"type": "Organization",
|
||||
"url": "https://api.github.com/users/docker"
|
||||
},
|
||||
"private": true,
|
||||
"pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}",
|
||||
"pushed_at": "2022-04-19T09:04:50Z",
|
||||
"releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}",
|
||||
"size": 796,
|
||||
"ssh_url": "git@github.com:docker/test-docker-action.git",
|
||||
"stargazers_count": 0,
|
||||
"stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers",
|
||||
"statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}",
|
||||
"subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription",
|
||||
"svn_url": "https://github.com/docker/test-docker-action",
|
||||
"tags_url": "https://api.github.com/repos/docker/test-docker-action/tags",
|
||||
"teams_url": "https://api.github.com/repos/docker/test-docker-action/teams",
|
||||
"topics": [],
|
||||
"trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}",
|
||||
"updated_at": "2022-04-19T09:05:09Z",
|
||||
"url": "https://api.github.com/repos/docker/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/orgs",
|
||||
"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"
|
||||
}
|
||||
}
|
@ -1,23 +1,30 @@
|
||||
GITHUB_ACTION=crazy-maxghaction-dump-context
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
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_ca953e95-2f41-4926-bc52-a1c8d90e94c1
|
||||
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_HEAD_REF=pr
|
||||
GITHUB_JOB=event
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_e00a951d-2585-4fac-b085-459d80e69a2f
|
||||
GITHUB_REF=refs/pull/2/merge
|
||||
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||
GITHUB_HEAD_REF=test-pr
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_ca953e95-2f41-4926-bc52-a1c8d90e94c1
|
||||
GITHUB_REF=refs/pull/15/merge
|
||||
GITHUB_REF_NAME=15/merge
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=branch
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ID=325972677
|
||||
GITHUB_RUN_NUMBER=7
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188688025
|
||||
GITHUB_RUN_NUMBER=11
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=1e9249f05bfc090e0688b8fb9c1b347586add504
|
||||
GITHUB_WORKFLOW=event
|
||||
GITHUB_SHA=a9c8c5828b91be19d9728548b24759e352367ef1
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_ca953e95-2f41-4926-bc52-a1c8d90e94c1
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
||||
|
504
__tests__/fixtures/event_pull_request.json
Normal file
504
__tests__/fixtures/event_pull_request.json
Normal file
@ -0,0 +1,504 @@
|
||||
{
|
||||
"action": "opened",
|
||||
"number": 15,
|
||||
"organization": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"description": "Docker helps developers bring their ideas to life by conquering the complexity of app development.",
|
||||
"events_url": "https://api.github.com/orgs/docker/events",
|
||||
"hooks_url": "https://api.github.com/orgs/docker/hooks",
|
||||
"id": 5429470,
|
||||
"issues_url": "https://api.github.com/orgs/docker/issues",
|
||||
"login": "docker",
|
||||
"members_url": "https://api.github.com/orgs/docker/members{/member}",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"public_members_url": "https://api.github.com/orgs/docker/public_members{/member}",
|
||||
"repos_url": "https://api.github.com/orgs/docker/repos",
|
||||
"url": "https://api.github.com/orgs/docker"
|
||||
},
|
||||
"pull_request": {
|
||||
"_links": {
|
||||
"comments": {
|
||||
"href": "https://api.github.com/repos/docker/test-docker-action/issues/15/comments"
|
||||
},
|
||||
"commits": {
|
||||
"href": "https://api.github.com/repos/docker/test-docker-action/pulls/15/commits"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://github.com/docker/test-docker-action/pull/15"
|
||||
},
|
||||
"issue": {
|
||||
"href": "https://api.github.com/repos/docker/test-docker-action/issues/15"
|
||||
},
|
||||
"review_comment": {
|
||||
"href": "https://api.github.com/repos/docker/test-docker-action/pulls/comments{/number}"
|
||||
},
|
||||
"review_comments": {
|
||||
"href": "https://api.github.com/repos/docker/test-docker-action/pulls/15/comments"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.github.com/repos/docker/test-docker-action/pulls/15"
|
||||
},
|
||||
"statuses": {
|
||||
"href": "https://api.github.com/repos/docker/test-docker-action/statuses/3370e228f2209994d57af4427fe64e71bb79ac96"
|
||||
}
|
||||
},
|
||||
"active_lock_reason": null,
|
||||
"additions": 1,
|
||||
"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,
|
||||
"allow_update_branch": false,
|
||||
"archive_url": "https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}",
|
||||
"archived": false,
|
||||
"assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}",
|
||||
"blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}",
|
||||
"branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}",
|
||||
"clone_url": "https://github.com/docker/test-docker-action.git",
|
||||
"collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}",
|
||||
"comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}",
|
||||
"commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}",
|
||||
"compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}",
|
||||
"contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}",
|
||||
"contributors_url": "https://api.github.com/repos/docker/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/docker/test-docker-action/deployments",
|
||||
"description": "Test \"Docker\" Actions",
|
||||
"disabled": false,
|
||||
"downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads",
|
||||
"events_url": "https://api.github.com/repos/docker/test-docker-action/events",
|
||||
"fork": false,
|
||||
"forks": 1,
|
||||
"forks_count": 1,
|
||||
"forks_url": "https://api.github.com/repos/docker/test-docker-action/forks",
|
||||
"full_name": "docker/test-docker-action",
|
||||
"git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}",
|
||||
"git_url": "git://github.com/docker/test-docker-action.git",
|
||||
"has_downloads": true,
|
||||
"has_issues": true,
|
||||
"has_pages": false,
|
||||
"has_projects": true,
|
||||
"has_wiki": true,
|
||||
"homepage": "",
|
||||
"hooks_url": "https://api.github.com/repos/docker/test-docker-action/hooks",
|
||||
"html_url": "https://github.com/docker/test-docker-action",
|
||||
"id": 285789493,
|
||||
"is_template": false,
|
||||
"issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}",
|
||||
"issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}",
|
||||
"issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}",
|
||||
"keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}",
|
||||
"labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}",
|
||||
"language": "JavaScript",
|
||||
"languages_url": "https://api.github.com/repos/docker/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/docker/test-docker-action/merges",
|
||||
"milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}",
|
||||
"mirror_url": null,
|
||||
"name": "test-docker-action",
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||
"notifications_url": "https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}",
|
||||
"open_issues": 6,
|
||||
"open_issues_count": 6,
|
||||
"owner": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"events_url": "https://api.github.com/users/docker/events{/privacy}",
|
||||
"followers_url": "https://api.github.com/users/docker/followers",
|
||||
"following_url": "https://api.github.com/users/docker/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/docker/gists{/gist_id}",
|
||||
"gravatar_id": "",
|
||||
"html_url": "https://github.com/docker",
|
||||
"id": 5429470,
|
||||
"login": "docker",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"organizations_url": "https://api.github.com/users/docker/orgs",
|
||||
"received_events_url": "https://api.github.com/users/docker/received_events",
|
||||
"repos_url": "https://api.github.com/users/docker/repos",
|
||||
"site_admin": false,
|
||||
"starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/docker/subscriptions",
|
||||
"type": "Organization",
|
||||
"url": "https://api.github.com/users/docker"
|
||||
},
|
||||
"private": true,
|
||||
"pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}",
|
||||
"pushed_at": "2022-04-19T09:04:50Z",
|
||||
"releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}",
|
||||
"size": 796,
|
||||
"ssh_url": "git@github.com:docker/test-docker-action.git",
|
||||
"stargazers_count": 0,
|
||||
"stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers",
|
||||
"statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}",
|
||||
"subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription",
|
||||
"svn_url": "https://github.com/docker/test-docker-action",
|
||||
"tags_url": "https://api.github.com/repos/docker/test-docker-action/tags",
|
||||
"teams_url": "https://api.github.com/repos/docker/test-docker-action/teams",
|
||||
"topics": [],
|
||||
"trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}",
|
||||
"updated_at": "2022-04-19T09:05:09Z",
|
||||
"url": "https://api.github.com/repos/docker/test-docker-action",
|
||||
"visibility": "private",
|
||||
"watchers": 0,
|
||||
"watchers_count": 0
|
||||
},
|
||||
"sha": "266574110acf203503badf966df2ea24b5d732d7",
|
||||
"user": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"events_url": "https://api.github.com/users/docker/events{/privacy}",
|
||||
"followers_url": "https://api.github.com/users/docker/followers",
|
||||
"following_url": "https://api.github.com/users/docker/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/docker/gists{/gist_id}",
|
||||
"gravatar_id": "",
|
||||
"html_url": "https://github.com/docker",
|
||||
"id": 5429470,
|
||||
"login": "docker",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"organizations_url": "https://api.github.com/users/docker/orgs",
|
||||
"received_events_url": "https://api.github.com/users/docker/received_events",
|
||||
"repos_url": "https://api.github.com/users/docker/repos",
|
||||
"site_admin": false,
|
||||
"starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/docker/subscriptions",
|
||||
"type": "Organization",
|
||||
"url": "https://api.github.com/users/docker"
|
||||
}
|
||||
},
|
||||
"body": null,
|
||||
"changed_files": 1,
|
||||
"closed_at": null,
|
||||
"comments": 0,
|
||||
"comments_url": "https://api.github.com/repos/docker/test-docker-action/issues/15/comments",
|
||||
"commits": 1,
|
||||
"commits_url": "https://api.github.com/repos/docker/test-docker-action/pulls/15/commits",
|
||||
"created_at": "2022-04-19T09:16:17Z",
|
||||
"deletions": 1,
|
||||
"diff_url": "https://github.com/docker/test-docker-action/pull/15.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,
|
||||
"allow_update_branch": false,
|
||||
"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": "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": "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/orgs",
|
||||
"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": "2022-04-19T09:16:07Z",
|
||||
"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": "2022-04-19T09:13:10Z",
|
||||
"url": "https://api.github.com/repos/crazy-max/test-docker-action",
|
||||
"visibility": "private",
|
||||
"watchers": 0,
|
||||
"watchers_count": 0
|
||||
},
|
||||
"sha": "3370e228f2209994d57af4427fe64e71bb79ac96",
|
||||
"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/orgs",
|
||||
"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/docker/test-docker-action/pull/15",
|
||||
"id": 912840343,
|
||||
"issue_url": "https://api.github.com/repos/docker/test-docker-action/issues/15",
|
||||
"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_kwDOEQjNNc42aNaX",
|
||||
"number": 15,
|
||||
"patch_url": "https://github.com/docker/test-docker-action/pull/15.patch",
|
||||
"rebaseable": null,
|
||||
"requested_reviewers": [],
|
||||
"requested_teams": [],
|
||||
"review_comment_url": "https://api.github.com/repos/docker/test-docker-action/pulls/comments{/number}",
|
||||
"review_comments": 0,
|
||||
"review_comments_url": "https://api.github.com/repos/docker/test-docker-action/pulls/15/comments",
|
||||
"state": "open",
|
||||
"statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/3370e228f2209994d57af4427fe64e71bb79ac96",
|
||||
"title": "small change",
|
||||
"updated_at": "2022-04-19T09:16:17Z",
|
||||
"url": "https://api.github.com/repos/docker/test-docker-action/pulls/15",
|
||||
"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/orgs",
|
||||
"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/docker/test-docker-action/{archive_format}{/ref}",
|
||||
"archived": false,
|
||||
"assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}",
|
||||
"blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}",
|
||||
"branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}",
|
||||
"clone_url": "https://github.com/docker/test-docker-action.git",
|
||||
"collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}",
|
||||
"comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}",
|
||||
"commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}",
|
||||
"compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}",
|
||||
"contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}",
|
||||
"contributors_url": "https://api.github.com/repos/docker/test-docker-action/contributors",
|
||||
"created_at": "2020-08-07T09:23:00Z",
|
||||
"default_branch": "master",
|
||||
"deployments_url": "https://api.github.com/repos/docker/test-docker-action/deployments",
|
||||
"description": "Test \"Docker\" Actions",
|
||||
"disabled": false,
|
||||
"downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads",
|
||||
"events_url": "https://api.github.com/repos/docker/test-docker-action/events",
|
||||
"fork": false,
|
||||
"forks": 1,
|
||||
"forks_count": 1,
|
||||
"forks_url": "https://api.github.com/repos/docker/test-docker-action/forks",
|
||||
"full_name": "docker/test-docker-action",
|
||||
"git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}",
|
||||
"git_url": "git://github.com/docker/test-docker-action.git",
|
||||
"has_downloads": true,
|
||||
"has_issues": true,
|
||||
"has_pages": false,
|
||||
"has_projects": true,
|
||||
"has_wiki": true,
|
||||
"homepage": "",
|
||||
"hooks_url": "https://api.github.com/repos/docker/test-docker-action/hooks",
|
||||
"html_url": "https://github.com/docker/test-docker-action",
|
||||
"id": 285789493,
|
||||
"is_template": false,
|
||||
"issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}",
|
||||
"issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}",
|
||||
"issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}",
|
||||
"keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}",
|
||||
"labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}",
|
||||
"language": "JavaScript",
|
||||
"languages_url": "https://api.github.com/repos/docker/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/docker/test-docker-action/merges",
|
||||
"milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}",
|
||||
"mirror_url": null,
|
||||
"name": "test-docker-action",
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||
"notifications_url": "https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}",
|
||||
"open_issues": 6,
|
||||
"open_issues_count": 6,
|
||||
"owner": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"events_url": "https://api.github.com/users/docker/events{/privacy}",
|
||||
"followers_url": "https://api.github.com/users/docker/followers",
|
||||
"following_url": "https://api.github.com/users/docker/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/docker/gists{/gist_id}",
|
||||
"gravatar_id": "",
|
||||
"html_url": "https://github.com/docker",
|
||||
"id": 5429470,
|
||||
"login": "docker",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"organizations_url": "https://api.github.com/users/docker/orgs",
|
||||
"received_events_url": "https://api.github.com/users/docker/received_events",
|
||||
"repos_url": "https://api.github.com/users/docker/repos",
|
||||
"site_admin": false,
|
||||
"starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/docker/subscriptions",
|
||||
"type": "Organization",
|
||||
"url": "https://api.github.com/users/docker"
|
||||
},
|
||||
"private": true,
|
||||
"pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}",
|
||||
"pushed_at": "2022-04-19T09:04:50Z",
|
||||
"releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}",
|
||||
"size": 796,
|
||||
"ssh_url": "git@github.com:docker/test-docker-action.git",
|
||||
"stargazers_count": 0,
|
||||
"stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers",
|
||||
"statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}",
|
||||
"subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription",
|
||||
"svn_url": "https://github.com/docker/test-docker-action",
|
||||
"tags_url": "https://api.github.com/repos/docker/test-docker-action/tags",
|
||||
"teams_url": "https://api.github.com/repos/docker/test-docker-action/teams",
|
||||
"topics": [],
|
||||
"trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}",
|
||||
"updated_at": "2022-04-19T09:05:09Z",
|
||||
"url": "https://api.github.com/repos/docker/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/orgs",
|
||||
"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"
|
||||
}
|
||||
}
|
30
__tests__/fixtures/event_pull_request_target.env
Normal file
30
__tests__/fixtures/event_pull_request_target.env
Normal file
@ -0,0 +1,30 @@
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=master
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_2f69f48f-fb93-475f-a6a5-91dc7866f518
|
||||
GITHUB_EVENT_NAME=pull_request_target
|
||||
GITHUB_EVENT_PATH=./__tests__/fixtures/event_pull_request_target.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=test-pr
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_2f69f48f-fb93-475f-a6a5-91dc7866f518
|
||||
GITHUB_REF=refs/heads/master
|
||||
GITHUB_REF_NAME=master
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=branch
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188688000
|
||||
GITHUB_RUN_NUMBER=10
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=266574110acf203503badf966df2ea24b5d732d7
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_2f69f48f-fb93-475f-a6a5-91dc7866f518
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
504
__tests__/fixtures/event_pull_request_target.json
Normal file
504
__tests__/fixtures/event_pull_request_target.json
Normal file
@ -0,0 +1,504 @@
|
||||
{
|
||||
"action": "opened",
|
||||
"number": 15,
|
||||
"organization": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"description": "Docker helps developers bring their ideas to life by conquering the complexity of app development.",
|
||||
"events_url": "https://api.github.com/orgs/docker/events",
|
||||
"hooks_url": "https://api.github.com/orgs/docker/hooks",
|
||||
"id": 5429470,
|
||||
"issues_url": "https://api.github.com/orgs/docker/issues",
|
||||
"login": "docker",
|
||||
"members_url": "https://api.github.com/orgs/docker/members{/member}",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"public_members_url": "https://api.github.com/orgs/docker/public_members{/member}",
|
||||
"repos_url": "https://api.github.com/orgs/docker/repos",
|
||||
"url": "https://api.github.com/orgs/docker"
|
||||
},
|
||||
"pull_request": {
|
||||
"_links": {
|
||||
"comments": {
|
||||
"href": "https://api.github.com/repos/docker/test-docker-action/issues/15/comments"
|
||||
},
|
||||
"commits": {
|
||||
"href": "https://api.github.com/repos/docker/test-docker-action/pulls/15/commits"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://github.com/docker/test-docker-action/pull/15"
|
||||
},
|
||||
"issue": {
|
||||
"href": "https://api.github.com/repos/docker/test-docker-action/issues/15"
|
||||
},
|
||||
"review_comment": {
|
||||
"href": "https://api.github.com/repos/docker/test-docker-action/pulls/comments{/number}"
|
||||
},
|
||||
"review_comments": {
|
||||
"href": "https://api.github.com/repos/docker/test-docker-action/pulls/15/comments"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.github.com/repos/docker/test-docker-action/pulls/15"
|
||||
},
|
||||
"statuses": {
|
||||
"href": "https://api.github.com/repos/docker/test-docker-action/statuses/3370e228f2209994d57af4427fe64e71bb79ac96"
|
||||
}
|
||||
},
|
||||
"active_lock_reason": null,
|
||||
"additions": 1,
|
||||
"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,
|
||||
"allow_update_branch": false,
|
||||
"archive_url": "https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}",
|
||||
"archived": false,
|
||||
"assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}",
|
||||
"blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}",
|
||||
"branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}",
|
||||
"clone_url": "https://github.com/docker/test-docker-action.git",
|
||||
"collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}",
|
||||
"comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}",
|
||||
"commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}",
|
||||
"compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}",
|
||||
"contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}",
|
||||
"contributors_url": "https://api.github.com/repos/docker/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/docker/test-docker-action/deployments",
|
||||
"description": "Test \"Docker\" Actions",
|
||||
"disabled": false,
|
||||
"downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads",
|
||||
"events_url": "https://api.github.com/repos/docker/test-docker-action/events",
|
||||
"fork": false,
|
||||
"forks": 1,
|
||||
"forks_count": 1,
|
||||
"forks_url": "https://api.github.com/repos/docker/test-docker-action/forks",
|
||||
"full_name": "docker/test-docker-action",
|
||||
"git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}",
|
||||
"git_url": "git://github.com/docker/test-docker-action.git",
|
||||
"has_downloads": true,
|
||||
"has_issues": true,
|
||||
"has_pages": false,
|
||||
"has_projects": true,
|
||||
"has_wiki": true,
|
||||
"homepage": "",
|
||||
"hooks_url": "https://api.github.com/repos/docker/test-docker-action/hooks",
|
||||
"html_url": "https://github.com/docker/test-docker-action",
|
||||
"id": 285789493,
|
||||
"is_template": false,
|
||||
"issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}",
|
||||
"issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}",
|
||||
"issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}",
|
||||
"keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}",
|
||||
"labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}",
|
||||
"language": "JavaScript",
|
||||
"languages_url": "https://api.github.com/repos/docker/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/docker/test-docker-action/merges",
|
||||
"milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}",
|
||||
"mirror_url": null,
|
||||
"name": "test-docker-action",
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||
"notifications_url": "https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}",
|
||||
"open_issues": 6,
|
||||
"open_issues_count": 6,
|
||||
"owner": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"events_url": "https://api.github.com/users/docker/events{/privacy}",
|
||||
"followers_url": "https://api.github.com/users/docker/followers",
|
||||
"following_url": "https://api.github.com/users/docker/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/docker/gists{/gist_id}",
|
||||
"gravatar_id": "",
|
||||
"html_url": "https://github.com/docker",
|
||||
"id": 5429470,
|
||||
"login": "docker",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"organizations_url": "https://api.github.com/users/docker/orgs",
|
||||
"received_events_url": "https://api.github.com/users/docker/received_events",
|
||||
"repos_url": "https://api.github.com/users/docker/repos",
|
||||
"site_admin": false,
|
||||
"starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/docker/subscriptions",
|
||||
"type": "Organization",
|
||||
"url": "https://api.github.com/users/docker"
|
||||
},
|
||||
"private": true,
|
||||
"pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}",
|
||||
"pushed_at": "2022-04-19T09:04:50Z",
|
||||
"releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}",
|
||||
"size": 796,
|
||||
"ssh_url": "git@github.com:docker/test-docker-action.git",
|
||||
"stargazers_count": 0,
|
||||
"stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers",
|
||||
"statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}",
|
||||
"subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription",
|
||||
"svn_url": "https://github.com/docker/test-docker-action",
|
||||
"tags_url": "https://api.github.com/repos/docker/test-docker-action/tags",
|
||||
"teams_url": "https://api.github.com/repos/docker/test-docker-action/teams",
|
||||
"topics": [],
|
||||
"trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}",
|
||||
"updated_at": "2022-04-19T09:05:09Z",
|
||||
"url": "https://api.github.com/repos/docker/test-docker-action",
|
||||
"visibility": "private",
|
||||
"watchers": 0,
|
||||
"watchers_count": 0
|
||||
},
|
||||
"sha": "266574110acf203503badf966df2ea24b5d732d7",
|
||||
"user": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"events_url": "https://api.github.com/users/docker/events{/privacy}",
|
||||
"followers_url": "https://api.github.com/users/docker/followers",
|
||||
"following_url": "https://api.github.com/users/docker/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/docker/gists{/gist_id}",
|
||||
"gravatar_id": "",
|
||||
"html_url": "https://github.com/docker",
|
||||
"id": 5429470,
|
||||
"login": "docker",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"organizations_url": "https://api.github.com/users/docker/orgs",
|
||||
"received_events_url": "https://api.github.com/users/docker/received_events",
|
||||
"repos_url": "https://api.github.com/users/docker/repos",
|
||||
"site_admin": false,
|
||||
"starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/docker/subscriptions",
|
||||
"type": "Organization",
|
||||
"url": "https://api.github.com/users/docker"
|
||||
}
|
||||
},
|
||||
"body": null,
|
||||
"changed_files": 1,
|
||||
"closed_at": null,
|
||||
"comments": 0,
|
||||
"comments_url": "https://api.github.com/repos/docker/test-docker-action/issues/15/comments",
|
||||
"commits": 1,
|
||||
"commits_url": "https://api.github.com/repos/docker/test-docker-action/pulls/15/commits",
|
||||
"created_at": "2022-04-19T09:16:17Z",
|
||||
"deletions": 1,
|
||||
"diff_url": "https://github.com/docker/test-docker-action/pull/15.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,
|
||||
"allow_update_branch": false,
|
||||
"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": "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": "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/orgs",
|
||||
"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": "2022-04-19T09:16:07Z",
|
||||
"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": "2022-04-19T09:13:10Z",
|
||||
"url": "https://api.github.com/repos/crazy-max/test-docker-action",
|
||||
"visibility": "private",
|
||||
"watchers": 0,
|
||||
"watchers_count": 0
|
||||
},
|
||||
"sha": "3370e228f2209994d57af4427fe64e71bb79ac96",
|
||||
"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/orgs",
|
||||
"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/docker/test-docker-action/pull/15",
|
||||
"id": 912840343,
|
||||
"issue_url": "https://api.github.com/repos/docker/test-docker-action/issues/15",
|
||||
"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_kwDOEQjNNc42aNaX",
|
||||
"number": 15,
|
||||
"patch_url": "https://github.com/docker/test-docker-action/pull/15.patch",
|
||||
"rebaseable": null,
|
||||
"requested_reviewers": [],
|
||||
"requested_teams": [],
|
||||
"review_comment_url": "https://api.github.com/repos/docker/test-docker-action/pulls/comments{/number}",
|
||||
"review_comments": 0,
|
||||
"review_comments_url": "https://api.github.com/repos/docker/test-docker-action/pulls/15/comments",
|
||||
"state": "open",
|
||||
"statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/3370e228f2209994d57af4427fe64e71bb79ac96",
|
||||
"title": "small change",
|
||||
"updated_at": "2022-04-19T09:16:17Z",
|
||||
"url": "https://api.github.com/repos/docker/test-docker-action/pulls/15",
|
||||
"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/orgs",
|
||||
"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/docker/test-docker-action/{archive_format}{/ref}",
|
||||
"archived": false,
|
||||
"assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}",
|
||||
"blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}",
|
||||
"branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}",
|
||||
"clone_url": "https://github.com/docker/test-docker-action.git",
|
||||
"collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}",
|
||||
"comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}",
|
||||
"commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}",
|
||||
"compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}",
|
||||
"contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}",
|
||||
"contributors_url": "https://api.github.com/repos/docker/test-docker-action/contributors",
|
||||
"created_at": "2020-08-07T09:23:00Z",
|
||||
"default_branch": "master",
|
||||
"deployments_url": "https://api.github.com/repos/docker/test-docker-action/deployments",
|
||||
"description": "Test \"Docker\" Actions",
|
||||
"disabled": false,
|
||||
"downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads",
|
||||
"events_url": "https://api.github.com/repos/docker/test-docker-action/events",
|
||||
"fork": false,
|
||||
"forks": 1,
|
||||
"forks_count": 1,
|
||||
"forks_url": "https://api.github.com/repos/docker/test-docker-action/forks",
|
||||
"full_name": "docker/test-docker-action",
|
||||
"git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}",
|
||||
"git_url": "git://github.com/docker/test-docker-action.git",
|
||||
"has_downloads": true,
|
||||
"has_issues": true,
|
||||
"has_pages": false,
|
||||
"has_projects": true,
|
||||
"has_wiki": true,
|
||||
"homepage": "",
|
||||
"hooks_url": "https://api.github.com/repos/docker/test-docker-action/hooks",
|
||||
"html_url": "https://github.com/docker/test-docker-action",
|
||||
"id": 285789493,
|
||||
"is_template": false,
|
||||
"issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}",
|
||||
"issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}",
|
||||
"issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}",
|
||||
"keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}",
|
||||
"labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}",
|
||||
"language": "JavaScript",
|
||||
"languages_url": "https://api.github.com/repos/docker/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/docker/test-docker-action/merges",
|
||||
"milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}",
|
||||
"mirror_url": null,
|
||||
"name": "test-docker-action",
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||
"notifications_url": "https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}",
|
||||
"open_issues": 6,
|
||||
"open_issues_count": 6,
|
||||
"owner": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"events_url": "https://api.github.com/users/docker/events{/privacy}",
|
||||
"followers_url": "https://api.github.com/users/docker/followers",
|
||||
"following_url": "https://api.github.com/users/docker/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/docker/gists{/gist_id}",
|
||||
"gravatar_id": "",
|
||||
"html_url": "https://github.com/docker",
|
||||
"id": 5429470,
|
||||
"login": "docker",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"organizations_url": "https://api.github.com/users/docker/orgs",
|
||||
"received_events_url": "https://api.github.com/users/docker/received_events",
|
||||
"repos_url": "https://api.github.com/users/docker/repos",
|
||||
"site_admin": false,
|
||||
"starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/docker/subscriptions",
|
||||
"type": "Organization",
|
||||
"url": "https://api.github.com/users/docker"
|
||||
},
|
||||
"private": true,
|
||||
"pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}",
|
||||
"pushed_at": "2022-04-19T09:04:50Z",
|
||||
"releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}",
|
||||
"size": 796,
|
||||
"ssh_url": "git@github.com:docker/test-docker-action.git",
|
||||
"stargazers_count": 0,
|
||||
"stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers",
|
||||
"statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}",
|
||||
"subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription",
|
||||
"svn_url": "https://github.com/docker/test-docker-action",
|
||||
"tags_url": "https://api.github.com/repos/docker/test-docker-action/tags",
|
||||
"teams_url": "https://api.github.com/repos/docker/test-docker-action/teams",
|
||||
"topics": [],
|
||||
"trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}",
|
||||
"updated_at": "2022-04-19T09:05:09Z",
|
||||
"url": "https://api.github.com/repos/docker/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/orgs",
|
||||
"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"
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
GITHUB_ACTION=crazy-maxghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_89a016e8-e5b7-4039-a67e-c8da08f87a0c
|
||||
GITHUB_EVENT_NAME=push
|
||||
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=event
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_89a016e8-e5b7-4039-a67e-c8da08f87a0c
|
||||
GITHUB_REF=refs/heads/dev
|
||||
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ID=325957516
|
||||
GITHUB_RUN_NUMBER=1
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||
GITHUB_WORKFLOW=event
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
@ -1,23 +0,0 @@
|
||||
GITHUB_ACTION=crazy-maxghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_89a016e8-e5b7-4039-a67e-c8da08f87a0c
|
||||
GITHUB_EVENT_NAME=push
|
||||
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=event
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_89a016e8-e5b7-4039-a67e-c8da08f87a0c
|
||||
GITHUB_REF=refs/heads/master
|
||||
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ID=325957516
|
||||
GITHUB_RUN_NUMBER=1
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||
GITHUB_WORKFLOW=event
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
30
__tests__/fixtures/event_push_dev.env
Normal file
30
__tests__/fixtures/event_push_dev.env
Normal file
@ -0,0 +1,30 @@
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_dce158a5-37b3-4081-8414-32238d5cfa7b
|
||||
GITHUB_EVENT_NAME=push
|
||||
GITHUB_EVENT_PATH=./__tests__/fixtures/event_push_dev.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_dce158a5-37b3-4081-8414-32238d5cfa7b
|
||||
GITHUB_REF=refs/heads/dev
|
||||
GITHUB_REF_NAME=dev
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=branch
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188748038
|
||||
GITHUB_RUN_NUMBER=15
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=860c1904a1ce19322e91ac35af1ab07466440c37
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_dce158a5-37b3-4081-8414-32238d5cfa7b
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
195
__tests__/fixtures/event_push_dev.json
Normal file
195
__tests__/fixtures/event_push_dev.json
Normal file
@ -0,0 +1,195 @@
|
||||
{
|
||||
"after": "860c1904a1ce19322e91ac35af1ab07466440c37",
|
||||
"base_ref": null,
|
||||
"before": "5f3331d7f7044c18ca9f12c77d961c4d7cf3276a",
|
||||
"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": "860c1904a1ce19322e91ac35af1ab07466440c37",
|
||||
"message": "hello dev",
|
||||
"timestamp": "2022-04-19T11:27:24+02:00",
|
||||
"tree_id": "d2c60af597e863787d2d27f569e30495b0b92820",
|
||||
"url": "https://github.com/docker/test-docker-action/commit/860c1904a1ce19322e91ac35af1ab07466440c37"
|
||||
}
|
||||
],
|
||||
"compare": "https://github.com/docker/test-docker-action/compare/5f3331d7f704...860c1904a1ce",
|
||||
"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": "860c1904a1ce19322e91ac35af1ab07466440c37",
|
||||
"message": "hello dev",
|
||||
"timestamp": "2022-04-19T11:27:24+02:00",
|
||||
"tree_id": "d2c60af597e863787d2d27f569e30495b0b92820",
|
||||
"url": "https://github.com/docker/test-docker-action/commit/860c1904a1ce19322e91ac35af1ab07466440c37"
|
||||
},
|
||||
"organization": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"description": "Docker helps developers bring their ideas to life by conquering the complexity of app development.",
|
||||
"events_url": "https://api.github.com/orgs/docker/events",
|
||||
"hooks_url": "https://api.github.com/orgs/docker/hooks",
|
||||
"id": 5429470,
|
||||
"issues_url": "https://api.github.com/orgs/docker/issues",
|
||||
"login": "docker",
|
||||
"members_url": "https://api.github.com/orgs/docker/members{/member}",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"public_members_url": "https://api.github.com/orgs/docker/public_members{/member}",
|
||||
"repos_url": "https://api.github.com/orgs/docker/repos",
|
||||
"url": "https://api.github.com/orgs/docker"
|
||||
},
|
||||
"pusher": {
|
||||
"email": "github@crazymax.dev",
|
||||
"name": "crazy-max"
|
||||
},
|
||||
"ref": "refs/heads/dev",
|
||||
"repository": {
|
||||
"allow_forking": true,
|
||||
"archive_url": "https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}",
|
||||
"archived": false,
|
||||
"assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}",
|
||||
"blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}",
|
||||
"branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}",
|
||||
"clone_url": "https://github.com/docker/test-docker-action.git",
|
||||
"collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}",
|
||||
"comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}",
|
||||
"commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}",
|
||||
"compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}",
|
||||
"contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}",
|
||||
"contributors_url": "https://api.github.com/repos/docker/test-docker-action/contributors",
|
||||
"created_at": 1596792180,
|
||||
"default_branch": "master",
|
||||
"deployments_url": "https://api.github.com/repos/docker/test-docker-action/deployments",
|
||||
"description": "Test \"Docker\" Actions",
|
||||
"disabled": false,
|
||||
"downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads",
|
||||
"events_url": "https://api.github.com/repos/docker/test-docker-action/events",
|
||||
"fork": false,
|
||||
"forks": 1,
|
||||
"forks_count": 1,
|
||||
"forks_url": "https://api.github.com/repos/docker/test-docker-action/forks",
|
||||
"full_name": "docker/test-docker-action",
|
||||
"git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}",
|
||||
"git_url": "git://github.com/docker/test-docker-action.git",
|
||||
"has_downloads": true,
|
||||
"has_issues": true,
|
||||
"has_pages": false,
|
||||
"has_projects": true,
|
||||
"has_wiki": true,
|
||||
"homepage": "",
|
||||
"hooks_url": "https://api.github.com/repos/docker/test-docker-action/hooks",
|
||||
"html_url": "https://github.com/docker/test-docker-action",
|
||||
"id": 285789493,
|
||||
"is_template": false,
|
||||
"issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}",
|
||||
"issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}",
|
||||
"issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}",
|
||||
"keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}",
|
||||
"labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}",
|
||||
"language": "JavaScript",
|
||||
"languages_url": "https://api.github.com/repos/docker/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/docker/test-docker-action/merges",
|
||||
"milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}",
|
||||
"mirror_url": null,
|
||||
"name": "test-docker-action",
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||
"notifications_url": "https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}",
|
||||
"open_issues": 6,
|
||||
"open_issues_count": 6,
|
||||
"organization": "docker",
|
||||
"owner": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"email": "info@docker.com",
|
||||
"events_url": "https://api.github.com/users/docker/events{/privacy}",
|
||||
"followers_url": "https://api.github.com/users/docker/followers",
|
||||
"following_url": "https://api.github.com/users/docker/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/docker/gists{/gist_id}",
|
||||
"gravatar_id": "",
|
||||
"html_url": "https://github.com/docker",
|
||||
"id": 5429470,
|
||||
"login": "docker",
|
||||
"name": "docker",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"organizations_url": "https://api.github.com/users/docker/orgs",
|
||||
"received_events_url": "https://api.github.com/users/docker/received_events",
|
||||
"repos_url": "https://api.github.com/users/docker/repos",
|
||||
"site_admin": false,
|
||||
"starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/docker/subscriptions",
|
||||
"type": "Organization",
|
||||
"url": "https://api.github.com/users/docker"
|
||||
},
|
||||
"private": true,
|
||||
"pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}",
|
||||
"pushed_at": 1650360446,
|
||||
"releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}",
|
||||
"size": 796,
|
||||
"ssh_url": "git@github.com:docker/test-docker-action.git",
|
||||
"stargazers": 0,
|
||||
"stargazers_count": 0,
|
||||
"stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers",
|
||||
"statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}",
|
||||
"subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription",
|
||||
"svn_url": "https://github.com/docker/test-docker-action",
|
||||
"tags_url": "https://api.github.com/repos/docker/test-docker-action/tags",
|
||||
"teams_url": "https://api.github.com/repos/docker/test-docker-action/teams",
|
||||
"topics": [],
|
||||
"trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}",
|
||||
"updated_at": "2022-04-19T09:05:09Z",
|
||||
"url": "https://github.com/docker/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/orgs",
|
||||
"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"
|
||||
}
|
||||
}
|
@ -1,23 +1,30 @@
|
||||
GITHUB_ACTION=crazy-maxghaction-dump-context
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
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_5d7d8f7f-4b47-4f4c-b32a-e7fa634790c9
|
||||
GITHUB_EVENT_NAME=push
|
||||
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
|
||||
GITHUB_EVENT_PATH=./__tests__/fixtures/event_push_invalidchars.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=event
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_89a016e8-e5b7-4039-a67e-c8da08f87a0c
|
||||
GITHUB_REF="refs/heads/my/feature#1245"
|
||||
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_5d7d8f7f-4b47-4f4c-b32a-e7fa634790c9
|
||||
GITHUB_REF=refs/heads/my/feature#1245
|
||||
GITHUB_REF_NAME=my/feature#1245
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=branch
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ID=325957516
|
||||
GITHUB_RUN_NUMBER=1
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188792787
|
||||
GITHUB_RUN_NUMBER=19
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||
GITHUB_WORKFLOW=event
|
||||
GITHUB_SHA=983315b5e8d46e46fc4c49869e85e7ee5fb289ba
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_5d7d8f7f-4b47-4f4c-b32a-e7fa634790c9
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
||||
|
195
__tests__/fixtures/event_push_invalidchars.json
Normal file
195
__tests__/fixtures/event_push_invalidchars.json
Normal file
@ -0,0 +1,195 @@
|
||||
{
|
||||
"after": "983315b5e8d46e46fc4c49869e85e7ee5fb289ba",
|
||||
"base_ref": null,
|
||||
"before": "4af2cc040e1cee6ee91e2491f34e5787121eb902",
|
||||
"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": "983315b5e8d46e46fc4c49869e85e7ee5fb289ba",
|
||||
"message": "feature 1245",
|
||||
"timestamp": "2022-04-19T11:36:08+02:00",
|
||||
"tree_id": "e9f7b0bf689a49a4792d518088710dadb52d7e9a",
|
||||
"url": "https://github.com/docker/test-docker-action/commit/983315b5e8d46e46fc4c49869e85e7ee5fb289ba"
|
||||
}
|
||||
],
|
||||
"compare": "https://github.com/docker/test-docker-action/compare/4af2cc040e1c...983315b5e8d4",
|
||||
"created": false,
|
||||
"deleted": false,
|
||||
"forced": true,
|
||||
"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": "983315b5e8d46e46fc4c49869e85e7ee5fb289ba",
|
||||
"message": "feature 1245",
|
||||
"timestamp": "2022-04-19T11:36:08+02:00",
|
||||
"tree_id": "e9f7b0bf689a49a4792d518088710dadb52d7e9a",
|
||||
"url": "https://github.com/docker/test-docker-action/commit/983315b5e8d46e46fc4c49869e85e7ee5fb289ba"
|
||||
},
|
||||
"organization": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"description": "Docker helps developers bring their ideas to life by conquering the complexity of app development.",
|
||||
"events_url": "https://api.github.com/orgs/docker/events",
|
||||
"hooks_url": "https://api.github.com/orgs/docker/hooks",
|
||||
"id": 5429470,
|
||||
"issues_url": "https://api.github.com/orgs/docker/issues",
|
||||
"login": "docker",
|
||||
"members_url": "https://api.github.com/orgs/docker/members{/member}",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"public_members_url": "https://api.github.com/orgs/docker/public_members{/member}",
|
||||
"repos_url": "https://api.github.com/orgs/docker/repos",
|
||||
"url": "https://api.github.com/orgs/docker"
|
||||
},
|
||||
"pusher": {
|
||||
"email": "github@crazymax.dev",
|
||||
"name": "crazy-max"
|
||||
},
|
||||
"ref": "refs/heads/my/feature#1245",
|
||||
"repository": {
|
||||
"allow_forking": true,
|
||||
"archive_url": "https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}",
|
||||
"archived": false,
|
||||
"assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}",
|
||||
"blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}",
|
||||
"branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}",
|
||||
"clone_url": "https://github.com/docker/test-docker-action.git",
|
||||
"collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}",
|
||||
"comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}",
|
||||
"commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}",
|
||||
"compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}",
|
||||
"contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}",
|
||||
"contributors_url": "https://api.github.com/repos/docker/test-docker-action/contributors",
|
||||
"created_at": 1596792180,
|
||||
"default_branch": "master",
|
||||
"deployments_url": "https://api.github.com/repos/docker/test-docker-action/deployments",
|
||||
"description": "Test \"Docker\" Actions",
|
||||
"disabled": false,
|
||||
"downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads",
|
||||
"events_url": "https://api.github.com/repos/docker/test-docker-action/events",
|
||||
"fork": false,
|
||||
"forks": 1,
|
||||
"forks_count": 1,
|
||||
"forks_url": "https://api.github.com/repos/docker/test-docker-action/forks",
|
||||
"full_name": "docker/test-docker-action",
|
||||
"git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}",
|
||||
"git_url": "git://github.com/docker/test-docker-action.git",
|
||||
"has_downloads": true,
|
||||
"has_issues": true,
|
||||
"has_pages": false,
|
||||
"has_projects": true,
|
||||
"has_wiki": true,
|
||||
"homepage": "",
|
||||
"hooks_url": "https://api.github.com/repos/docker/test-docker-action/hooks",
|
||||
"html_url": "https://github.com/docker/test-docker-action",
|
||||
"id": 285789493,
|
||||
"is_template": false,
|
||||
"issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}",
|
||||
"issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}",
|
||||
"issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}",
|
||||
"keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}",
|
||||
"labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}",
|
||||
"language": "JavaScript",
|
||||
"languages_url": "https://api.github.com/repos/docker/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/docker/test-docker-action/merges",
|
||||
"milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}",
|
||||
"mirror_url": null,
|
||||
"name": "test-docker-action",
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||
"notifications_url": "https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}",
|
||||
"open_issues": 6,
|
||||
"open_issues_count": 6,
|
||||
"organization": "docker",
|
||||
"owner": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"email": "info@docker.com",
|
||||
"events_url": "https://api.github.com/users/docker/events{/privacy}",
|
||||
"followers_url": "https://api.github.com/users/docker/followers",
|
||||
"following_url": "https://api.github.com/users/docker/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/docker/gists{/gist_id}",
|
||||
"gravatar_id": "",
|
||||
"html_url": "https://github.com/docker",
|
||||
"id": 5429470,
|
||||
"login": "docker",
|
||||
"name": "docker",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"organizations_url": "https://api.github.com/users/docker/orgs",
|
||||
"received_events_url": "https://api.github.com/users/docker/received_events",
|
||||
"repos_url": "https://api.github.com/users/docker/repos",
|
||||
"site_admin": false,
|
||||
"starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/docker/subscriptions",
|
||||
"type": "Organization",
|
||||
"url": "https://api.github.com/users/docker"
|
||||
},
|
||||
"private": true,
|
||||
"pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}",
|
||||
"pushed_at": 1650360972,
|
||||
"releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}",
|
||||
"size": 796,
|
||||
"ssh_url": "git@github.com:docker/test-docker-action.git",
|
||||
"stargazers": 0,
|
||||
"stargazers_count": 0,
|
||||
"stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers",
|
||||
"statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}",
|
||||
"subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription",
|
||||
"svn_url": "https://github.com/docker/test-docker-action",
|
||||
"tags_url": "https://api.github.com/repos/docker/test-docker-action/tags",
|
||||
"teams_url": "https://api.github.com/repos/docker/test-docker-action/teams",
|
||||
"topics": [],
|
||||
"trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}",
|
||||
"updated_at": "2022-04-19T09:05:09Z",
|
||||
"url": "https://github.com/docker/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/orgs",
|
||||
"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"
|
||||
}
|
||||
}
|
30
__tests__/fixtures/event_push_master.env
Normal file
30
__tests__/fixtures/event_push_master.env
Normal file
@ -0,0 +1,30 @@
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_f5600b76-1b08-404a-8e90-7f2cd620928b
|
||||
GITHUB_EVENT_NAME=push
|
||||
GITHUB_EVENT_PATH=./__tests__/fixtures/event_push_master.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_f5600b76-1b08-404a-8e90-7f2cd620928b
|
||||
GITHUB_REF=refs/heads/master
|
||||
GITHUB_REF_NAME=master
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=branch
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188627423
|
||||
GITHUB_RUN_NUMBER=6
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=266574110acf203503badf966df2ea24b5d732d7
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_f5600b76-1b08-404a-8e90-7f2cd620928b
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
195
__tests__/fixtures/event_push_master.json
Normal file
195
__tests__/fixtures/event_push_master.json
Normal file
@ -0,0 +1,195 @@
|
||||
{
|
||||
"after": "266574110acf203503badf966df2ea24b5d732d7",
|
||||
"base_ref": null,
|
||||
"before": "ef1a8e2e6a91ffa6837f19f7743405b709363225",
|
||||
"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": "266574110acf203503badf966df2ea24b5d732d7",
|
||||
"message": "more events",
|
||||
"timestamp": "2022-04-19T11:04:39+02:00",
|
||||
"tree_id": "03b667a843ece33c75ef5eb23ca5bc8fc3b876e4",
|
||||
"url": "https://github.com/docker/test-docker-action/commit/266574110acf203503badf966df2ea24b5d732d7"
|
||||
}
|
||||
],
|
||||
"compare": "https://github.com/docker/test-docker-action/compare/ef1a8e2e6a91...266574110acf",
|
||||
"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": "266574110acf203503badf966df2ea24b5d732d7",
|
||||
"message": "more events",
|
||||
"timestamp": "2022-04-19T11:04:39+02:00",
|
||||
"tree_id": "03b667a843ece33c75ef5eb23ca5bc8fc3b876e4",
|
||||
"url": "https://github.com/docker/test-docker-action/commit/266574110acf203503badf966df2ea24b5d732d7"
|
||||
},
|
||||
"organization": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"description": "Docker helps developers bring their ideas to life by conquering the complexity of app development.",
|
||||
"events_url": "https://api.github.com/orgs/docker/events",
|
||||
"hooks_url": "https://api.github.com/orgs/docker/hooks",
|
||||
"id": 5429470,
|
||||
"issues_url": "https://api.github.com/orgs/docker/issues",
|
||||
"login": "docker",
|
||||
"members_url": "https://api.github.com/orgs/docker/members{/member}",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"public_members_url": "https://api.github.com/orgs/docker/public_members{/member}",
|
||||
"repos_url": "https://api.github.com/orgs/docker/repos",
|
||||
"url": "https://api.github.com/orgs/docker"
|
||||
},
|
||||
"pusher": {
|
||||
"email": "github@crazymax.dev",
|
||||
"name": "crazy-max"
|
||||
},
|
||||
"ref": "refs/heads/master",
|
||||
"repository": {
|
||||
"allow_forking": true,
|
||||
"archive_url": "https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}",
|
||||
"archived": false,
|
||||
"assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}",
|
||||
"blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}",
|
||||
"branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}",
|
||||
"clone_url": "https://github.com/docker/test-docker-action.git",
|
||||
"collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}",
|
||||
"comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}",
|
||||
"commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}",
|
||||
"compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}",
|
||||
"contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}",
|
||||
"contributors_url": "https://api.github.com/repos/docker/test-docker-action/contributors",
|
||||
"created_at": 1596792180,
|
||||
"default_branch": "master",
|
||||
"deployments_url": "https://api.github.com/repos/docker/test-docker-action/deployments",
|
||||
"description": "Test \"Docker\" Actions",
|
||||
"disabled": false,
|
||||
"downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads",
|
||||
"events_url": "https://api.github.com/repos/docker/test-docker-action/events",
|
||||
"fork": false,
|
||||
"forks": 1,
|
||||
"forks_count": 1,
|
||||
"forks_url": "https://api.github.com/repos/docker/test-docker-action/forks",
|
||||
"full_name": "docker/test-docker-action",
|
||||
"git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}",
|
||||
"git_url": "git://github.com/docker/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/docker/test-docker-action/hooks",
|
||||
"html_url": "https://github.com/docker/test-docker-action",
|
||||
"id": 285789493,
|
||||
"is_template": false,
|
||||
"issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}",
|
||||
"issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}",
|
||||
"issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}",
|
||||
"keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}",
|
||||
"labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}",
|
||||
"language": "JavaScript",
|
||||
"languages_url": "https://api.github.com/repos/docker/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/docker/test-docker-action/merges",
|
||||
"milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}",
|
||||
"mirror_url": null,
|
||||
"name": "test-docker-action",
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||
"notifications_url": "https://api.github.com/repos/docker/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/docker/events{/privacy}",
|
||||
"followers_url": "https://api.github.com/users/docker/followers",
|
||||
"following_url": "https://api.github.com/users/docker/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/docker/gists{/gist_id}",
|
||||
"gravatar_id": "",
|
||||
"html_url": "https://github.com/docker",
|
||||
"id": 5429470,
|
||||
"login": "docker",
|
||||
"name": "docker",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"organizations_url": "https://api.github.com/users/docker/orgs",
|
||||
"received_events_url": "https://api.github.com/users/docker/received_events",
|
||||
"repos_url": "https://api.github.com/users/docker/repos",
|
||||
"site_admin": false,
|
||||
"starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/docker/subscriptions",
|
||||
"type": "Organization",
|
||||
"url": "https://api.github.com/users/docker"
|
||||
},
|
||||
"private": true,
|
||||
"pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}",
|
||||
"pushed_at": 1650359090,
|
||||
"releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}",
|
||||
"size": 796,
|
||||
"ssh_url": "git@github.com:docker/test-docker-action.git",
|
||||
"stargazers": 0,
|
||||
"stargazers_count": 0,
|
||||
"stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers",
|
||||
"statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}",
|
||||
"subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription",
|
||||
"svn_url": "https://github.com/docker/test-docker-action",
|
||||
"tags_url": "https://api.github.com/repos/docker/test-docker-action/tags",
|
||||
"teams_url": "https://api.github.com/repos/docker/test-docker-action/teams",
|
||||
"topics": [],
|
||||
"trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}",
|
||||
"updated_at": "2021-12-21T21:49:29Z",
|
||||
"url": "https://github.com/docker/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/orgs",
|
||||
"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"
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
GITHUB_ACTION=crazy-maxghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_7c207886-8ce7-4ad2-9b7f-f59dae4e5cf3
|
||||
GITHUB_EVENT_NAME=release
|
||||
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=event
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_7c207886-8ce7-4ad2-9b7f-f59dae4e5cf3
|
||||
GITHUB_REF=refs/tags/v1.1.1
|
||||
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ID=325970352
|
||||
GITHUB_RUN_NUMBER=5
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||
GITHUB_WORKFLOW=event
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
30
__tests__/fixtures/event_release_created.env
Normal file
30
__tests__/fixtures/event_release_created.env
Normal file
@ -0,0 +1,30 @@
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_82c844c7-54b3-4b5d-a1e1-4f9f2e936d4f
|
||||
GITHUB_EVENT_NAME=release
|
||||
GITHUB_EVENT_PATH=./__tests__/fixtures/event_release_created.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_82c844c7-54b3-4b5d-a1e1-4f9f2e936d4f
|
||||
GITHUB_REF=refs/tags/v1.1.1
|
||||
GITHUB_REF_NAME=v1.1.1
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=tag
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188867972
|
||||
GITHUB_RUN_NUMBER=26
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=860c1904a1ce19322e91ac35af1ab07466440c37
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_82c844c7-54b3-4b5d-a1e1-4f9f2e936d4f
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
80
__tests__/fixtures/event_release_created.json
Normal file
80
__tests__/fixtures/event_release_created.json
Normal file
@ -0,0 +1,80 @@
|
||||
{
|
||||
"action": "created",
|
||||
"organization": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"description": "Docker helps developers bring their ideas to life by conquering the complexity of app development.",
|
||||
"events_url": "https://api.github.com/orgs/docker/events",
|
||||
"hooks_url": "https://api.github.com/orgs/docker/hooks",
|
||||
"id": 5429470,
|
||||
"issues_url": "https://api.github.com/orgs/docker/issues",
|
||||
"login": "docker",
|
||||
"members_url": "https://api.github.com/orgs/docker/members{/member}",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"public_members_url": "https://api.github.com/orgs/docker/public_members{/member}",
|
||||
"repos_url": "https://api.github.com/orgs/docker/repos",
|
||||
"url": "https://api.github.com/orgs/docker"
|
||||
},
|
||||
"release": {
|
||||
"assets": [],
|
||||
"assets_url": "https://api.github.com/repos/docker/test-docker-action/releases/64718198/assets",
|
||||
"author": {
|
||||
"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/orgs",
|
||||
"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"
|
||||
},
|
||||
"body": "foo",
|
||||
"created_at": "2022-04-19T09:39:35Z",
|
||||
"draft": false,
|
||||
"html_url": "https://github.com/docker/test-docker-action/releases/tag/v1.1.1",
|
||||
"id": 64718198,
|
||||
"name": "v1.1.1",
|
||||
"node_id": "RE_kwDOEQjNNc4D24V2",
|
||||
"prerelease": true,
|
||||
"subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription",
|
||||
"svn_url": "https://github.com/docker/test-docker-action",
|
||||
"tags_url": "https://api.github.com/repos/docker/test-docker-action/tags",
|
||||
"teams_url": "https://api.github.com/repos/docker/test-docker-action/teams",
|
||||
"topics": [],
|
||||
"trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}",
|
||||
"updated_at": "2022-04-19T09:05:09Z",
|
||||
"url": "https://api.github.com/repos/docker/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/orgs",
|
||||
"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"
|
||||
}
|
||||
}
|
@ -1,23 +1,30 @@
|
||||
GITHUB_ACTION=crazy-maxghaction-dump-context
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_5705dc72-e111-46f1-9421-a77a2daec643
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_c8594ff3-bed7-4fb7-b495-c63872db99a2
|
||||
GITHUB_EVENT_NAME=schedule
|
||||
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
|
||||
GITHUB_EVENT_PATH=./__tests__/fixtures/event_schedule.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=event
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_5705dc72-e111-46f1-9421-a77a2daec643
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_c8594ff3-bed7-4fb7-b495-c63872db99a2
|
||||
GITHUB_REF=refs/heads/master
|
||||
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||
GITHUB_REF_NAME=master
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=branch
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ID=325965155
|
||||
GITHUB_RUN_NUMBER=3
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188841209
|
||||
GITHUB_RUN_NUMBER=24
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||
GITHUB_WORKFLOW=event
|
||||
GITHUB_SHA=860c1904a1ce19322e91ac35af1ab07466440c37
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_c8594ff3-bed7-4fb7-b495-c63872db99a2
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
||||
|
3
__tests__/fixtures/event_schedule.json
Normal file
3
__tests__/fixtures/event_schedule.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"schedule": "*/10 * * * *"
|
||||
}
|
30
__tests__/fixtures/event_tag_1.0dev4.env
Normal file
30
__tests__/fixtures/event_tag_1.0dev4.env
Normal file
@ -0,0 +1,30 @@
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_EVENT_NAME=push
|
||||
#GITHUB_EVENT_PATH=./__tests__/fixtures/event_tag_1.0dev4.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_REF=refs/tags/1.0dev4
|
||||
GITHUB_REF_NAME=1.0dev4
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=tag
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188815933
|
||||
GITHUB_RUN_NUMBER=21
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=860c1904a1ce19322e91ac35af1ab07466440c37
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
30
__tests__/fixtures/event_tag_1.1beta2.env
Normal file
30
__tests__/fixtures/event_tag_1.1beta2.env
Normal file
@ -0,0 +1,30 @@
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_EVENT_NAME=push
|
||||
#GITHUB_EVENT_PATH=./__tests__/fixtures/event_tag_1.1beta2.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_REF=refs/tags/1.1beta2
|
||||
GITHUB_REF_NAME=1.1beta2
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=tag
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188815933
|
||||
GITHUB_RUN_NUMBER=21
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=860c1904a1ce19322e91ac35af1ab07466440c37
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
30
__tests__/fixtures/event_tag_1.2.3rc2.env
Normal file
30
__tests__/fixtures/event_tag_1.2.3rc2.env
Normal file
@ -0,0 +1,30 @@
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_EVENT_NAME=push
|
||||
#GITHUB_EVENT_PATH=./__tests__/fixtures/event_tag_1.2.3rc2.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_REF=refs/tags/1.2.3rc2
|
||||
GITHUB_REF_NAME=1.2.3rc2
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=tag
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188815933
|
||||
GITHUB_RUN_NUMBER=21
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=860c1904a1ce19322e91ac35af1ab07466440c37
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
30
__tests__/fixtures/event_tag_1.2.env
Normal file
30
__tests__/fixtures/event_tag_1.2.env
Normal file
@ -0,0 +1,30 @@
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_EVENT_NAME=push
|
||||
#GITHUB_EVENT_PATH=./__tests__/fixtures/event_tag_1.2.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_REF=refs/tags/1.2
|
||||
GITHUB_REF_NAME=1.2
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=tag
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188815933
|
||||
GITHUB_RUN_NUMBER=21
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=860c1904a1ce19322e91ac35af1ab07466440c37
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
30
__tests__/fixtures/event_tag_1.2post1.env
Normal file
30
__tests__/fixtures/event_tag_1.2post1.env
Normal file
@ -0,0 +1,30 @@
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_EVENT_NAME=push
|
||||
#GITHUB_EVENT_PATH=./__tests__/fixtures/event_tag_1.2post1.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_REF=refs/tags/1.2post1
|
||||
GITHUB_REF_NAME=1.2post1
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=tag
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188815933
|
||||
GITHUB_RUN_NUMBER=21
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=860c1904a1ce19322e91ac35af1ab07466440c37
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
@ -1,23 +1,30 @@
|
||||
GITHUB_ACTION=crazy-maxghaction-dump-context
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
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_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_EVENT_NAME=push
|
||||
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
|
||||
#GITHUB_EVENT_PATH=./__tests__/fixtures/event_tag_20200110-RC2.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=event
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_6ee180c2-b331-434a-a867-89534cbefd83
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_REF=refs/tags/20200110-RC2
|
||||
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||
GITHUB_REF_NAME=20200110-RC2
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=tag
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ID=325968230
|
||||
GITHUB_RUN_NUMBER=4
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188815933
|
||||
GITHUB_RUN_NUMBER=21
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||
GITHUB_WORKFLOW=event
|
||||
GITHUB_SHA=860c1904a1ce19322e91ac35af1ab07466440c37
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
||||
|
30
__tests__/fixtures/event_tag_p1-v1.0.0.env
Normal file
30
__tests__/fixtures/event_tag_p1-v1.0.0.env
Normal file
@ -0,0 +1,30 @@
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_EVENT_NAME=push
|
||||
#GITHUB_EVENT_PATH=./__tests__/fixtures/event_tag_p1-v1.0.0.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_REF=refs/tags/p1/v1.0.0
|
||||
GITHUB_REF_NAME=p1/v1.0.0
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=tag
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188815933
|
||||
GITHUB_RUN_NUMBER=21
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=860c1904a1ce19322e91ac35af1ab07466440c37
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
@ -1,23 +1,30 @@
|
||||
GITHUB_ACTION=crazy-maxghaction-dump-context
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
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_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_EVENT_NAME=push
|
||||
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
|
||||
#GITHUB_EVENT_PATH=./__tests__/fixtures/event_tag_release1.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=event
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_6ee180c2-b331-434a-a867-89534cbefd83
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_REF=refs/tags/release1
|
||||
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||
GITHUB_REF_NAME=release1
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=tag
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ID=325968230
|
||||
GITHUB_RUN_NUMBER=4
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188815933
|
||||
GITHUB_RUN_NUMBER=21
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||
GITHUB_WORKFLOW=event
|
||||
GITHUB_SHA=860c1904a1ce19322e91ac35af1ab07466440c37
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
||||
|
@ -1,23 +1,30 @@
|
||||
GITHUB_ACTION=crazy-maxghaction-dump-context
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
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_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_EVENT_NAME=push
|
||||
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
|
||||
#GITHUB_EVENT_PATH=./__tests__/fixtures/event_tag_sometag.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=event
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_6ee180c2-b331-434a-a867-89534cbefd83
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_REF=refs/tags/sometag
|
||||
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||
GITHUB_REF_NAME=sometag
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=tag
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ID=325968230
|
||||
GITHUB_RUN_NUMBER=4
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188815933
|
||||
GITHUB_RUN_NUMBER=21
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||
GITHUB_WORKFLOW=event
|
||||
GITHUB_SHA=860c1904a1ce19322e91ac35af1ab07466440c37
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
||||
|
@ -1,23 +1,30 @@
|
||||
GITHUB_ACTION=crazy-maxghaction-dump-context
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
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_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
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_HEAD_REF=
|
||||
GITHUB_JOB=event
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_6ee180c2-b331-434a-a867-89534cbefd83
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_REF=refs/tags/v1.1.1
|
||||
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||
GITHUB_REF_NAME=v1.1.1
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=tag
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ID=325968230
|
||||
GITHUB_RUN_NUMBER=4
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188815933
|
||||
GITHUB_RUN_NUMBER=21
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||
GITHUB_WORKFLOW=event
|
||||
GITHUB_SHA=860c1904a1ce19322e91ac35af1ab07466440c37
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
||||
|
176
__tests__/fixtures/event_tag_v1.1.1.json
Normal file
176
__tests__/fixtures/event_tag_v1.1.1.json
Normal file
@ -0,0 +1,176 @@
|
||||
{
|
||||
"after": "860c1904a1ce19322e91ac35af1ab07466440c37",
|
||||
"base_ref": "refs/heads/master",
|
||||
"before": "0000000000000000000000000000000000000000",
|
||||
"commits": [],
|
||||
"compare": "https://github.com/docker/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": "crazy-max@users.noreply.github.com",
|
||||
"name": "CrazyMax",
|
||||
"username": "crazy-max"
|
||||
},
|
||||
"distinct": true,
|
||||
"id": "860c1904a1ce19322e91ac35af1ab07466440c37",
|
||||
"message": "scheduled",
|
||||
"timestamp": "2022-04-19T11:39:35+02:00",
|
||||
"tree_id": "1d3608c3f204a4d754a1db925264929afd54daad",
|
||||
"url": "https://github.com/docker/test-docker-action/commit/860c1904a1ce19322e91ac35af1ab07466440c37"
|
||||
},
|
||||
"organization": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"description": "Docker helps developers bring their ideas to life by conquering the complexity of app development.",
|
||||
"events_url": "https://api.github.com/orgs/docker/events",
|
||||
"hooks_url": "https://api.github.com/orgs/docker/hooks",
|
||||
"id": 5429470,
|
||||
"issues_url": "https://api.github.com/orgs/docker/issues",
|
||||
"login": "docker",
|
||||
"members_url": "https://api.github.com/orgs/docker/members{/member}",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"public_members_url": "https://api.github.com/orgs/docker/public_members{/member}",
|
||||
"repos_url": "https://api.github.com/orgs/docker/repos",
|
||||
"url": "https://api.github.com/orgs/docker"
|
||||
},
|
||||
"pusher": {
|
||||
"email": "github@crazymax.dev",
|
||||
"name": "crazy-max"
|
||||
},
|
||||
"ref": "refs/tags/v1.1.1",
|
||||
"repository": {
|
||||
"allow_forking": true,
|
||||
"archive_url": "https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}",
|
||||
"archived": false,
|
||||
"assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}",
|
||||
"blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}",
|
||||
"branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}",
|
||||
"clone_url": "https://github.com/docker/test-docker-action.git",
|
||||
"collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}",
|
||||
"comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}",
|
||||
"commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}",
|
||||
"compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}",
|
||||
"contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}",
|
||||
"contributors_url": "https://api.github.com/repos/docker/test-docker-action/contributors",
|
||||
"created_at": 1596792180,
|
||||
"default_branch": "master",
|
||||
"deployments_url": "https://api.github.com/repos/docker/test-docker-action/deployments",
|
||||
"description": "Test \"Docker\" Actions",
|
||||
"disabled": false,
|
||||
"downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads",
|
||||
"events_url": "https://api.github.com/repos/docker/test-docker-action/events",
|
||||
"fork": false,
|
||||
"forks": 1,
|
||||
"forks_count": 1,
|
||||
"forks_url": "https://api.github.com/repos/docker/test-docker-action/forks",
|
||||
"full_name": "docker/test-docker-action",
|
||||
"git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}",
|
||||
"git_url": "git://github.com/docker/test-docker-action.git",
|
||||
"has_downloads": true,
|
||||
"has_issues": true,
|
||||
"has_pages": false,
|
||||
"has_projects": true,
|
||||
"has_wiki": true,
|
||||
"homepage": "",
|
||||
"hooks_url": "https://api.github.com/repos/docker/test-docker-action/hooks",
|
||||
"html_url": "https://github.com/docker/test-docker-action",
|
||||
"id": 285789493,
|
||||
"is_template": false,
|
||||
"issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}",
|
||||
"issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}",
|
||||
"issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}",
|
||||
"keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}",
|
||||
"labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}",
|
||||
"language": "JavaScript",
|
||||
"languages_url": "https://api.github.com/repos/docker/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/docker/test-docker-action/merges",
|
||||
"milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}",
|
||||
"mirror_url": null,
|
||||
"name": "test-docker-action",
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||
"notifications_url": "https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}",
|
||||
"open_issues": 6,
|
||||
"open_issues_count": 6,
|
||||
"organization": "docker",
|
||||
"owner": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"email": "info@docker.com",
|
||||
"events_url": "https://api.github.com/users/docker/events{/privacy}",
|
||||
"followers_url": "https://api.github.com/users/docker/followers",
|
||||
"following_url": "https://api.github.com/users/docker/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/docker/gists{/gist_id}",
|
||||
"gravatar_id": "",
|
||||
"html_url": "https://github.com/docker",
|
||||
"id": 5429470,
|
||||
"login": "docker",
|
||||
"name": "docker",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"organizations_url": "https://api.github.com/users/docker/orgs",
|
||||
"received_events_url": "https://api.github.com/users/docker/received_events",
|
||||
"repos_url": "https://api.github.com/users/docker/repos",
|
||||
"site_admin": false,
|
||||
"starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/docker/subscriptions",
|
||||
"type": "Organization",
|
||||
"url": "https://api.github.com/users/docker"
|
||||
},
|
||||
"private": true,
|
||||
"pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}",
|
||||
"pushed_at": 1650361263,
|
||||
"releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}",
|
||||
"size": 796,
|
||||
"ssh_url": "git@github.com:docker/test-docker-action.git",
|
||||
"stargazers": 0,
|
||||
"stargazers_count": 0,
|
||||
"stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers",
|
||||
"statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}",
|
||||
"subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription",
|
||||
"svn_url": "https://github.com/docker/test-docker-action",
|
||||
"tags_url": "https://api.github.com/repos/docker/test-docker-action/tags",
|
||||
"teams_url": "https://api.github.com/repos/docker/test-docker-action/teams",
|
||||
"topics": [],
|
||||
"trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}",
|
||||
"updated_at": "2022-04-19T09:05:09Z",
|
||||
"url": "https://github.com/docker/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/orgs",
|
||||
"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"
|
||||
}
|
||||
}
|
30
__tests__/fixtures/event_tag_v1.2.3rc2.env
Normal file
30
__tests__/fixtures/event_tag_v1.2.3rc2.env
Normal file
@ -0,0 +1,30 @@
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_EVENT_NAME=push
|
||||
#GITHUB_EVENT_PATH=./__tests__/fixtures/event_tag_v1.2.3rc2.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_REF=refs/tags/v1.2.3rc2
|
||||
GITHUB_REF_NAME=v1.2.3rc2
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=tag
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188815933
|
||||
GITHUB_RUN_NUMBER=21
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=860c1904a1ce19322e91ac35af1ab07466440c37
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
@ -1,23 +1,30 @@
|
||||
GITHUB_ACTION=crazy-maxghaction-dump-context
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
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_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_EVENT_NAME=push
|
||||
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
|
||||
#GITHUB_EVENT_PATH=./__tests__/fixtures/event_tag_v2.0.8-beta.67.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=event
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_6ee180c2-b331-434a-a867-89534cbefd83
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_REF=refs/tags/v2.0.8-beta.67
|
||||
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||
GITHUB_REF_NAME=v2.0.8-beta.67
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=tag
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ID=325968230
|
||||
GITHUB_RUN_NUMBER=4
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188815933
|
||||
GITHUB_RUN_NUMBER=21
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||
GITHUB_WORKFLOW=event
|
||||
GITHUB_SHA=860c1904a1ce19322e91ac35af1ab07466440c37
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_7703d3cb-84db-438f-9f97-46e159388a55
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
||||
|
@ -1,23 +1,30 @@
|
||||
GITHUB_ACTION=crazy-maxghaction-dump-context
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_4c49cda0-764d-4055-9bd9-7caf67fcb10c
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_397d8f76-d5a2-478b-94ec-cadbffd1c08e
|
||||
GITHUB_EVENT_NAME=workflow_dispatch
|
||||
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
|
||||
GITHUB_EVENT_PATH=./__tests__/fixtures/event_workflow_dispatch.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=event
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_4c49cda0-764d-4055-9bd9-7caf67fcb10c
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_397d8f76-d5a2-478b-94ec-cadbffd1c08e
|
||||
GITHUB_REF=refs/heads/master
|
||||
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||
GITHUB_REF_NAME=master
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=branch
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ID=325962325
|
||||
GITHUB_RUN_NUMBER=2
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188839914
|
||||
GITHUB_RUN_NUMBER=23
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||
GITHUB_WORKFLOW=event
|
||||
GITHUB_SHA=860c1904a1ce19322e91ac35af1ab07466440c37
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_397d8f76-d5a2-478b-94ec-cadbffd1c08e
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
||||
|
145
__tests__/fixtures/event_workflow_dispatch.json
Normal file
145
__tests__/fixtures/event_workflow_dispatch.json
Normal file
@ -0,0 +1,145 @@
|
||||
{
|
||||
"inputs": {
|
||||
"logLevel": "warning"
|
||||
},
|
||||
"organization": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"description": "Docker helps developers bring their ideas to life by conquering the complexity of app development.",
|
||||
"events_url": "https://api.github.com/orgs/docker/events",
|
||||
"hooks_url": "https://api.github.com/orgs/docker/hooks",
|
||||
"id": 5429470,
|
||||
"issues_url": "https://api.github.com/orgs/docker/issues",
|
||||
"login": "docker",
|
||||
"members_url": "https://api.github.com/orgs/docker/members{/member}",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"public_members_url": "https://api.github.com/orgs/docker/public_members{/member}",
|
||||
"repos_url": "https://api.github.com/orgs/docker/repos",
|
||||
"url": "https://api.github.com/orgs/docker"
|
||||
},
|
||||
"ref": "refs/heads/master",
|
||||
"repository": {
|
||||
"allow_forking": true,
|
||||
"archive_url": "https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}",
|
||||
"archived": false,
|
||||
"assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}",
|
||||
"blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}",
|
||||
"branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}",
|
||||
"clone_url": "https://github.com/docker/test-docker-action.git",
|
||||
"collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}",
|
||||
"comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}",
|
||||
"commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}",
|
||||
"compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}",
|
||||
"contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}",
|
||||
"contributors_url": "https://api.github.com/repos/docker/test-docker-action/contributors",
|
||||
"created_at": "2020-08-07T09:23:00Z",
|
||||
"default_branch": "master",
|
||||
"deployments_url": "https://api.github.com/repos/docker/test-docker-action/deployments",
|
||||
"description": "Test \"Docker\" Actions",
|
||||
"disabled": false,
|
||||
"downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads",
|
||||
"events_url": "https://api.github.com/repos/docker/test-docker-action/events",
|
||||
"fork": false,
|
||||
"forks": 1,
|
||||
"forks_count": 1,
|
||||
"forks_url": "https://api.github.com/repos/docker/test-docker-action/forks",
|
||||
"full_name": "docker/test-docker-action",
|
||||
"git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}",
|
||||
"git_url": "git://github.com/docker/test-docker-action.git",
|
||||
"has_downloads": true,
|
||||
"has_issues": true,
|
||||
"has_pages": false,
|
||||
"has_projects": true,
|
||||
"has_wiki": true,
|
||||
"homepage": "",
|
||||
"hooks_url": "https://api.github.com/repos/docker/test-docker-action/hooks",
|
||||
"html_url": "https://github.com/docker/test-docker-action",
|
||||
"id": 285789493,
|
||||
"is_template": false,
|
||||
"issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}",
|
||||
"issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}",
|
||||
"issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}",
|
||||
"keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}",
|
||||
"labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}",
|
||||
"language": "JavaScript",
|
||||
"languages_url": "https://api.github.com/repos/docker/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/docker/test-docker-action/merges",
|
||||
"milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}",
|
||||
"mirror_url": null,
|
||||
"name": "test-docker-action",
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||
"notifications_url": "https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}",
|
||||
"open_issues": 6,
|
||||
"open_issues_count": 6,
|
||||
"owner": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"events_url": "https://api.github.com/users/docker/events{/privacy}",
|
||||
"followers_url": "https://api.github.com/users/docker/followers",
|
||||
"following_url": "https://api.github.com/users/docker/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/docker/gists{/gist_id}",
|
||||
"gravatar_id": "",
|
||||
"html_url": "https://github.com/docker",
|
||||
"id": 5429470,
|
||||
"login": "docker",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"organizations_url": "https://api.github.com/users/docker/orgs",
|
||||
"received_events_url": "https://api.github.com/users/docker/received_events",
|
||||
"repos_url": "https://api.github.com/users/docker/repos",
|
||||
"site_admin": false,
|
||||
"starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/docker/subscriptions",
|
||||
"type": "Organization",
|
||||
"url": "https://api.github.com/users/docker"
|
||||
},
|
||||
"private": true,
|
||||
"pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}",
|
||||
"pushed_at": "2022-04-19T09:41:03Z",
|
||||
"releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}",
|
||||
"size": 796,
|
||||
"ssh_url": "git@github.com:docker/test-docker-action.git",
|
||||
"stargazers_count": 0,
|
||||
"stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers",
|
||||
"statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}",
|
||||
"subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription",
|
||||
"svn_url": "https://github.com/docker/test-docker-action",
|
||||
"tags_url": "https://api.github.com/repos/docker/test-docker-action/tags",
|
||||
"teams_url": "https://api.github.com/repos/docker/test-docker-action/teams",
|
||||
"topics": [],
|
||||
"trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}",
|
||||
"updated_at": "2022-04-19T09:05:09Z",
|
||||
"url": "https://api.github.com/repos/docker/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/orgs",
|
||||
"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"
|
||||
},
|
||||
"workflow": ".github/workflows/metadata.yml"
|
||||
}
|
30
__tests__/fixtures/event_workflow_dispatch_dev.env
Normal file
30
__tests__/fixtures/event_workflow_dispatch_dev.env
Normal file
@ -0,0 +1,30 @@
|
||||
GITHUB_ACTION=__crazy-max_ghaction-dump-context
|
||||
GITHUB_ACTIONS=true
|
||||
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
|
||||
GITHUB_ACTION_REF=
|
||||
GITHUB_ACTION_REPOSITORY=
|
||||
GITHUB_ACTOR=crazy-max
|
||||
GITHUB_API_URL=https://api.github.com
|
||||
GITHUB_BASE_REF=
|
||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_81f7da89-3d0b-493a-af1f-c67e5f779727
|
||||
GITHUB_EVENT_NAME=workflow_dispatch
|
||||
GITHUB_EVENT_PATH=./__tests__/fixtures/event_workflow_dispatch_dev.json
|
||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||
GITHUB_HEAD_REF=
|
||||
GITHUB_JOB=test
|
||||
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_81f7da89-3d0b-493a-af1f-c67e5f779727
|
||||
GITHUB_REF=refs/heads/dev
|
||||
GITHUB_REF_NAME=dev
|
||||
GITHUB_REF_PROTECTED=false
|
||||
GITHUB_REF_TYPE=branch
|
||||
GITHUB_REPOSITORY=docker/test-docker-action
|
||||
GITHUB_REPOSITORY_OWNER=docker
|
||||
GITHUB_RETENTION_DAYS=90
|
||||
GITHUB_RUN_ATTEMPT=1
|
||||
GITHUB_RUN_ID=2188848679
|
||||
GITHUB_RUN_NUMBER=25
|
||||
GITHUB_SERVER_URL=https://github.com
|
||||
GITHUB_SHA=860c1904a1ce19322e91ac35af1ab07466440c37
|
||||
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_81f7da89-3d0b-493a-af1f-c67e5f779727
|
||||
GITHUB_WORKFLOW=metadata
|
||||
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
145
__tests__/fixtures/event_workflow_dispatch_dev.json
Normal file
145
__tests__/fixtures/event_workflow_dispatch_dev.json
Normal file
@ -0,0 +1,145 @@
|
||||
{
|
||||
"inputs": {
|
||||
"logLevel": "warning"
|
||||
},
|
||||
"organization": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"description": "Docker helps developers bring their ideas to life by conquering the complexity of app development.",
|
||||
"events_url": "https://api.github.com/orgs/docker/events",
|
||||
"hooks_url": "https://api.github.com/orgs/docker/hooks",
|
||||
"id": 5429470,
|
||||
"issues_url": "https://api.github.com/orgs/docker/issues",
|
||||
"login": "docker",
|
||||
"members_url": "https://api.github.com/orgs/docker/members{/member}",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"public_members_url": "https://api.github.com/orgs/docker/public_members{/member}",
|
||||
"repos_url": "https://api.github.com/orgs/docker/repos",
|
||||
"url": "https://api.github.com/orgs/docker"
|
||||
},
|
||||
"ref": "refs/heads/dev",
|
||||
"repository": {
|
||||
"allow_forking": true,
|
||||
"archive_url": "https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}",
|
||||
"archived": false,
|
||||
"assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}",
|
||||
"blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}",
|
||||
"branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}",
|
||||
"clone_url": "https://github.com/docker/test-docker-action.git",
|
||||
"collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}",
|
||||
"comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}",
|
||||
"commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}",
|
||||
"compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}",
|
||||
"contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}",
|
||||
"contributors_url": "https://api.github.com/repos/docker/test-docker-action/contributors",
|
||||
"created_at": "2020-08-07T09:23:00Z",
|
||||
"default_branch": "master",
|
||||
"deployments_url": "https://api.github.com/repos/docker/test-docker-action/deployments",
|
||||
"description": "Test \"Docker\" Actions",
|
||||
"disabled": false,
|
||||
"downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads",
|
||||
"events_url": "https://api.github.com/repos/docker/test-docker-action/events",
|
||||
"fork": false,
|
||||
"forks": 1,
|
||||
"forks_count": 1,
|
||||
"forks_url": "https://api.github.com/repos/docker/test-docker-action/forks",
|
||||
"full_name": "docker/test-docker-action",
|
||||
"git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}",
|
||||
"git_url": "git://github.com/docker/test-docker-action.git",
|
||||
"has_downloads": true,
|
||||
"has_issues": true,
|
||||
"has_pages": false,
|
||||
"has_projects": true,
|
||||
"has_wiki": true,
|
||||
"homepage": "",
|
||||
"hooks_url": "https://api.github.com/repos/docker/test-docker-action/hooks",
|
||||
"html_url": "https://github.com/docker/test-docker-action",
|
||||
"id": 285789493,
|
||||
"is_template": false,
|
||||
"issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}",
|
||||
"issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}",
|
||||
"issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}",
|
||||
"keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}",
|
||||
"labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}",
|
||||
"language": "JavaScript",
|
||||
"languages_url": "https://api.github.com/repos/docker/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/docker/test-docker-action/merges",
|
||||
"milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}",
|
||||
"mirror_url": null,
|
||||
"name": "test-docker-action",
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||
"notifications_url": "https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}",
|
||||
"open_issues": 6,
|
||||
"open_issues_count": 6,
|
||||
"owner": {
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||
"events_url": "https://api.github.com/users/docker/events{/privacy}",
|
||||
"followers_url": "https://api.github.com/users/docker/followers",
|
||||
"following_url": "https://api.github.com/users/docker/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/docker/gists{/gist_id}",
|
||||
"gravatar_id": "",
|
||||
"html_url": "https://github.com/docker",
|
||||
"id": 5429470,
|
||||
"login": "docker",
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||
"organizations_url": "https://api.github.com/users/docker/orgs",
|
||||
"received_events_url": "https://api.github.com/users/docker/received_events",
|
||||
"repos_url": "https://api.github.com/users/docker/repos",
|
||||
"site_admin": false,
|
||||
"starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/docker/subscriptions",
|
||||
"type": "Organization",
|
||||
"url": "https://api.github.com/users/docker"
|
||||
},
|
||||
"private": true,
|
||||
"pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}",
|
||||
"pushed_at": "2022-04-19T09:41:03Z",
|
||||
"releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}",
|
||||
"size": 796,
|
||||
"ssh_url": "git@github.com:docker/test-docker-action.git",
|
||||
"stargazers_count": 0,
|
||||
"stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers",
|
||||
"statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}",
|
||||
"subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription",
|
||||
"svn_url": "https://github.com/docker/test-docker-action",
|
||||
"tags_url": "https://api.github.com/repos/docker/test-docker-action/tags",
|
||||
"teams_url": "https://api.github.com/repos/docker/test-docker-action/teams",
|
||||
"topics": [],
|
||||
"trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}",
|
||||
"updated_at": "2022-04-19T09:05:09Z",
|
||||
"url": "https://api.github.com/repos/docker/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/orgs",
|
||||
"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"
|
||||
},
|
||||
"workflow": ".github/workflows/metadata.yml"
|
||||
}
|
182
__tests__/flavor.test.ts
Normal file
182
__tests__/flavor.test.ts
Normal file
@ -0,0 +1,182 @@
|
||||
import {describe, expect, test} from '@jest/globals';
|
||||
|
||||
import {Flavor, Transform} from '../src/flavor';
|
||||
|
||||
describe('transform', () => {
|
||||
// prettier-ignore
|
||||
test.each([
|
||||
[
|
||||
[
|
||||
`randomstr`,
|
||||
`latest=auto`
|
||||
],
|
||||
{} as Flavor,
|
||||
true
|
||||
],
|
||||
[
|
||||
[
|
||||
`unknwown=foo`
|
||||
],
|
||||
{} as Flavor,
|
||||
true
|
||||
],
|
||||
[
|
||||
[
|
||||
`latest`,
|
||||
],
|
||||
{} as Flavor,
|
||||
true
|
||||
],
|
||||
[
|
||||
[
|
||||
`latest=true`
|
||||
],
|
||||
{
|
||||
latest: "true",
|
||||
prefix: "",
|
||||
prefixLatest: false,
|
||||
suffix: "",
|
||||
suffixLatest: false,
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
[
|
||||
[
|
||||
`latest=false`
|
||||
],
|
||||
{
|
||||
latest: "false",
|
||||
prefix: "",
|
||||
prefixLatest: false,
|
||||
suffix: "",
|
||||
suffixLatest: false,
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
[
|
||||
[
|
||||
`latest=auto`
|
||||
],
|
||||
{
|
||||
latest: "auto",
|
||||
prefix: "",
|
||||
prefixLatest: false,
|
||||
suffix: "",
|
||||
suffixLatest: false,
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
[
|
||||
[
|
||||
`latest=foo`
|
||||
],
|
||||
{} as Flavor,
|
||||
true
|
||||
],
|
||||
[
|
||||
[
|
||||
`prefix=sha-`
|
||||
],
|
||||
{
|
||||
latest: "auto",
|
||||
prefix: "sha-",
|
||||
prefixLatest: false,
|
||||
suffix: "",
|
||||
suffixLatest: false,
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
[
|
||||
[
|
||||
`suffix=-alpine`
|
||||
],
|
||||
{
|
||||
latest: "auto",
|
||||
prefix: "",
|
||||
prefixLatest: false,
|
||||
suffix: "-alpine",
|
||||
suffixLatest: false,
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
[
|
||||
[
|
||||
`latest=false`,
|
||||
`prefix=dev-`,
|
||||
`suffix=-alpine`
|
||||
],
|
||||
{
|
||||
latest: "false",
|
||||
prefix: "dev-",
|
||||
prefixLatest: false,
|
||||
suffix: "-alpine",
|
||||
suffixLatest: false,
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
[
|
||||
[
|
||||
`prefix=dev-,onlatest=true`,
|
||||
],
|
||||
{
|
||||
latest: "auto",
|
||||
prefix: "dev-",
|
||||
prefixLatest: true,
|
||||
suffix: "",
|
||||
suffixLatest: false,
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
[
|
||||
[
|
||||
`suffix=-alpine,onlatest=true`,
|
||||
],
|
||||
{
|
||||
latest: "auto",
|
||||
prefix: "",
|
||||
prefixLatest: false,
|
||||
suffix: "-alpine",
|
||||
suffixLatest: true,
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
[
|
||||
[
|
||||
`prefix=dev-,onlatest=true`,
|
||||
`suffix=-alpine,onlatest=true`,
|
||||
],
|
||||
{
|
||||
latest: "auto",
|
||||
prefix: "dev-",
|
||||
prefixLatest: true,
|
||||
suffix: "-alpine",
|
||||
suffixLatest: true,
|
||||
} as Flavor,
|
||||
false
|
||||
],
|
||||
[
|
||||
[
|
||||
`prefix= `,
|
||||
],
|
||||
{
|
||||
latest: "auto",
|
||||
prefix: "",
|
||||
prefixLatest: false,
|
||||
suffix: "",
|
||||
suffixLatest: false,
|
||||
} as Flavor,
|
||||
false
|
||||
]
|
||||
])('given %p attributes', async (inputs: string[], expected: Flavor, invalid: boolean) => {
|
||||
try {
|
||||
const flavor = Transform(inputs);
|
||||
expect(flavor).toEqual(expected);
|
||||
} catch (err) {
|
||||
if (!invalid) {
|
||||
console.error(err);
|
||||
}
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect(true).toBe(invalid);
|
||||
}
|
||||
});
|
||||
});
|
@ -1,17 +0,0 @@
|
||||
import * as path from 'path';
|
||||
import * as github from '../src/github';
|
||||
import {ReposGetResponseData} from '@octokit/types';
|
||||
|
||||
jest.spyOn(github, 'repo').mockImplementation(
|
||||
(): Promise<ReposGetResponseData> => {
|
||||
return <Promise<ReposGetResponseData>>require(path.join(__dirname, 'fixtures', 'repo.json'));
|
||||
}
|
||||
);
|
||||
|
||||
describe('repo', () => {
|
||||
it('returns GitHub repository', async () => {
|
||||
const repo = await github.repo(process.env.GITHUB_TOKEN || '');
|
||||
console.log(repo);
|
||||
expect(repo.name).not.toBeNull();
|
||||
});
|
||||
});
|
102
__tests__/image.test.ts
Normal file
102
__tests__/image.test.ts
Normal file
@ -0,0 +1,102 @@
|
||||
import {describe, expect, test} from '@jest/globals';
|
||||
|
||||
import {Transform, Image} from '../src/image';
|
||||
|
||||
describe('transform', () => {
|
||||
// prettier-ignore
|
||||
test.each([
|
||||
[
|
||||
[
|
||||
`name/foo`
|
||||
],
|
||||
[
|
||||
{
|
||||
name: `name/foo`,
|
||||
enable: true,
|
||||
}
|
||||
] as Image[],
|
||||
false
|
||||
],
|
||||
[
|
||||
[
|
||||
`name/foo,name/bar`
|
||||
],
|
||||
[
|
||||
{
|
||||
name: `name/foo`,
|
||||
enable: true,
|
||||
},
|
||||
{
|
||||
name: `name/bar`,
|
||||
enable: true,
|
||||
}
|
||||
] as Image[],
|
||||
false
|
||||
],
|
||||
[
|
||||
[
|
||||
`name/foo`,
|
||||
`name/bar`
|
||||
],
|
||||
[
|
||||
{
|
||||
name: `name/foo`,
|
||||
enable: true,
|
||||
},
|
||||
{
|
||||
name: `name/bar`,
|
||||
enable: true,
|
||||
}
|
||||
] as Image[],
|
||||
false
|
||||
],
|
||||
[
|
||||
[
|
||||
`name=name/bar`,
|
||||
`name/foo,enable=false`,
|
||||
`name=ghcr.io/UserName/Foo,enable=true`
|
||||
],
|
||||
[
|
||||
{
|
||||
name: `name/bar`,
|
||||
enable: true,
|
||||
},
|
||||
{
|
||||
name: `name/foo`,
|
||||
enable: false,
|
||||
},
|
||||
{
|
||||
name: `ghcr.io/UserName/Foo`,
|
||||
enable: true,
|
||||
},
|
||||
] as Image[],
|
||||
false
|
||||
],
|
||||
[
|
||||
[`value=name/foo`], undefined, true
|
||||
],
|
||||
[
|
||||
[`name/foo,enable=bar`], undefined, true
|
||||
],
|
||||
[
|
||||
[`name/foo,bar=baz`], undefined, true
|
||||
],
|
||||
[
|
||||
[`name=,enable=true`], undefined, true
|
||||
],
|
||||
[
|
||||
[`name/foo,name=name/bar,enable=true`], undefined, true
|
||||
]
|
||||
])('given %p', async (l: string[], expected: Image[] | undefined, invalid: boolean) => {
|
||||
try {
|
||||
const images = Transform(l);
|
||||
expect(images).toEqual(expected);
|
||||
} catch (err) {
|
||||
if (!invalid) {
|
||||
console.error(err);
|
||||
}
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect(true).toBe(invalid);
|
||||
}
|
||||
});
|
||||
});
|
File diff suppressed because it is too large
Load Diff
450
__tests__/tag.test.ts
Normal file
450
__tests__/tag.test.ts
Normal file
@ -0,0 +1,450 @@
|
||||
import {describe, expect, test} from '@jest/globals';
|
||||
|
||||
import {Transform, Parse, Tag, Type, RefEvent, ShaFormat, DefaultPriorities} from '../src/tag';
|
||||
|
||||
describe('transform', () => {
|
||||
// prettier-ignore
|
||||
test.each([
|
||||
[
|
||||
[
|
||||
`type=ref,event=branch`,
|
||||
`type=ref,event=tag`,
|
||||
`type=ref,event=pr`,
|
||||
`type=schedule`,
|
||||
`type=sha`,
|
||||
`type=raw,foo`,
|
||||
`type=edge`,
|
||||
`type=semver,pattern={{version}}`,
|
||||
`type=match,"pattern=\\d.\\d.\\d",group=0`
|
||||
],
|
||||
[
|
||||
{
|
||||
type: Type.Schedule,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Schedule],
|
||||
"enable": "true",
|
||||
"pattern": "nightly"
|
||||
}
|
||||
},
|
||||
{
|
||||
type: Type.Semver,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Semver],
|
||||
"enable": "true",
|
||||
"pattern": "{{version}}",
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
type: Type.Match,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Match],
|
||||
"enable": "true",
|
||||
"pattern": "\\d.\\d.\\d",
|
||||
"group": "0",
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
type: Type.Edge,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Edge],
|
||||
"enable": "true",
|
||||
"branch": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
type: Type.Ref,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Ref],
|
||||
"enable": "true",
|
||||
"event": RefEvent.Branch
|
||||
}
|
||||
},
|
||||
{
|
||||
type: Type.Ref,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Ref],
|
||||
"enable": "true",
|
||||
"event": RefEvent.Tag
|
||||
}
|
||||
},
|
||||
{
|
||||
type: Type.Ref,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Ref],
|
||||
"enable": "true",
|
||||
"prefix": "pr-",
|
||||
"event": RefEvent.PR
|
||||
}
|
||||
},
|
||||
{
|
||||
type: Type.Raw,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Raw],
|
||||
"enable": "true",
|
||||
"value": "foo"
|
||||
}
|
||||
},
|
||||
{
|
||||
type: Type.Sha,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Sha],
|
||||
"enable": "true",
|
||||
"prefix": "sha-",
|
||||
"format": ShaFormat.Short
|
||||
}
|
||||
}
|
||||
] as Tag[],
|
||||
false
|
||||
]
|
||||
])('given %p', async (l: string[], expected: Tag[], invalid: boolean) => {
|
||||
try {
|
||||
const tags = Transform(l);
|
||||
expect(tags).toEqual(expected);
|
||||
} catch (err) {
|
||||
if (!invalid) {
|
||||
console.error(err);
|
||||
}
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect(true).toBe(invalid);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('parse', () => {
|
||||
// prettier-ignore
|
||||
test.each([
|
||||
[
|
||||
`type=schedule,enable=true,pattern={{date 'YYYYMMDD'}}`,
|
||||
{
|
||||
type: Type.Schedule,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Schedule],
|
||||
"enable": "true",
|
||||
"pattern": "{{date 'YYYYMMDD'}}"
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=schedule,enable=true,pattern={{date 'YYYYMMDD' tz='Asia/Tokyo'}}`,
|
||||
{
|
||||
type: Type.Schedule,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Schedule],
|
||||
"enable": "true",
|
||||
"pattern": `{{date 'YYYYMMDD' tz='Asia/Tokyo'}}`
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=semver,enable=true,pattern={{version}}`,
|
||||
{
|
||||
type: Type.Semver,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Semver],
|
||||
"enable": "true",
|
||||
"pattern": "{{version}}",
|
||||
"value": ""
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=semver,priority=1,enable=true,pattern={{version}}`,
|
||||
{
|
||||
type: Type.Semver,
|
||||
attrs: {
|
||||
"priority": "1",
|
||||
"enable": "true",
|
||||
"pattern": "{{version}}",
|
||||
"value": ""
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=semver,priority=1,enable=true,pattern={{version}},value=v1.0.0`,
|
||||
{
|
||||
type: Type.Semver,
|
||||
attrs: {
|
||||
"priority": "1",
|
||||
"enable": "true",
|
||||
"pattern": "{{version}}",
|
||||
"value": "v1.0.0"
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=match,enable=true,pattern=v(.*),group=1`,
|
||||
{
|
||||
type: Type.Match,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Match],
|
||||
"enable": "true",
|
||||
"pattern": "v(.*)",
|
||||
"group": "1",
|
||||
"value": ""
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=match,enable=true,"pattern=^v(\\d.\\d.\\d)$",group=1`,
|
||||
{
|
||||
type: Type.Match,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Match],
|
||||
"enable": "true",
|
||||
"pattern": "^v(\\d.\\d.\\d)$",
|
||||
"group": "1",
|
||||
"value": ""
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=match,priority=700,enable=true,pattern=v(.*),group=1`,
|
||||
{
|
||||
type: Type.Match,
|
||||
attrs: {
|
||||
"priority": "700",
|
||||
"enable": "true",
|
||||
"pattern": "v(.*)",
|
||||
"group": "1",
|
||||
"value": ""
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=match,enable=true,pattern=v(.*),group=1,value=v1.2.3`,
|
||||
{
|
||||
type: Type.Match,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Match],
|
||||
"enable": "true",
|
||||
"pattern": "v(.*)",
|
||||
"group": "1",
|
||||
"value": "v1.2.3"
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=match,enable=true,pattern=v(.*),group=foo`,
|
||||
{} as Tag,
|
||||
true
|
||||
],
|
||||
[
|
||||
`type=edge`,
|
||||
{
|
||||
type: Type.Edge,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Edge],
|
||||
"enable": "true",
|
||||
"branch": ""
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=edge,enable=true,branch=master`,
|
||||
{
|
||||
type: Type.Edge,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Edge],
|
||||
"enable": "true",
|
||||
"branch": "master"
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=ref,event=tag`,
|
||||
{
|
||||
type: Type.Ref,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Ref],
|
||||
"enable": "true",
|
||||
"event": RefEvent.Tag
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=ref,event=branch`,
|
||||
{
|
||||
type: Type.Ref,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Ref],
|
||||
"enable": "true",
|
||||
"event": RefEvent.Branch
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=ref,event=pr`,
|
||||
{
|
||||
type: Type.Ref,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Ref],
|
||||
"enable": "true",
|
||||
"prefix": "pr-",
|
||||
"event": RefEvent.PR
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=ref,event=foo`,
|
||||
{} as Tag,
|
||||
true
|
||||
],
|
||||
[
|
||||
`type=ref`,
|
||||
{} as Tag,
|
||||
true
|
||||
],
|
||||
[
|
||||
`acustomtag`,
|
||||
{
|
||||
type: Type.Raw,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Raw],
|
||||
"enable": "true",
|
||||
"value": "acustomtag"
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=raw`,
|
||||
{} as Tag,
|
||||
true
|
||||
],
|
||||
[
|
||||
`type=raw,value=acustomtag2`,
|
||||
{
|
||||
type: Type.Raw,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Raw],
|
||||
"enable": "true",
|
||||
"value": "acustomtag2"
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=raw,enable=true,value=acustomtag4`,
|
||||
{
|
||||
type: Type.Raw,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Raw],
|
||||
"enable": "true",
|
||||
"value": "acustomtag4"
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=raw,enable=false,value=acustomtag5`,
|
||||
{
|
||||
type: Type.Raw,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Raw],
|
||||
"enable": "false",
|
||||
"value": "acustomtag5"
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=sha`,
|
||||
{
|
||||
type: Type.Sha,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Sha],
|
||||
"enable": "true",
|
||||
"prefix": "sha-",
|
||||
"format": ShaFormat.Short
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=sha,format=long`,
|
||||
{
|
||||
type: Type.Sha,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Sha],
|
||||
"enable": "true",
|
||||
"prefix": "sha-",
|
||||
"format": ShaFormat.Long
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=sha,prefix=`,
|
||||
{
|
||||
type: Type.Sha,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Sha],
|
||||
"enable": "true",
|
||||
"prefix": "",
|
||||
"format": ShaFormat.Short
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=sha,enable=false`,
|
||||
{
|
||||
type: Type.Sha,
|
||||
attrs: {
|
||||
"priority": DefaultPriorities[Type.Sha],
|
||||
"enable": "false",
|
||||
"prefix": "sha-",
|
||||
"format": ShaFormat.Short
|
||||
}
|
||||
} as Tag,
|
||||
false
|
||||
],
|
||||
[
|
||||
`type=semver`,
|
||||
{} as Tag,
|
||||
true
|
||||
],
|
||||
[
|
||||
`type=match`,
|
||||
{} as Tag,
|
||||
true
|
||||
],
|
||||
[
|
||||
`type=foo`,
|
||||
{} as Tag,
|
||||
true
|
||||
],
|
||||
[
|
||||
`type=sha,format=foo`,
|
||||
{} as Tag,
|
||||
true
|
||||
]
|
||||
])('given %p event', async (s: string, expected: Tag, invalid: boolean) => {
|
||||
try {
|
||||
const tag = Parse(s);
|
||||
expect(tag).toEqual(expected);
|
||||
} catch (err) {
|
||||
if (!invalid) {
|
||||
console.error(err);
|
||||
}
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect(true).toBe(invalid);
|
||||
}
|
||||
});
|
||||
});
|
77
action.yml
77
action.yml
@ -1,64 +1,43 @@
|
||||
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
|
||||
name: 'Docker Meta'
|
||||
name: 'Docker Metadata action'
|
||||
description: "GitHub Action to extract metadata (tags, labels) for Docker"
|
||||
author: 'crazy-max'
|
||||
author: 'docker'
|
||||
branding:
|
||||
icon: 'anchor'
|
||||
color: 'blue'
|
||||
icon: 'layers'
|
||||
|
||||
inputs:
|
||||
context:
|
||||
description: 'Where to get context data. Allowed options are "workflow" (default), "git".'
|
||||
default: "workflow"
|
||||
required: true
|
||||
images:
|
||||
description: 'List of Docker images to use as base name for tags'
|
||||
required: true
|
||||
tag-sha:
|
||||
description: 'Add git short SHA as Docker tag'
|
||||
default: 'false'
|
||||
required: false
|
||||
tag-edge:
|
||||
description: 'Enable edge branch tagging'
|
||||
default: 'false'
|
||||
tags:
|
||||
description: 'List of tags as key-value pair attributes'
|
||||
required: false
|
||||
tag-edge-branch:
|
||||
description: 'Branch that will be tagged as edge (default repo.default_branch)'
|
||||
flavor:
|
||||
description: 'Flavors to apply'
|
||||
required: false
|
||||
tag-semver:
|
||||
description: 'Handle Git tag as semver template if possible'
|
||||
required: false
|
||||
tag-match:
|
||||
description: 'RegExp to match against a Git tag and use match group as Docker tag'
|
||||
required: false
|
||||
tag-match-group:
|
||||
description: 'Group to get if tag-match matches (default 0)'
|
||||
default: '0'
|
||||
required: false
|
||||
tag-latest:
|
||||
description: 'Set latest Docker tag if tag-semver, tag-match or Git tag event occurs'
|
||||
default: 'true'
|
||||
required: false
|
||||
tag-match-latest:
|
||||
deprecationMessage: 'tag-match-latest is deprecated. Use tag-latest instead'
|
||||
description: '(DEPRECATED) Set latest Docker tag if tag-match matches or on Git tag event'
|
||||
default: 'true'
|
||||
required: false
|
||||
tag-schedule:
|
||||
description: 'Template to apply to schedule tag'
|
||||
default: 'nightly'
|
||||
required: false
|
||||
tag-custom:
|
||||
description: 'List of custom tags'
|
||||
required: false
|
||||
tag-custom-only:
|
||||
description: 'Only use tag-custom as Docker tags'
|
||||
required: false
|
||||
label-custom:
|
||||
labels:
|
||||
description: 'List of custom labels'
|
||||
required: false
|
||||
annotations:
|
||||
description: 'List of custom annotations'
|
||||
required: false
|
||||
sep-tags:
|
||||
description: 'Separator to use for tags output (default \n)'
|
||||
required: false
|
||||
sep-labels:
|
||||
description: 'Separator to use for labels output (default \n)'
|
||||
required: false
|
||||
sep-annotations:
|
||||
description: 'Separator to use for annotations output (default \n)'
|
||||
required: false
|
||||
bake-target:
|
||||
description: 'Bake target name (default docker-metadata-action)'
|
||||
required: false
|
||||
github-token:
|
||||
description: 'GitHub Token as provided by secrets'
|
||||
default: ${{ github.token }}
|
||||
@ -71,9 +50,19 @@ outputs:
|
||||
description: 'Generated Docker tags'
|
||||
labels:
|
||||
description: 'Generated Docker labels'
|
||||
annotations:
|
||||
description: 'Generated annotations'
|
||||
json:
|
||||
description: 'JSON output of tags and labels'
|
||||
bake-file-tags:
|
||||
description: 'Bake definition file with tags'
|
||||
bake-file-labels:
|
||||
description: 'Bake definition file with labels'
|
||||
bake-file-annotations:
|
||||
description: 'Bake definition file with annotations'
|
||||
bake-file:
|
||||
description: 'Bake definiton file'
|
||||
description: 'Bake definition file with tags and labels'
|
||||
|
||||
runs:
|
||||
using: 'node12'
|
||||
using: 'node20'
|
||||
main: 'dist/index.js'
|
||||
|
3
codecov.yml
Normal file
3
codecov.yml
Normal file
@ -0,0 +1,3 @@
|
||||
comment: false
|
||||
github_checks:
|
||||
annotations: false
|
80
dev.Dockerfile
Normal file
80
dev.Dockerfile
Normal file
@ -0,0 +1,80 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
ARG NODE_VERSION=20
|
||||
|
||||
FROM node:${NODE_VERSION}-alpine AS base
|
||||
RUN apk add --no-cache cpio findutils git
|
||||
WORKDIR /src
|
||||
RUN --mount=type=bind,target=.,rw \
|
||||
--mount=type=cache,target=/src/.yarn/cache <<EOT
|
||||
corepack enable
|
||||
yarn --version
|
||||
yarn config set --home enableTelemetry 0
|
||||
EOT
|
||||
|
||||
FROM base AS deps
|
||||
RUN --mount=type=bind,target=.,rw \
|
||||
--mount=type=cache,target=/src/.yarn/cache \
|
||||
--mount=type=cache,target=/src/node_modules \
|
||||
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"'
|
||||
git status --porcelain -- yarn.lock
|
||||
exit 1
|
||||
fi
|
||||
EOT
|
||||
|
||||
FROM deps AS build
|
||||
RUN --mount=type=bind,target=.,rw \
|
||||
--mount=type=cache,target=/src/.yarn/cache \
|
||||
--mount=type=cache,target=/src/node_modules \
|
||||
yarn run build && mkdir /out && cp -Rf dist /out/
|
||||
|
||||
FROM scratch AS build-update
|
||||
COPY --from=build /out /
|
||||
|
||||
FROM build AS build-validate
|
||||
RUN --mount=type=bind,target=.,rw <<EOT
|
||||
set -e
|
||||
git add -A
|
||||
cp -rf /out/* .
|
||||
if [ -n "$(git status --porcelain -- dist)" ]; then
|
||||
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
|
||||
git status --porcelain -- dist
|
||||
exit 1
|
||||
fi
|
||||
EOT
|
||||
|
||||
FROM deps AS format
|
||||
RUN --mount=type=bind,target=.,rw \
|
||||
--mount=type=cache,target=/src/.yarn/cache \
|
||||
--mount=type=cache,target=/src/node_modules \
|
||||
yarn run format \
|
||||
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
|
||||
|
||||
FROM scratch AS format-update
|
||||
COPY --from=format /out /
|
||||
|
||||
FROM deps AS lint
|
||||
RUN --mount=type=bind,target=.,rw \
|
||||
--mount=type=cache,target=/src/.yarn/cache \
|
||||
--mount=type=cache,target=/src/node_modules \
|
||||
yarn run lint
|
||||
|
||||
FROM deps AS test
|
||||
RUN --mount=type=bind,target=.,rw \
|
||||
--mount=type=cache,target=/src/.yarn/cache \
|
||||
--mount=type=cache,target=/src/node_modules \
|
||||
yarn run test --coverage --coverageDirectory=/tmp/coverage
|
||||
|
||||
FROM scratch AS test-coverage
|
||||
COPY --from=test /tmp/coverage /
|
24884
dist/index.js
generated
vendored
24884
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
1
dist/index.js.map
generated
vendored
Normal file
1
dist/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4054
dist/licenses.txt
generated
vendored
Normal file
4054
dist/licenses.txt
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
dist/sourcemap-register.js
generated
vendored
Normal file
1
dist/sourcemap-register.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,54 +1,66 @@
|
||||
target "_common" {
|
||||
args = {
|
||||
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
|
||||
}
|
||||
}
|
||||
|
||||
group "default" {
|
||||
targets = ["build"]
|
||||
}
|
||||
|
||||
group "pre-checkin" {
|
||||
targets = ["update-yarn", "format", "build"]
|
||||
targets = ["vendor", "format", "build"]
|
||||
}
|
||||
|
||||
group "validate" {
|
||||
targets = ["validate-format", "validate-build", "validate-yarn"]
|
||||
}
|
||||
|
||||
target "dockerfile" {
|
||||
dockerfile = "Dockerfile.dev"
|
||||
}
|
||||
|
||||
target "update-yarn" {
|
||||
inherits = ["dockerfile"]
|
||||
target = "update-yarn"
|
||||
output = ["."]
|
||||
targets = ["lint", "build-validate", "vendor-validate"]
|
||||
}
|
||||
|
||||
target "build" {
|
||||
inherits = ["dockerfile"]
|
||||
target = "dist"
|
||||
inherits = ["_common"]
|
||||
dockerfile = "dev.Dockerfile"
|
||||
target = "build-update"
|
||||
output = ["."]
|
||||
}
|
||||
|
||||
target "test" {
|
||||
inherits = ["dockerfile"]
|
||||
target = "test-coverage"
|
||||
output = ["."]
|
||||
target "build-validate" {
|
||||
inherits = ["_common"]
|
||||
dockerfile = "dev.Dockerfile"
|
||||
target = "build-validate"
|
||||
output = ["type=cacheonly"]
|
||||
}
|
||||
|
||||
target "format" {
|
||||
inherits = ["dockerfile"]
|
||||
target = "format"
|
||||
inherits = ["_common"]
|
||||
dockerfile = "dev.Dockerfile"
|
||||
target = "format-update"
|
||||
output = ["."]
|
||||
}
|
||||
|
||||
target "validate-format" {
|
||||
inherits = ["dockerfile"]
|
||||
target = "validate-format"
|
||||
target "lint" {
|
||||
inherits = ["_common"]
|
||||
dockerfile = "dev.Dockerfile"
|
||||
target = "lint"
|
||||
output = ["type=cacheonly"]
|
||||
}
|
||||
|
||||
target "validate-build" {
|
||||
inherits = ["dockerfile"]
|
||||
target = "validate-build"
|
||||
target "vendor" {
|
||||
inherits = ["_common"]
|
||||
dockerfile = "dev.Dockerfile"
|
||||
target = "vendor-update"
|
||||
output = ["."]
|
||||
}
|
||||
|
||||
target "validate-yarn" {
|
||||
inherits = ["dockerfile"]
|
||||
target = "validate-yarn"
|
||||
target "vendor-validate" {
|
||||
inherits = ["_common"]
|
||||
dockerfile = "dev.Dockerfile"
|
||||
target = "vendor-validate"
|
||||
output = ["type=cacheonly"]
|
||||
}
|
||||
|
||||
target "test" {
|
||||
inherits = ["_common"]
|
||||
dockerfile = "dev.Dockerfile"
|
||||
target = "test-coverage"
|
||||
output = ["./coverage"]
|
||||
}
|
||||
|
@ -1,12 +0,0 @@
|
||||
module.exports = {
|
||||
clearMocks: true,
|
||||
moduleFileExtensions: ['js', 'ts'],
|
||||
setupFiles: ["dotenv/config"],
|
||||
testEnvironment: 'node',
|
||||
testMatch: ['**/*.test.ts'],
|
||||
testRunner: 'jest-circus/runner',
|
||||
transform: {
|
||||
'^.+\\.ts$': 'ts-jest'
|
||||
},
|
||||
verbose: false
|
||||
}
|
31
jest.config.ts
Normal file
31
jest.config.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-metadata-action-'));
|
||||
|
||||
process.env = Object.assign({}, process.env, {
|
||||
TEMP: tmpDir,
|
||||
GITHUB_REPOSITORY: 'docker/metadata-action',
|
||||
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
|
||||
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
|
||||
}) as {
|
||||
[key: string]: string;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
clearMocks: true,
|
||||
testEnvironment: 'node',
|
||||
moduleFileExtensions: ['js', 'ts'],
|
||||
setupFiles: ['dotenv/config'],
|
||||
testMatch: ['**/*.test.ts'],
|
||||
transform: {
|
||||
'^.+\\.ts$': 'ts-jest'
|
||||
},
|
||||
moduleNameMapper: {
|
||||
'^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs'
|
||||
},
|
||||
collectCoverageFrom: ['src/**/{!(main.ts),}.ts'],
|
||||
coveragePathIgnorePatterns: ['lib/', 'node_modules/', '__mocks__/', '__tests__/'],
|
||||
verbose: true
|
||||
};
|
67
package.json
67
package.json
@ -1,45 +1,58 @@
|
||||
{
|
||||
"name": "docker-meta",
|
||||
"name": "docker-metadata-action",
|
||||
"description": "GitHub Action to extract metadata (tags, labels) for Docker",
|
||||
"main": "lib/main.js",
|
||||
"main": "src/main.ts",
|
||||
"scripts": {
|
||||
"build": "tsc && ncc build",
|
||||
"test": "jest --coverage",
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"pre-checkin": "yarn run format && yarn run build"
|
||||
"build": "ncc build --source-map --minify --license licenses.txt",
|
||||
"lint": "yarn run prettier && yarn run eslint",
|
||||
"format": "yarn run prettier:fix && yarn run eslint:fix",
|
||||
"eslint": "eslint --max-warnings=0 .",
|
||||
"eslint:fix": "eslint --fix .",
|
||||
"prettier": "prettier --check \"./**/*.ts\"",
|
||||
"prettier:fix": "prettier --write \"./**/*.ts\"",
|
||||
"test": "jest"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/crazy-max/ghaction-docker-meta.git"
|
||||
"url": "git+https://github.com/docker/metadata-action.git"
|
||||
},
|
||||
"keywords": [
|
||||
"actions",
|
||||
"docker",
|
||||
"meta",
|
||||
"metadata",
|
||||
"tag",
|
||||
"label"
|
||||
],
|
||||
"author": "CrazyMax",
|
||||
"license": "MIT",
|
||||
"author": "Docker Inc.",
|
||||
"license": "Apache-2.0",
|
||||
"packageManager": "yarn@3.6.3",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/github": "^4.0.0",
|
||||
"csv-parse": "^4.14.2",
|
||||
"handlebars": "^4.7.6",
|
||||
"moment": "^2.29.1",
|
||||
"semver": "^7.3.4"
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/github": "^6.0.0",
|
||||
"@docker/actions-toolkit": "^0.56.0",
|
||||
"@renovate/pep440": "^1.0.0",
|
||||
"csv-parse": "^5.6.0",
|
||||
"handlebars": "^4.7.8",
|
||||
"moment": "^2.30.1",
|
||||
"moment-timezone": "^0.5.47",
|
||||
"semver": "^7.7.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^26.0.0",
|
||||
"@types/node": "^14.11.2",
|
||||
"@vercel/ncc": "^0.24.1",
|
||||
"dotenv": "^8.2.0",
|
||||
"jest": "^26.0.1",
|
||||
"jest-circus": "^26.0.1",
|
||||
"jest-runtime": "^26.0.1",
|
||||
"prettier": "^2.0.4",
|
||||
"ts-jest": "^26.4.1",
|
||||
"typescript": "^4.0.3"
|
||||
"@types/csv-parse": "^1.2.2",
|
||||
"@types/node": "^20.12.12",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@typescript-eslint/eslint-plugin": "^7.9.0",
|
||||
"@typescript-eslint/parser": "^7.9.0",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"dotenv": "^16.4.5",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-jest": "^28.5.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"jest": "^29.7.0",
|
||||
"prettier": "^3.2.5",
|
||||
"ts-jest": "^29.1.2",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.4.5"
|
||||
}
|
||||
}
|
||||
|
190
src/context.ts
190
src/context.ts
@ -1,84 +1,136 @@
|
||||
import csvparse from 'csv-parse/lib/sync';
|
||||
import * as core from '@actions/core';
|
||||
import * as fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import {Context as GithubContext} from '@actions/github/lib/context';
|
||||
import {Util} from '@docker/actions-toolkit/lib/util';
|
||||
import {Git} from '@docker/actions-toolkit/lib/git';
|
||||
import {GitHub} from '@docker/actions-toolkit/lib/github';
|
||||
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
|
||||
|
||||
let _tmpDir: string;
|
||||
|
||||
export interface Inputs {
|
||||
images: string[];
|
||||
tagSha: boolean;
|
||||
tagEdge: boolean;
|
||||
tagEdgeBranch: string;
|
||||
tagSemver: string[];
|
||||
tagMatch: string;
|
||||
tagMatchGroup: number;
|
||||
tagLatest: boolean;
|
||||
tagSchedule: string;
|
||||
tagCustom: string[];
|
||||
tagCustomOnly: boolean;
|
||||
labelCustom: string[];
|
||||
sepTags: string;
|
||||
sepLabels: string;
|
||||
githubToken: string;
|
||||
export interface Context extends GithubContext {
|
||||
commitDate: Date;
|
||||
}
|
||||
|
||||
export function tmpDir(): string {
|
||||
if (!_tmpDir) {
|
||||
_tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ghaction-docker-meta-')).split(path.sep).join(path.posix.sep);
|
||||
}
|
||||
return _tmpDir;
|
||||
export interface Inputs {
|
||||
context: ContextSource;
|
||||
images: string[];
|
||||
tags: string[];
|
||||
flavor: string[];
|
||||
labels: string[];
|
||||
annotations: string[];
|
||||
sepTags: string;
|
||||
sepLabels: string;
|
||||
sepAnnotations: string;
|
||||
bakeTarget: string;
|
||||
githubToken: string;
|
||||
}
|
||||
|
||||
export function getInputs(): Inputs {
|
||||
return {
|
||||
images: getInputList('images'),
|
||||
tagSha: /true/i.test(core.getInput('tag-sha') || 'false'),
|
||||
tagEdge: /true/i.test(core.getInput('tag-edge') || 'false'),
|
||||
tagEdgeBranch: core.getInput('tag-edge-branch'),
|
||||
tagSemver: getInputList('tag-semver'),
|
||||
tagMatch: core.getInput('tag-match'),
|
||||
tagMatchGroup: Number(core.getInput('tag-match-group')) || 0,
|
||||
tagLatest: /true/i.test(core.getInput('tag-latest') || core.getInput('tag-match-latest') || 'true'),
|
||||
tagSchedule: core.getInput('tag-schedule') || 'nightly',
|
||||
tagCustom: getInputList('tag-custom'),
|
||||
tagCustomOnly: /true/i.test(core.getInput('tag-custom-only') || 'false'),
|
||||
labelCustom: getInputList('label-custom'),
|
||||
sepTags: core.getInput('sep-tags') || `\n`,
|
||||
sepLabels: core.getInput('sep-labels') || `\n`,
|
||||
context: (core.getInput('context') || ContextSource.workflow) as ContextSource,
|
||||
images: Util.getInputList('images', {ignoreComma: true, comment: '#'}),
|
||||
tags: Util.getInputList('tags', {ignoreComma: true, comment: '#'}),
|
||||
flavor: Util.getInputList('flavor', {ignoreComma: true, comment: '#'}),
|
||||
labels: Util.getInputList('labels', {ignoreComma: true, comment: '#'}),
|
||||
annotations: Util.getInputList('annotations', {ignoreComma: true, comment: '#'}),
|
||||
sepTags: core.getInput('sep-tags', {trimWhitespace: false}) || `\n`,
|
||||
sepLabels: core.getInput('sep-labels', {trimWhitespace: false}) || `\n`,
|
||||
sepAnnotations: core.getInput('sep-annotations', {trimWhitespace: false}) || `\n`,
|
||||
bakeTarget: core.getInput('bake-target') || `docker-metadata-action`,
|
||||
githubToken: core.getInput('github-token')
|
||||
};
|
||||
}
|
||||
|
||||
export function getInputList(name: string, ignoreComma?: boolean): string[] {
|
||||
let res: Array<string> = [];
|
||||
|
||||
const items = core.getInput(name);
|
||||
if (items == '') {
|
||||
return res;
|
||||
}
|
||||
|
||||
for (let output of csvparse(items, {
|
||||
columns: false,
|
||||
relaxColumnCount: true,
|
||||
skipLinesWithEmptyValues: true
|
||||
}) as Array<string[]>) {
|
||||
if (output.length == 1) {
|
||||
res.push(output[0]);
|
||||
continue;
|
||||
} else if (!ignoreComma) {
|
||||
res.push(...output);
|
||||
continue;
|
||||
}
|
||||
res.push(output.join(','));
|
||||
}
|
||||
|
||||
return res.filter(item => item).map(pat => pat.trim());
|
||||
export enum ContextSource {
|
||||
workflow = 'workflow',
|
||||
git = 'git'
|
||||
}
|
||||
|
||||
export const asyncForEach = async (array, callback) => {
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
await callback(array[index], index, array);
|
||||
export async function getContext(source: ContextSource, toolkit: Toolkit): Promise<Context> {
|
||||
switch (source) {
|
||||
case ContextSource.workflow:
|
||||
return await getContextFromWorkflow(toolkit);
|
||||
case ContextSource.git:
|
||||
return await getContextFromGit();
|
||||
default:
|
||||
throw new Error(`Invalid context source: ${source}`);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async function getContextFromWorkflow(toolkit: Toolkit): Promise<Context> {
|
||||
const context = GitHub.context;
|
||||
|
||||
// Needs to override Git reference with pr ref instead of upstream branch ref
|
||||
// for pull_request_target event
|
||||
// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target
|
||||
if (/pull_request_target/.test(context.eventName)) {
|
||||
context.ref = `refs/pull/${context.payload.number}/merge`;
|
||||
}
|
||||
|
||||
// DOCKER_METADATA_PR_HEAD_SHA env var can be used to set associated head
|
||||
// SHA instead of commit SHA that triggered the workflow on pull request
|
||||
// event.
|
||||
if (/true/i.test(process.env.DOCKER_METADATA_PR_HEAD_SHA || '')) {
|
||||
if ((/pull_request/.test(context.eventName) || /pull_request_target/.test(context.eventName)) && context.payload?.pull_request?.head?.sha != undefined) {
|
||||
context.sha = context.payload.pull_request.head.sha;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
commitDate: await getCommitDateFromWorkflow(context.sha, toolkit),
|
||||
...context
|
||||
} as Context;
|
||||
}
|
||||
|
||||
async function getContextFromGit(): Promise<Context> {
|
||||
const ctx = await Git.context();
|
||||
|
||||
return {
|
||||
commitDate: await Git.commitDate(ctx.sha),
|
||||
...ctx
|
||||
} as Context;
|
||||
}
|
||||
|
||||
async function getCommitDateFromWorkflow(sha: string, toolkit: Toolkit): Promise<Date> {
|
||||
const event = GitHub.context.payload as unknown as {
|
||||
// branch push
|
||||
commits?: Array<{
|
||||
timestamp: string;
|
||||
// commit sha
|
||||
id: string;
|
||||
}>;
|
||||
// tags
|
||||
head_commit?: {
|
||||
timestamp: string;
|
||||
// commit sha
|
||||
id: string;
|
||||
};
|
||||
};
|
||||
|
||||
if (event.commits) {
|
||||
const commitDate = event.commits.find(x => x.id === sha)?.timestamp;
|
||||
if (commitDate) {
|
||||
return new Date(commitDate);
|
||||
}
|
||||
}
|
||||
|
||||
if (event.head_commit) {
|
||||
if (event.head_commit.id === sha) {
|
||||
return new Date(event.head_commit.timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
// fallback to github api for commit date
|
||||
try {
|
||||
const commit = await toolkit.github.octokit.rest.repos.getCommit({
|
||||
owner: GitHub.context.repo.owner,
|
||||
repo: GitHub.context.repo.repo,
|
||||
ref: sha
|
||||
});
|
||||
if (commit.data.commit.committer?.date) {
|
||||
return new Date(commit.data.commit.committer.date);
|
||||
}
|
||||
throw new Error('Committer date not found');
|
||||
} catch (error) {
|
||||
core.debug(`Failed to get commit date from GitHub API: ${error.message}`);
|
||||
return new Date();
|
||||
}
|
||||
}
|
||||
|
87
src/flavor.ts
Normal file
87
src/flavor.ts
Normal file
@ -0,0 +1,87 @@
|
||||
import {parse} from 'csv-parse/sync';
|
||||
import * as core from '@actions/core';
|
||||
|
||||
export interface Flavor {
|
||||
latest: string;
|
||||
prefix: string;
|
||||
prefixLatest: boolean;
|
||||
suffix: string;
|
||||
suffixLatest: boolean;
|
||||
}
|
||||
|
||||
export function Transform(inputs: string[]): Flavor {
|
||||
const flavor: Flavor = {
|
||||
latest: 'auto',
|
||||
prefix: '',
|
||||
prefixLatest: false,
|
||||
suffix: '',
|
||||
suffixLatest: false
|
||||
};
|
||||
|
||||
for (const input of inputs) {
|
||||
const fields = parse(input, {
|
||||
relaxColumnCount: true,
|
||||
skipEmptyLines: true
|
||||
})[0];
|
||||
let onlatestfor = '';
|
||||
for (const field of fields) {
|
||||
const parts = field
|
||||
.toString()
|
||||
.split('=')
|
||||
.map(item => item.trim());
|
||||
if (parts.length == 1) {
|
||||
throw new Error(`Invalid flavor entry: ${input}`);
|
||||
}
|
||||
const key = parts[0].toLowerCase();
|
||||
const value = parts[1];
|
||||
switch (key) {
|
||||
case 'latest': {
|
||||
flavor.latest = value;
|
||||
if (!['auto', 'true', 'false'].includes(flavor.latest)) {
|
||||
throw new Error(`Invalid latest flavor entry: ${input}`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'prefix': {
|
||||
flavor.prefix = value;
|
||||
onlatestfor = 'prefix';
|
||||
break;
|
||||
}
|
||||
case 'suffix': {
|
||||
flavor.suffix = value;
|
||||
onlatestfor = 'suffix';
|
||||
break;
|
||||
}
|
||||
case 'onlatest': {
|
||||
if (!['true', 'false'].includes(value)) {
|
||||
throw new Error(`Invalid value for onlatest attribute: ${value}`);
|
||||
}
|
||||
switch (onlatestfor) {
|
||||
case 'prefix': {
|
||||
flavor.prefixLatest = /true/i.test(value);
|
||||
break;
|
||||
}
|
||||
case 'suffix': {
|
||||
flavor.suffixLatest = /true/i.test(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
throw new Error(`Unknown flavor entry: ${input}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
core.startGroup(`Processing flavor input`);
|
||||
core.info(`latest=${flavor.latest}`);
|
||||
core.info(`prefix=${flavor.prefix}`);
|
||||
core.info(`prefixLatest=${flavor.prefixLatest}`);
|
||||
core.info(`suffix=${flavor.suffix}`);
|
||||
core.info(`suffixLatest=${flavor.suffixLatest}`);
|
||||
core.endGroup();
|
||||
|
||||
return flavor;
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
import * as github from '@actions/github';
|
||||
import {Context} from '@actions/github/lib/context';
|
||||
import {ReposGetResponseData} from '@octokit/types';
|
||||
|
||||
export function context(): Context {
|
||||
return github.context;
|
||||
}
|
||||
|
||||
export async function repo(token: string): Promise<ReposGetResponseData> {
|
||||
const octokit = github.getOctokit(token);
|
||||
const repo = await octokit.repos.get({
|
||||
...github.context.repo
|
||||
});
|
||||
if (!repo?.data) {
|
||||
throw new Error('Cannot get GitHub repository');
|
||||
}
|
||||
return repo.data;
|
||||
}
|
86
src/image.ts
Normal file
86
src/image.ts
Normal file
@ -0,0 +1,86 @@
|
||||
import {parse} from 'csv-parse/sync';
|
||||
import * as core from '@actions/core';
|
||||
|
||||
export interface Image {
|
||||
name: string;
|
||||
enable: boolean;
|
||||
}
|
||||
|
||||
export function Transform(inputs: string[]): Image[] {
|
||||
let images: Image[] = [];
|
||||
|
||||
// backward compatibility with old format
|
||||
if (inputs.length == 1) {
|
||||
let newformat = false;
|
||||
const fields = parse(inputs[0], {
|
||||
relaxColumnCount: true,
|
||||
skipEmptyLines: true
|
||||
})[0];
|
||||
for (const field of fields) {
|
||||
const parts = field
|
||||
.toString()
|
||||
.split('=')
|
||||
.map(item => item.trim());
|
||||
if (parts.length == 1) {
|
||||
images.push({name: parts[0], enable: true});
|
||||
} else {
|
||||
newformat = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!newformat) {
|
||||
return output(images);
|
||||
}
|
||||
}
|
||||
|
||||
images = [];
|
||||
for (const input of inputs) {
|
||||
const image: Image = {name: '', enable: true};
|
||||
const fields = parse(input, {
|
||||
relaxColumnCount: true,
|
||||
skipEmptyLines: true
|
||||
})[0];
|
||||
for (const field of fields) {
|
||||
const parts = field
|
||||
.toString()
|
||||
.split('=')
|
||||
.map(item => item.trim());
|
||||
if (parts.length == 1) {
|
||||
image.name = parts[0];
|
||||
} else {
|
||||
const key = parts[0].toLowerCase();
|
||||
const value = parts[1];
|
||||
switch (key) {
|
||||
case 'name': {
|
||||
image.name = value;
|
||||
break;
|
||||
}
|
||||
case 'enable': {
|
||||
if (!['true', 'false'].includes(value)) {
|
||||
throw new Error(`Invalid enable attribute value: ${input}`);
|
||||
}
|
||||
image.enable = /true/i.test(value);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
throw new Error(`Unknown image attribute: ${input}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (image.name.length == 0) {
|
||||
throw new Error(`Image name attribute empty: ${input}`);
|
||||
}
|
||||
images.push(image);
|
||||
}
|
||||
return output(images);
|
||||
}
|
||||
|
||||
function output(images: Image[]): Image[] {
|
||||
core.startGroup(`Processing images input`);
|
||||
for (const image of images) {
|
||||
core.info(`name=${image.name},enable=${image.enable}`);
|
||||
}
|
||||
core.endGroup();
|
||||
return images;
|
||||
}
|
152
src/main.ts
152
src/main.ts
@ -1,66 +1,120 @@
|
||||
import * as fs from 'fs';
|
||||
import {getInputs, Inputs} from './context';
|
||||
import * as github from './github';
|
||||
import {Meta, Version} from './meta';
|
||||
import * as core from '@actions/core';
|
||||
import {Context} from '@actions/github/lib/context';
|
||||
import {ReposGetResponseData} from '@octokit/types';
|
||||
import * as actionsToolkit from '@docker/actions-toolkit';
|
||||
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
|
||||
import {Util} from '@docker/actions-toolkit/lib/util';
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
const inputs: Inputs = await getInputs();
|
||||
if (inputs.images.length == 0) {
|
||||
throw new Error(`images input required`);
|
||||
import {getContext, getInputs, Inputs} from './context';
|
||||
import {Meta, Version} from './meta';
|
||||
|
||||
actionsToolkit.run(
|
||||
// main
|
||||
async () => {
|
||||
const inputs: Inputs = getInputs();
|
||||
const toolkit = new Toolkit({githubToken: inputs.githubToken});
|
||||
const context = await getContext(inputs.context, toolkit);
|
||||
const repo = await toolkit.github.repoData();
|
||||
const setOutput = outputEnvEnabled() ? setOutputAndEnv : core.setOutput;
|
||||
|
||||
await core.group(`Context info`, async () => {
|
||||
core.info(`eventName: ${context.eventName}`);
|
||||
core.info(`sha: ${context.sha}`);
|
||||
core.info(`ref: ${context.ref}`);
|
||||
core.info(`workflow: ${context.workflow}`);
|
||||
core.info(`action: ${context.action}`);
|
||||
core.info(`actor: ${context.actor}`);
|
||||
core.info(`runNumber: ${context.runNumber}`);
|
||||
core.info(`runId: ${context.runId}`);
|
||||
core.info(`commitDate: ${context.commitDate}`);
|
||||
});
|
||||
|
||||
if (core.isDebug()) {
|
||||
await core.group(`Webhook payload`, async () => {
|
||||
core.info(JSON.stringify(context.payload, null, 2));
|
||||
});
|
||||
}
|
||||
|
||||
const context: Context = github.context();
|
||||
const repo: ReposGetResponseData = await github.repo(inputs.githubToken);
|
||||
core.startGroup(`Context info`);
|
||||
core.info(`eventName: ${context.eventName}`);
|
||||
core.info(`sha: ${context.sha}`);
|
||||
core.info(`ref: ${context.ref}`);
|
||||
core.info(`workflow: ${context.workflow}`);
|
||||
core.info(`action: ${context.action}`);
|
||||
core.info(`actor: ${context.actor}`);
|
||||
core.info(`runNumber: ${context.runNumber}`);
|
||||
core.info(`runId: ${context.runId}`);
|
||||
core.endGroup();
|
||||
|
||||
const meta: Meta = new Meta(inputs, context, repo);
|
||||
|
||||
const version: Version = meta.version;
|
||||
core.startGroup(`Docker image version`);
|
||||
core.info(version.main || '');
|
||||
core.endGroup();
|
||||
core.setOutput('version', version.main || '');
|
||||
if (meta.version.main == undefined || meta.version.main.length == 0) {
|
||||
core.warning(`No Docker image version has been generated. Check tags input.`);
|
||||
} else {
|
||||
await core.group(`Docker image version`, async () => {
|
||||
core.info(version.main || '');
|
||||
});
|
||||
}
|
||||
setOutput('version', version.main || '');
|
||||
|
||||
// Docker tags
|
||||
const tags: Array<string> = meta.tags();
|
||||
core.startGroup(`Docker tags`);
|
||||
for (let tag of tags) {
|
||||
core.info(tag);
|
||||
const tags: Array<string> = meta.getTags();
|
||||
if (tags.length == 0) {
|
||||
core.warning('No Docker tag has been generated. Check tags input.');
|
||||
} else {
|
||||
await core.group(`Docker tags`, async () => {
|
||||
for (const tag of tags) {
|
||||
core.info(tag);
|
||||
}
|
||||
});
|
||||
}
|
||||
core.endGroup();
|
||||
core.setOutput('tags', tags.join(inputs.sepTags));
|
||||
setOutput('tags', tags.join(inputs.sepTags));
|
||||
|
||||
// Docker labels
|
||||
const labels: Array<string> = meta.labels();
|
||||
core.startGroup(`Docker labels`);
|
||||
for (let label of labels) {
|
||||
core.info(label);
|
||||
}
|
||||
core.endGroup();
|
||||
core.setOutput('labels', labels.join(inputs.sepLabels));
|
||||
const labels: Array<string> = meta.getLabels();
|
||||
await core.group(`Docker labels`, async () => {
|
||||
for (const label of labels) {
|
||||
core.info(label);
|
||||
}
|
||||
setOutput('labels', labels.join(inputs.sepLabels));
|
||||
});
|
||||
|
||||
// Bake definition file
|
||||
const bakeFile: string = meta.bakeFile();
|
||||
core.startGroup(`Bake definition file`);
|
||||
core.info(fs.readFileSync(bakeFile, 'utf8'));
|
||||
core.endGroup();
|
||||
core.setOutput('bake-file', bakeFile);
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
// Annotations
|
||||
const annotationsRaw: Array<string> = meta.getAnnotations();
|
||||
const annotationsLevels = process.env.DOCKER_METADATA_ANNOTATIONS_LEVELS || 'manifest';
|
||||
await core.group(`Annotations`, async () => {
|
||||
const annotations: Array<string> = [];
|
||||
for (const level of annotationsLevels.split(',')) {
|
||||
annotations.push(
|
||||
...annotationsRaw.map(label => {
|
||||
const v = `${level}:${label}`;
|
||||
core.info(v);
|
||||
return v;
|
||||
})
|
||||
);
|
||||
}
|
||||
setOutput(`annotations`, annotations.join(inputs.sepAnnotations));
|
||||
});
|
||||
|
||||
// JSON
|
||||
const jsonOutput = meta.getJSON(annotationsLevels.split(','));
|
||||
await core.group(`JSON output`, async () => {
|
||||
core.info(JSON.stringify(jsonOutput, null, 2));
|
||||
setOutput('json', JSON.stringify(jsonOutput));
|
||||
});
|
||||
|
||||
// Bake files
|
||||
for (const kind of ['tags', 'labels', 'annotations:' + annotationsLevels]) {
|
||||
const outputName = kind.split(':')[0];
|
||||
const bakeFile: string = meta.getBakeFile(kind);
|
||||
await core.group(`Bake file definition (${outputName})`, async () => {
|
||||
core.info(fs.readFileSync(bakeFile, 'utf8'));
|
||||
setOutput(`bake-file-${outputName}`, bakeFile);
|
||||
});
|
||||
}
|
||||
|
||||
// Bake file with tags and labels
|
||||
setOutput(`bake-file`, `${meta.getBakeFileTagsLabels()}`);
|
||||
}
|
||||
);
|
||||
|
||||
function setOutputAndEnv(name: string, value: string) {
|
||||
core.setOutput(name, value);
|
||||
core.exportVariable(`DOCKER_METADATA_OUTPUT_${name.replace(/\W/g, '_').toUpperCase()}`, value);
|
||||
}
|
||||
|
||||
run();
|
||||
function outputEnvEnabled(): boolean {
|
||||
if (process.env.DOCKER_METADATA_SET_OUTPUT_ENV) {
|
||||
return Util.parseBool(process.env.DOCKER_METADATA_SET_OUTPUT_ENV);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
673
src/meta.ts
673
src/meta.ts
@ -1,17 +1,24 @@
|
||||
import * as handlebars from 'handlebars';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import moment from 'moment';
|
||||
import moment from 'moment-timezone';
|
||||
import * as pep440 from '@renovate/pep440';
|
||||
import * as semver from 'semver';
|
||||
import {Inputs, tmpDir} from './context';
|
||||
import * as core from '@actions/core';
|
||||
import {Context} from '@actions/github/lib/context';
|
||||
import {ReposGetResponseData} from '@octokit/types';
|
||||
import {Context as ToolkitContext} from '@docker/actions-toolkit/lib/context';
|
||||
import {GitHubRepo} from '@docker/actions-toolkit/lib/types/github';
|
||||
|
||||
import {Inputs, Context} from './context';
|
||||
import * as icl from './image';
|
||||
import * as tcl from './tag';
|
||||
import * as fcl from './flavor';
|
||||
|
||||
const defaultShortShaLength = 7;
|
||||
|
||||
export interface Version {
|
||||
main: string | undefined;
|
||||
partial: string[];
|
||||
latest: boolean;
|
||||
latest: boolean | undefined;
|
||||
}
|
||||
|
||||
export class Meta {
|
||||
@ -19,120 +26,488 @@ export class Meta {
|
||||
|
||||
private readonly inputs: Inputs;
|
||||
private readonly context: Context;
|
||||
private readonly repo: ReposGetResponseData;
|
||||
private readonly repo: GitHubRepo;
|
||||
private readonly images: icl.Image[];
|
||||
private readonly tags: tcl.Tag[];
|
||||
private readonly flavor: fcl.Flavor;
|
||||
private readonly date: Date;
|
||||
|
||||
constructor(inputs: Inputs, context: Context, repo: ReposGetResponseData) {
|
||||
constructor(inputs: Inputs, context: Context, repo: GitHubRepo) {
|
||||
this.inputs = inputs;
|
||||
if (!this.inputs.tagEdgeBranch) {
|
||||
this.inputs.tagEdgeBranch = repo.default_branch;
|
||||
}
|
||||
this.context = context;
|
||||
this.repo = repo;
|
||||
this.images = icl.Transform(inputs.images);
|
||||
this.tags = tcl.Transform(inputs.tags);
|
||||
this.flavor = fcl.Transform(inputs.flavor);
|
||||
this.date = new Date();
|
||||
this.version = this.getVersion();
|
||||
}
|
||||
|
||||
private getVersion(): Version {
|
||||
const currentDate = this.date;
|
||||
let version: Version = {
|
||||
main: undefined,
|
||||
partial: [],
|
||||
latest: false
|
||||
latest: undefined
|
||||
};
|
||||
|
||||
if (/schedule/.test(this.context.eventName)) {
|
||||
version.main = handlebars.compile(this.inputs.tagSchedule)({
|
||||
date: function (format) {
|
||||
return moment(currentDate).utc().format(format);
|
||||
}
|
||||
});
|
||||
} else if (/^refs\/tags\//.test(this.context.ref)) {
|
||||
version.main = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
||||
if (this.inputs.tagSemver.length > 0 && !semver.valid(version.main)) {
|
||||
core.warning(`${version.main} is not a valid semver. More info: https://semver.org/`);
|
||||
for (const tag of this.tags) {
|
||||
const enabled = this.setGlobalExp(tag.attrs['enable']);
|
||||
if (!['true', 'false'].includes(enabled)) {
|
||||
throw new Error(`Invalid value for enable attribute: ${enabled}`);
|
||||
}
|
||||
if (this.inputs.tagSemver.length > 0 && semver.valid(version.main)) {
|
||||
const sver = semver.parse(version.main, {
|
||||
includePrerelease: true
|
||||
});
|
||||
if (semver.prerelease(version.main)) {
|
||||
version.main = handlebars.compile('{{version}}')(sver);
|
||||
} else {
|
||||
version.latest = this.inputs.tagLatest;
|
||||
version.main = handlebars.compile(this.inputs.tagSemver[0])(sver);
|
||||
for (const semverTpl of this.inputs.tagSemver) {
|
||||
const partial = handlebars.compile(semverTpl)(sver);
|
||||
if (partial == version.main) {
|
||||
continue;
|
||||
}
|
||||
version.partial.push(partial);
|
||||
if (!/true/i.test(enabled)) {
|
||||
continue;
|
||||
}
|
||||
switch (tag.type) {
|
||||
case tcl.Type.Schedule: {
|
||||
version = this.procSchedule(version, tag);
|
||||
break;
|
||||
}
|
||||
case tcl.Type.Semver: {
|
||||
version = this.procSemver(version, tag);
|
||||
break;
|
||||
}
|
||||
case tcl.Type.Pep440: {
|
||||
version = this.procPep440(version, tag);
|
||||
break;
|
||||
}
|
||||
case tcl.Type.Match: {
|
||||
version = this.procMatch(version, tag);
|
||||
break;
|
||||
}
|
||||
case tcl.Type.Ref: {
|
||||
if (tag.attrs['event'] == tcl.RefEvent.Branch) {
|
||||
version = this.procRefBranch(version, tag);
|
||||
} else if (tag.attrs['event'] == tcl.RefEvent.Tag) {
|
||||
version = this.procRefTag(version, tag);
|
||||
} else if (tag.attrs['event'] == tcl.RefEvent.PR) {
|
||||
version = this.procRefPr(version, tag);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (this.inputs.tagMatch) {
|
||||
let tagMatch;
|
||||
const isRegEx = this.inputs.tagMatch.match(/^\/(.+)\/(.*)$/);
|
||||
if (isRegEx) {
|
||||
tagMatch = version.main.match(new RegExp(isRegEx[1], isRegEx[2]));
|
||||
} else {
|
||||
tagMatch = version.main.match(this.inputs.tagMatch);
|
||||
case tcl.Type.Edge: {
|
||||
version = this.procEdge(version, tag);
|
||||
break;
|
||||
}
|
||||
if (tagMatch) {
|
||||
version.main = tagMatch[this.inputs.tagMatchGroup];
|
||||
version.latest = this.inputs.tagLatest;
|
||||
case tcl.Type.Raw: {
|
||||
version = this.procRaw(version, tag);
|
||||
break;
|
||||
}
|
||||
case tcl.Type.Sha: {
|
||||
version = this.procSha(version, tag);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
version.latest = this.inputs.tagLatest;
|
||||
}
|
||||
} else if (/^refs\/heads\//.test(this.context.ref)) {
|
||||
version.main = this.context.ref.replace(/^refs\/heads\//g, '').replace(/[^a-zA-Z0-9._-]+/g, '-');
|
||||
if (this.inputs.tagEdge && this.inputs.tagEdgeBranch === version.main) {
|
||||
version.main = 'edge';
|
||||
}
|
||||
} else if (/^refs\/pull\//.test(this.context.ref)) {
|
||||
version.main = `pr-${this.context.ref.replace(/^refs\/pull\//g, '').replace(/\/merge$/g, '')}`;
|
||||
}
|
||||
|
||||
if (this.inputs.tagCustom.length > 0) {
|
||||
if (this.inputs.tagCustomOnly) {
|
||||
version = {
|
||||
main: this.inputs.tagCustom.shift(),
|
||||
partial: this.inputs.tagCustom,
|
||||
latest: false
|
||||
};
|
||||
} else {
|
||||
version.partial.push(...this.inputs.tagCustom);
|
||||
}
|
||||
}
|
||||
|
||||
version.partial = version.partial.filter((item, index) => version.partial.indexOf(item) === index);
|
||||
if (version.latest == undefined) {
|
||||
version.latest = false;
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
public tags(): Array<string> {
|
||||
private procSchedule(version: Version, tag: tcl.Tag): Version {
|
||||
if (!/schedule/.test(this.context.eventName)) {
|
||||
return version;
|
||||
}
|
||||
|
||||
const currentDate = this.date;
|
||||
const commitDate = this.context.commitDate;
|
||||
const vraw = this.setValue(
|
||||
handlebars.compile(tag.attrs['pattern'])({
|
||||
date: function (format, options) {
|
||||
const m = moment(currentDate);
|
||||
let tz = 'UTC';
|
||||
Object.keys(options.hash).forEach(key => {
|
||||
switch (key) {
|
||||
case 'tz':
|
||||
tz = options.hash[key];
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown ${key} attribute`);
|
||||
}
|
||||
});
|
||||
return m.tz(tz).format(format);
|
||||
},
|
||||
commit_date: function (format, options) {
|
||||
const m = moment(commitDate);
|
||||
let tz = 'UTC';
|
||||
Object.keys(options.hash).forEach(key => {
|
||||
switch (key) {
|
||||
case 'tz':
|
||||
tz = options.hash[key];
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown ${key} attribute`);
|
||||
}
|
||||
});
|
||||
return m.tz(tz).format(format);
|
||||
}
|
||||
}),
|
||||
tag
|
||||
);
|
||||
|
||||
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
||||
}
|
||||
|
||||
private procSemver(version: Version, tag: tcl.Tag): Version {
|
||||
if (!/^refs\/tags\//.test(this.context.ref) && tag.attrs['value'].length == 0) {
|
||||
return version;
|
||||
}
|
||||
|
||||
let vraw: string;
|
||||
if (tag.attrs['value'].length > 0) {
|
||||
vraw = this.setGlobalExp(tag.attrs['value']);
|
||||
} else {
|
||||
vraw = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
||||
}
|
||||
if (!semver.valid(vraw)) {
|
||||
core.warning(`${vraw} is not a valid semver. More info: https://semver.org/`);
|
||||
return version;
|
||||
}
|
||||
|
||||
let latest = false;
|
||||
const sver = semver.parse(vraw, {
|
||||
loose: true
|
||||
});
|
||||
if (semver.prerelease(vraw)) {
|
||||
if (Meta.isRawStatement(tag.attrs['pattern'])) {
|
||||
vraw = this.setValue(handlebars.compile(tag.attrs['pattern'])(sver), tag);
|
||||
} else {
|
||||
vraw = this.setValue(handlebars.compile('{{version}}')(sver), tag);
|
||||
}
|
||||
} else {
|
||||
vraw = this.setValue(handlebars.compile(tag.attrs['pattern'])(sver), tag);
|
||||
latest = true;
|
||||
}
|
||||
|
||||
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? latest : this.flavor.latest == 'true');
|
||||
}
|
||||
|
||||
private procPep440(version: Version, tag: tcl.Tag): Version {
|
||||
if (!/^refs\/tags\//.test(this.context.ref) && tag.attrs['value'].length == 0) {
|
||||
return version;
|
||||
}
|
||||
|
||||
let vraw: string;
|
||||
if (tag.attrs['value'].length > 0) {
|
||||
vraw = this.setGlobalExp(tag.attrs['value']);
|
||||
} else {
|
||||
vraw = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
||||
}
|
||||
if (!pep440.valid(vraw)) {
|
||||
core.warning(`${vraw} does not conform to PEP 440. More info: https://www.python.org/dev/peps/pep-0440`);
|
||||
return version;
|
||||
}
|
||||
|
||||
let latest = false;
|
||||
const pver = pep440.explain(vraw);
|
||||
if (pver.is_prerelease || pver.is_postrelease || pver.is_devrelease) {
|
||||
if (Meta.isRawStatement(tag.attrs['pattern'])) {
|
||||
vraw = this.setValue(vraw, tag);
|
||||
} else {
|
||||
vraw = this.setValue(pep440.clean(vraw), tag);
|
||||
}
|
||||
} else {
|
||||
vraw = this.setValue(
|
||||
handlebars.compile(tag.attrs['pattern'])({
|
||||
raw: function () {
|
||||
return vraw;
|
||||
},
|
||||
version: function () {
|
||||
return pep440.clean(vraw);
|
||||
},
|
||||
major: function () {
|
||||
return pep440.major(vraw);
|
||||
},
|
||||
minor: function () {
|
||||
return pep440.minor(vraw);
|
||||
},
|
||||
patch: function () {
|
||||
return pep440.patch(vraw);
|
||||
}
|
||||
}),
|
||||
tag
|
||||
);
|
||||
latest = true;
|
||||
}
|
||||
|
||||
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? latest : this.flavor.latest == 'true');
|
||||
}
|
||||
|
||||
private procMatch(version: Version, tag: tcl.Tag): Version {
|
||||
if (!/^refs\/tags\//.test(this.context.ref) && tag.attrs['value'].length == 0) {
|
||||
return version;
|
||||
}
|
||||
|
||||
let vraw: string;
|
||||
if (tag.attrs['value'].length > 0) {
|
||||
vraw = this.setGlobalExp(tag.attrs['value']);
|
||||
} else {
|
||||
vraw = this.context.ref.replace(/^refs\/tags\//g, '');
|
||||
}
|
||||
|
||||
let tmatch;
|
||||
const isRegEx = tag.attrs['pattern'].match(/^\/(.+)\/(.*)$/);
|
||||
if (isRegEx) {
|
||||
tmatch = vraw.match(new RegExp(isRegEx[1], isRegEx[2]));
|
||||
} else {
|
||||
tmatch = vraw.match(tag.attrs['pattern']);
|
||||
}
|
||||
if (!tmatch) {
|
||||
core.warning(`${tag.attrs['pattern']} does not match ${vraw}.`);
|
||||
return version;
|
||||
}
|
||||
if (typeof tmatch[tag.attrs['group']] === 'undefined') {
|
||||
core.warning(`Group ${tag.attrs['group']} does not exist for ${tag.attrs['pattern']} pattern.`);
|
||||
return version;
|
||||
}
|
||||
|
||||
vraw = this.setValue(tmatch[tag.attrs['group']], tag);
|
||||
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? true : this.flavor.latest == 'true');
|
||||
}
|
||||
|
||||
private procRefBranch(version: Version, tag: tcl.Tag): Version {
|
||||
if (!/^refs\/heads\//.test(this.context.ref)) {
|
||||
return version;
|
||||
}
|
||||
const vraw = this.setValue(this.context.ref.replace(/^refs\/heads\//g, ''), tag);
|
||||
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
||||
}
|
||||
|
||||
private procRefTag(version: Version, tag: tcl.Tag): Version {
|
||||
if (!/^refs\/tags\//.test(this.context.ref)) {
|
||||
return version;
|
||||
}
|
||||
const vraw = this.setValue(this.context.ref.replace(/^refs\/tags\//g, ''), tag);
|
||||
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? true : this.flavor.latest == 'true');
|
||||
}
|
||||
|
||||
private procRefPr(version: Version, tag: tcl.Tag): Version {
|
||||
if (!/^refs\/pull\//.test(this.context.ref)) {
|
||||
return version;
|
||||
}
|
||||
|
||||
const vraw = this.setValue(this.context.ref.replace(/^refs\/pull\//g, '').replace(/\/merge$/g, ''), tag);
|
||||
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
||||
}
|
||||
|
||||
private procEdge(version: Version, tag: tcl.Tag): Version {
|
||||
if (!/^refs\/heads\//.test(this.context.ref)) {
|
||||
return version;
|
||||
}
|
||||
|
||||
const val = this.context.ref.replace(/^refs\/heads\//g, '');
|
||||
if (tag.attrs['branch'].length == 0) {
|
||||
tag.attrs['branch'] = this.repo.default_branch;
|
||||
}
|
||||
if (tag.attrs['branch'] != val) {
|
||||
return version;
|
||||
}
|
||||
|
||||
const vraw = this.setValue('edge', tag);
|
||||
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
||||
}
|
||||
|
||||
private procRaw(version: Version, tag: tcl.Tag): Version {
|
||||
const vraw = this.setValue(this.setGlobalExp(tag.attrs['value']), tag);
|
||||
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
||||
}
|
||||
|
||||
private procSha(version: Version, tag: tcl.Tag): Version {
|
||||
if (!this.context.sha) {
|
||||
return version;
|
||||
}
|
||||
|
||||
let val = this.context.sha;
|
||||
if (tag.attrs['format'] === tcl.ShaFormat.Short) {
|
||||
val = Meta.shortSha(this.context.sha);
|
||||
}
|
||||
|
||||
const vraw = this.setValue(val, tag);
|
||||
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
||||
}
|
||||
|
||||
private static setVersion(version: Version, val: string, latest: boolean): Version {
|
||||
if (val.length == 0) {
|
||||
return version;
|
||||
}
|
||||
val = Meta.sanitizeTag(val);
|
||||
if (version.main == undefined) {
|
||||
version.main = val;
|
||||
} else if (val !== version.main) {
|
||||
version.partial.push(val);
|
||||
}
|
||||
if (version.latest == undefined) {
|
||||
version.latest = latest;
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
public static isRawStatement(pattern: string): boolean {
|
||||
try {
|
||||
const hp = handlebars.parseWithoutProcessing(pattern);
|
||||
if (hp.body.length == 1 && hp.body[0].type == 'MustacheStatement') {
|
||||
return hp.body[0]['path']['parts'].length == 1 && hp.body[0]['path']['parts'][0] == 'raw';
|
||||
}
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private setValue(val: string, tag: tcl.Tag): string {
|
||||
if (Object.prototype.hasOwnProperty.call(tag.attrs, 'prefix')) {
|
||||
val = `${this.setGlobalExp(tag.attrs['prefix'])}${val}`;
|
||||
} else if (this.flavor.prefix.length > 0) {
|
||||
val = `${this.setGlobalExp(this.flavor.prefix)}${val}`;
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(tag.attrs, 'suffix')) {
|
||||
val = `${val}${this.setGlobalExp(tag.attrs['suffix'])}`;
|
||||
} else if (this.flavor.suffix.length > 0) {
|
||||
val = `${val}${this.setGlobalExp(this.flavor.suffix)}`;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
private setGlobalExp(val: string): string {
|
||||
const context = this.context;
|
||||
const currentDate = this.date;
|
||||
const commitDate = this.context.commitDate;
|
||||
return handlebars.compile(val)({
|
||||
branch: function () {
|
||||
if (!/^refs\/heads\//.test(context.ref)) {
|
||||
return '';
|
||||
}
|
||||
return context.ref.replace(/^refs\/heads\//g, '');
|
||||
},
|
||||
tag: function () {
|
||||
if (!/^refs\/tags\//.test(context.ref)) {
|
||||
return '';
|
||||
}
|
||||
return context.ref.replace(/^refs\/tags\//g, '');
|
||||
},
|
||||
sha: function () {
|
||||
return Meta.shortSha(context.sha);
|
||||
},
|
||||
base_ref: function () {
|
||||
if (/^refs\/tags\//.test(context.ref) && context.payload?.base_ref != undefined) {
|
||||
return context.payload.base_ref.replace(/^refs\/heads\//g, '');
|
||||
}
|
||||
// FIXME: keep this for backward compatibility even if doesn't always seem
|
||||
// to return the expected branch. See the comment below.
|
||||
if (/^refs\/pull\//.test(context.ref) && context.payload?.pull_request?.base?.ref != undefined) {
|
||||
return context.payload.pull_request.base.ref;
|
||||
}
|
||||
return '';
|
||||
},
|
||||
commit_date: function (format, options) {
|
||||
const m = moment(commitDate);
|
||||
let tz = 'UTC';
|
||||
Object.keys(options.hash).forEach(key => {
|
||||
switch (key) {
|
||||
case 'tz':
|
||||
tz = options.hash[key];
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown ${key} attribute`);
|
||||
}
|
||||
});
|
||||
return m.tz(tz).format(format);
|
||||
},
|
||||
is_default_branch: function () {
|
||||
const branch = context.ref.replace(/^refs\/heads\//g, '');
|
||||
// TODO: "base_ref" is available in the push payload but doesn't always seem to
|
||||
// return the expected branch when the push tag event occurs. It's also not
|
||||
// documented in GitHub docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push
|
||||
// more context: https://github.com/docker/metadata-action/pull/192#discussion_r854673012
|
||||
// if (/^refs\/tags\//.test(context.ref) && context.payload?.base_ref != undefined) {
|
||||
// branch = context.payload.base_ref.replace(/^refs\/heads\//g, '');
|
||||
// }
|
||||
if (branch == undefined || branch.length == 0) {
|
||||
return 'false';
|
||||
}
|
||||
if (context.payload?.repository?.default_branch == branch) {
|
||||
return 'true';
|
||||
}
|
||||
// following events always trigger for last commit on default branch
|
||||
// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
|
||||
if (/create/.test(context.eventName) || /discussion/.test(context.eventName) || /issues/.test(context.eventName) || /schedule/.test(context.eventName)) {
|
||||
return 'true';
|
||||
}
|
||||
return 'false';
|
||||
},
|
||||
date: function (format, options) {
|
||||
const m = moment(currentDate);
|
||||
let tz = 'UTC';
|
||||
Object.keys(options.hash).forEach(key => {
|
||||
switch (key) {
|
||||
case 'tz':
|
||||
tz = options.hash[key];
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown ${key} attribute`);
|
||||
}
|
||||
});
|
||||
return m.tz(tz).format(format);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private getImageNames(): Array<string> {
|
||||
const images: Array<string> = [];
|
||||
for (const image of this.images) {
|
||||
if (!image.enable) {
|
||||
continue;
|
||||
}
|
||||
images.push(Meta.sanitizeImageName(image.name));
|
||||
}
|
||||
return images;
|
||||
}
|
||||
|
||||
public getTags(): Array<string> {
|
||||
if (!this.version.main) {
|
||||
return [];
|
||||
}
|
||||
|
||||
let tags: Array<string> = [];
|
||||
for (const image of this.inputs.images) {
|
||||
const imageLc = image.toLowerCase();
|
||||
tags.push(`${imageLc}:${this.version.main}`);
|
||||
const generateTags = (imageName: string, version: string): Array<string> => {
|
||||
const tags: Array<string> = [];
|
||||
const prefix = imageName !== '' ? `${imageName}:` : '';
|
||||
tags.push(`${prefix}${version}`);
|
||||
for (const partial of this.version.partial) {
|
||||
tags.push(`${imageLc}:${partial}`);
|
||||
tags.push(`${prefix}${partial}`);
|
||||
}
|
||||
if (this.version.latest) {
|
||||
tags.push(`${imageLc}:latest`);
|
||||
const latestTag = `${this.flavor.prefixLatest ? this.flavor.prefix : ''}latest${this.flavor.suffixLatest ? this.flavor.suffix : ''}`;
|
||||
tags.push(`${prefix}${Meta.sanitizeTag(latestTag)}`);
|
||||
}
|
||||
if (this.context.sha && this.inputs.tagSha) {
|
||||
tags.push(`${imageLc}:sha-${this.context.sha.substr(0, 7)}`);
|
||||
return tags;
|
||||
};
|
||||
|
||||
const tags: Array<string> = [];
|
||||
const images = this.getImageNames();
|
||||
if (images.length > 0) {
|
||||
for (const imageName of images) {
|
||||
tags.push(...generateTags(imageName, this.version.main));
|
||||
}
|
||||
} else {
|
||||
tags.push(...generateTags('', this.version.main));
|
||||
}
|
||||
return tags;
|
||||
}
|
||||
|
||||
public labels(): Array<string> {
|
||||
let labels: Array<string> = [
|
||||
public getLabels(): Array<string> {
|
||||
return this.getOCIAnnotationsWithCustoms(this.inputs.labels);
|
||||
}
|
||||
|
||||
public getAnnotations(): Array<string> {
|
||||
return this.getOCIAnnotationsWithCustoms(this.inputs.annotations);
|
||||
}
|
||||
|
||||
private getOCIAnnotationsWithCustoms(extra: string[]): Array<string> {
|
||||
const res: Array<string> = [
|
||||
`org.opencontainers.image.title=${this.repo.name || ''}`,
|
||||
`org.opencontainers.image.description=${this.repo.description || ''}`,
|
||||
`org.opencontainers.image.url=${this.repo.html_url || ''}`,
|
||||
@ -142,41 +517,127 @@ export class Meta {
|
||||
`org.opencontainers.image.revision=${this.context.sha || ''}`,
|
||||
`org.opencontainers.image.licenses=${this.repo.license?.spdx_id || ''}`
|
||||
];
|
||||
labels.push(...this.inputs.labelCustom);
|
||||
return labels;
|
||||
extra.forEach(label => {
|
||||
res.push(this.setGlobalExp(label));
|
||||
});
|
||||
|
||||
return Array.from(
|
||||
new Map<string, string>(
|
||||
res
|
||||
.map(label => label.split('='))
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
.filter(([_key, ...values]) => values.length > 0)
|
||||
.map(([key, ...values]) => [key, values.join('=')] as [string, string])
|
||||
)
|
||||
)
|
||||
.sort((a, b) => a[0].localeCompare(b[0]))
|
||||
.map(([key, value]) => `${key}=${value}`);
|
||||
}
|
||||
|
||||
public bakeFile(): string {
|
||||
let jsonLabels = {};
|
||||
for (let label of this.labels()) {
|
||||
const matches = label.match(/([^=]*)=(.*)/);
|
||||
if (!matches) {
|
||||
continue;
|
||||
}
|
||||
jsonLabels[matches[1]] = matches[2];
|
||||
public getJSON(alevels: string[]): unknown {
|
||||
const annotations: Array<string> = [];
|
||||
for (const level of alevels) {
|
||||
annotations.push(...this.getAnnotations().map(label => `${level}:${label}`));
|
||||
}
|
||||
return {
|
||||
tags: this.getTags(),
|
||||
labels: this.getLabels().reduce((res, label) => {
|
||||
const matches = label.match(/([^=]*)=(.*)/);
|
||||
if (!matches) {
|
||||
return res;
|
||||
}
|
||||
res[matches[1]] = matches[2];
|
||||
return res;
|
||||
}, {}),
|
||||
annotations: annotations
|
||||
};
|
||||
}
|
||||
|
||||
const bakeFile = path.join(tmpDir(), 'ghaction-docker-meta-bake.json').split(path.sep).join(path.posix.sep);
|
||||
fs.writeFileSync(
|
||||
bakeFile,
|
||||
JSON.stringify(
|
||||
public getBakeFile(kind: string): string {
|
||||
if (kind == 'tags') {
|
||||
return this.generateBakeFile(
|
||||
{
|
||||
target: {
|
||||
'ghaction-docker-meta': {
|
||||
tags: this.tags(),
|
||||
labels: jsonLabels,
|
||||
args: {
|
||||
DOCKER_META_IMAGES: this.inputs.images.join(','),
|
||||
DOCKER_META_VERSION: this.version.main
|
||||
}
|
||||
}
|
||||
tags: this.getTags(),
|
||||
args: {
|
||||
DOCKER_META_IMAGES: this.getImageNames().join(','),
|
||||
DOCKER_META_VERSION: this.version.main
|
||||
}
|
||||
},
|
||||
null,
|
||||
2
|
||||
)
|
||||
);
|
||||
kind
|
||||
);
|
||||
} else if (kind == 'labels') {
|
||||
return this.generateBakeFile(
|
||||
{
|
||||
labels: this.getLabels().reduce((res, label) => {
|
||||
const matches = label.match(/([^=]*)=(.*)/);
|
||||
if (!matches) {
|
||||
return res;
|
||||
}
|
||||
res[matches[1]] = matches[2];
|
||||
return res;
|
||||
}, {})
|
||||
},
|
||||
kind
|
||||
);
|
||||
} else if (kind.startsWith('annotations:')) {
|
||||
const name = kind.split(':')[0];
|
||||
const annotations: Array<string> = [];
|
||||
for (const level of kind.split(':')[1].split(',')) {
|
||||
annotations.push(...this.getAnnotations().map(label => `${level}:${label}`));
|
||||
}
|
||||
return this.generateBakeFile(
|
||||
{
|
||||
annotations: annotations
|
||||
},
|
||||
name
|
||||
);
|
||||
}
|
||||
throw new Error(`Unknown bake file type: ${kind}`);
|
||||
}
|
||||
|
||||
public getBakeFileTagsLabels(): string {
|
||||
return this.generateBakeFile({
|
||||
tags: this.getTags(),
|
||||
labels: this.getLabels().reduce((res, label) => {
|
||||
const matches = label.match(/([^=]*)=(.*)/);
|
||||
if (!matches) {
|
||||
return res;
|
||||
}
|
||||
res[matches[1]] = matches[2];
|
||||
return res;
|
||||
}, {}),
|
||||
args: {
|
||||
DOCKER_META_IMAGES: this.getImageNames().join(','),
|
||||
DOCKER_META_VERSION: this.version.main
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private generateBakeFile(dt, suffix?: string): string {
|
||||
const bakeFile = path.join(ToolkitContext.tmpDir(), `docker-metadata-action-bake${suffix ? `-${suffix}` : ''}.json`);
|
||||
fs.writeFileSync(bakeFile, JSON.stringify({target: {[this.inputs.bakeTarget]: dt}}, null, 2));
|
||||
return bakeFile;
|
||||
}
|
||||
|
||||
private static sanitizeImageName(name: string): string {
|
||||
return name.toLowerCase();
|
||||
}
|
||||
|
||||
private static sanitizeTag(tag: string): string {
|
||||
return tag.replace(/[^a-zA-Z0-9._-]+/g, '-');
|
||||
}
|
||||
|
||||
private static shortSha(sha: string): string {
|
||||
let shortShaLength = defaultShortShaLength;
|
||||
if (process.env.DOCKER_METADATA_SHORT_SHA_LENGTH) {
|
||||
if (isNaN(Number(process.env.DOCKER_METADATA_SHORT_SHA_LENGTH))) {
|
||||
throw new Error(`DOCKER_METADATA_SHORT_SHA_LENGTH is not a valid number: ${process.env.DOCKER_METADATA_SHORT_SHA_LENGTH}`);
|
||||
}
|
||||
shortShaLength = Number(process.env.DOCKER_METADATA_SHORT_SHA_LENGTH);
|
||||
}
|
||||
if (shortShaLength >= sha.length) {
|
||||
return sha;
|
||||
}
|
||||
return sha.substring(0, shortShaLength);
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user