Compare commits
139 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
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 | ||
|
9ae6899cfa | ||
|
db66d4df79 | ||
|
b500d9c7b5 | ||
|
aa3823e012 | ||
|
a4739af83c | ||
|
10e9d5d585 | ||
|
3479bd5aaa | ||
|
c48ac80f46 | ||
|
805449f25e | ||
|
55d3462f05 | ||
|
7040b59aa5 | ||
|
3ae5afe041 | ||
|
b747b8aaa7 | ||
|
585ab8356c | ||
|
9de4428611 | ||
|
4c2760ba7a | ||
|
ef12c77b87 | ||
|
c53f88523a | ||
|
6b4bf4724e | ||
|
d48c7d2917 | ||
|
7cb65aaacb |
@@ -1 +1,2 @@
|
|||||||
node_modules
|
/coverage
|
||||||
|
/node_modules
|
||||||
|
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -1,2 +1,3 @@
|
|||||||
|
/__tests__/fixtures/** -linguist-detectable
|
||||||
/dist/** linguist-generated=true
|
/dist/** linguist-generated=true
|
||||||
/lib/** linguist-generated=true
|
/lib/** linguist-generated=true
|
||||||
|
37
.github/CONTRIBUTING.md
vendored
37
.github/CONTRIBUTING.md
vendored
@@ -2,33 +2,20 @@
|
|||||||
|
|
||||||
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
|
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) to the public under the [project's open source license](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
|
## 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`
|
2. Configure and install the dependencies: `yarn install`
|
||||||
3. Make sure the tests pass on your machine: `yarn run test`
|
3. Create a new branch: `git checkout -b my-branch-name`
|
||||||
4. Create a new branch: `git checkout -b my-branch-name`
|
4. Make your changes
|
||||||
5. Make your change, add tests, and make sure the tests still pass
|
5. Make sure the tests pass: `docker buildx bake test`
|
||||||
6. Run pre-checkin: `yarn run pre-checkin`
|
6. Format code and build javascript artifacts: `docker buildx bake pre-checkin`
|
||||||
7. Push to your fork and [submit a pull request](https://github.com/crazy-max/ghaction-docker-meta/compare)
|
7. Validate all code has correctly formatted and built: `docker buildx bake validate`
|
||||||
8. Pat your self on the back and wait for your pull request to be reviewed and merged.
|
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.
|
||||||
## Container based developer flow
|
|
||||||
|
|
||||||
If you don't want to maintain a Node developer environment that fits this project you can use containerized commands instead of invoking yarn directly.
|
|
||||||
|
|
||||||
```
|
|
||||||
# format code and build javascript artifacts
|
|
||||||
docker buildx bake pre-checkin
|
|
||||||
|
|
||||||
# validate all code has correctly formatted and built
|
|
||||||
docker buildx bake validate
|
|
||||||
|
|
||||||
# run tests
|
|
||||||
docker buildx bake test
|
|
||||||
```
|
|
||||||
|
|
||||||
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
|
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
|
||||||
|
|
||||||
@@ -41,5 +28,5 @@ Here are a few things you can do that will increase the likelihood of your pull
|
|||||||
## Resources
|
## Resources
|
||||||
|
|
||||||
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
|
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
|
||||||
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
|
- [Using Pull Requests](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests)
|
||||||
- [GitHub Help](https://help.github.com)
|
- [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
|
|
7
.github/ISSUE_TEMPLATE/bug_report.md
vendored
7
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -13,11 +13,11 @@ about: Create a report to help us improve
|
|||||||
|
|
||||||
#### Expected behaviour
|
#### Expected behaviour
|
||||||
|
|
||||||
> Tell me what should happen
|
> Tell us what should happen
|
||||||
|
|
||||||
#### Actual behaviour
|
#### Actual behaviour
|
||||||
|
|
||||||
> Tell me what happens instead
|
> Tell us what happens instead
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
@@ -30,4 +30,5 @@ about: Create a report to help us improve
|
|||||||
|
|
||||||
### Logs
|
### 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.
|
> Download the [log file of your build](https://docs.github.com/en/actions/managing-workflow-runs/using-workflow-run-logs#downloading-logs)
|
||||||
|
> and [attach it](https://docs.github.com/en/github/managing-your-work-on-github/file-attachments-on-issues-and-pull-requests) to this issue.
|
||||||
|
13
.github/SUPPORT.md
vendored
13
.github/SUPPORT.md
vendored
@@ -1,10 +1,13 @@
|
|||||||
# Support [](https://isitmaintained.com/project/crazy-max/ghaction-docker-meta)
|
# Support [](https://isitmaintained.com/project/docker/metadata-action)
|
||||||
|
|
||||||
## Reporting an issue
|
## 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.
|
Please do a search in [open issues](https://github.com/docker/metadata-action/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.
|
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: - upvote
|
||||||
|
|
||||||
@@ -21,9 +24,9 @@ File a single issue per problem and feature request.
|
|||||||
|
|
||||||
The more information you can provide, the more likely someone will be successful reproducing the issue and finding a fix.
|
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)!
|
You are now ready to [create a new issue](https://github.com/docker/metadata-action/issues/new/choose)!
|
||||||
|
|
||||||
## Closure policy
|
## 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 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.
|
* Issues that go a week without a response from original poster are subject to closure at our discretion.
|
||||||
|
12
.github/dependabot.yml
vendored
12
.github/dependabot.yml
vendored
@@ -4,19 +4,15 @@ updates:
|
|||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
time: "06:00"
|
|
||||||
timezone: "Europe/Paris"
|
|
||||||
labels:
|
labels:
|
||||||
- ":game_die: dependencies"
|
- "dependencies"
|
||||||
- ":robot: bot"
|
- "bot"
|
||||||
- package-ecosystem: "npm"
|
- package-ecosystem: "npm"
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
time: "06:00"
|
|
||||||
timezone: "Europe/Paris"
|
|
||||||
allow:
|
allow:
|
||||||
- dependency-type: "production"
|
- dependency-type: "production"
|
||||||
labels:
|
labels:
|
||||||
- ":game_die: dependencies"
|
- "dependencies"
|
||||||
- ":robot: bot"
|
- "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
|
|
173
.github/workflows/ci.yml
vendored
173
.github/workflows/ci.yml
vendored
@@ -5,10 +5,14 @@ on:
|
|||||||
- cron: '0 */4 * * *' # every 4 hours
|
- cron: '0 */4 * * *' # every 4 hours
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- '**'
|
- 'master'
|
||||||
|
- 'releases/v*'
|
||||||
tags:
|
tags:
|
||||||
- 'v*.*.*'
|
- 'v*.*.*'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
- 'releases/v*'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOCKER_IMAGE: localhost:5000/name/app
|
DOCKER_IMAGE: localhost:5000/name/app
|
||||||
@@ -27,7 +31,12 @@ jobs:
|
|||||||
images: |
|
images: |
|
||||||
${{ env.DOCKER_IMAGE }}
|
${{ env.DOCKER_IMAGE }}
|
||||||
ghcr.io/name/app
|
ghcr.io/name/app
|
||||||
tag-sha: true
|
tags: |
|
||||||
|
type=schedule
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
type=ref,event=pr
|
||||||
|
type=sha
|
||||||
|
|
||||||
tag-schedule:
|
tag-schedule:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -50,8 +59,12 @@ jobs:
|
|||||||
images: |
|
images: |
|
||||||
${{ env.DOCKER_IMAGE }}
|
${{ env.DOCKER_IMAGE }}
|
||||||
ghcr.io/name/app
|
ghcr.io/name/app
|
||||||
tag-sha: true
|
tags: |
|
||||||
tag-schedule: ${{ matrix.tag-schedule }}
|
type=schedule,pattern=${{ matrix.tag-schedule }}
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
type=ref,event=pr
|
||||||
|
type=sha
|
||||||
|
|
||||||
tag-match:
|
tag-match:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -59,9 +72,9 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- tag-match: '\d{1,3}.\d{1,3}.\d{1,3}'
|
- tag-match: '\d.\d.\d'
|
||||||
tag-match-group: '0'
|
tag-match-group: '0'
|
||||||
- tag-match: '\d{1,3}.\d{1,3}'
|
- tag-match: '\d.\d'
|
||||||
tag-match-group: '0'
|
tag-match-group: '0'
|
||||||
- tag-match: 'v(.*)'
|
- tag-match: 'v(.*)'
|
||||||
tag-match-group: '1'
|
tag-match-group: '1'
|
||||||
@@ -76,25 +89,105 @@ jobs:
|
|||||||
images: |
|
images: |
|
||||||
${{ env.DOCKER_IMAGE }}
|
${{ env.DOCKER_IMAGE }}
|
||||||
ghcr.io/name/app
|
ghcr.io/name/app
|
||||||
tag-sha: true
|
tags: |
|
||||||
tag-match: ${{ matrix.tag-match }}
|
type=schedule
|
||||||
tag-match-group: ${{ matrix.tag-match-group }}
|
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:
|
tag-semver:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
flavor-latest:
|
||||||
|
- "auto"
|
||||||
|
- "true"
|
||||||
|
- "false"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
-
|
||||||
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Docker meta
|
-
|
||||||
|
name: Docker meta
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
${{ env.DOCKER_IMAGE }}
|
${{ env.DOCKER_IMAGE }}
|
||||||
ghcr.io/name/app
|
ghcr.io/name/app
|
||||||
tag-semver: |
|
tags: |
|
||||||
{{raw}}
|
type=schedule
|
||||||
{{version}}
|
type=ref,event=branch
|
||||||
{{major}}.{{minor}}.{{patch}}
|
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 }}
|
||||||
|
|
||||||
|
flavor:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
${{ env.DOCKER_IMAGE }}
|
||||||
|
ghcr.io/name/app
|
||||||
|
flavor: |
|
||||||
|
prefix=foo-
|
||||||
|
suffix=-bar
|
||||||
|
|
||||||
|
labels:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
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=this is a "good" example
|
||||||
|
org.opencontainers.image.vendor=MyCompany
|
||||||
|
|
||||||
|
json:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
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:
|
docker-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -113,8 +206,15 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
images: ${{ env.DOCKER_IMAGE }}
|
images: ${{ env.DOCKER_IMAGE }}
|
||||||
tag-sha: true
|
tags: |
|
||||||
tag-match: '\d{1,3}.\d{1,3}.\d{1,3}'
|
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: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
@@ -146,3 +246,42 @@ jobs:
|
|||||||
name: Dump context
|
name: Dump context
|
||||||
if: always()
|
if: always()
|
||||||
uses: crazy-max/ghaction-dump-context@v1
|
uses: crazy-max/ghaction-dump-context@v1
|
||||||
|
|
||||||
|
bake:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
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
|
||||||
|
-
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: docker/bake-action@v1
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
./test/docker-bake.hcl
|
||||||
|
${{ steps.docker_meta.outputs.bake-file }}
|
||||||
|
targets: |
|
||||||
|
release
|
||||||
|
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
|
|
34
.github/workflows/test.yml
vendored
34
.github/workflows/test.yml
vendored
@@ -5,26 +5,12 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- 'master'
|
- 'master'
|
||||||
- 'releases/v*'
|
- 'releases/v*'
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
pull_request:
|
pull_request:
|
||||||
paths-ignore:
|
branches:
|
||||||
- '**.md'
|
- 'master'
|
||||||
|
- 'releases/v*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-containerized:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
-
|
|
||||||
name: Validate
|
|
||||||
run: docker buildx bake validate
|
|
||||||
-
|
|
||||||
name: Test
|
|
||||||
run: docker buildx bake test
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -32,15 +18,17 @@ jobs:
|
|||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Install
|
name: Validate
|
||||||
run: yarn install
|
uses: docker/bake-action@v1
|
||||||
|
with:
|
||||||
|
targets: validate
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
run: yarn run test
|
uses: docker/bake-action@v1
|
||||||
|
with:
|
||||||
|
targets: test
|
||||||
-
|
-
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v1
|
uses: codecov/codecov-action@v2
|
||||||
if: success()
|
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
file: ./coverage/clover.xml
|
file: ./coverage/clover.xml
|
||||||
|
52
CHANGELOG.md
52
CHANGELOG.md
@@ -1,52 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
## 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
|
|
42
Dockerfile
42
Dockerfile
@@ -1,42 +0,0 @@
|
|||||||
#syntax=docker/dockerfile:1.1-experimental
|
|
||||||
|
|
||||||
FROM node:12 AS deps
|
|
||||||
WORKDIR /src
|
|
||||||
COPY package.json yarn.lock ./
|
|
||||||
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn \
|
|
||||||
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 yarn build
|
|
||||||
|
|
||||||
FROM deps AS test
|
|
||||||
COPY . .
|
|
||||||
RUN yarn run test
|
|
||||||
|
|
||||||
FROM base AS run-format
|
|
||||||
RUN yarn run format
|
|
||||||
|
|
||||||
FROM scratch AS format
|
|
||||||
COPY --from=run-format /src/src/*.ts /src/
|
|
||||||
|
|
||||||
FROM base AS validate-format
|
|
||||||
RUN 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
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
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:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
1. Definitions.
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
the copyright owner that is granting the License.
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
"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.
|
||||||
|
696
README.md
696
README.md
@@ -1,67 +1,58 @@
|
|||||||
[](https://github.com/crazy-max/ghaction-docker-meta/releases/latest)
|
[](https://github.com/docker/metadata-action/releases/latest)
|
||||||
[](https://github.com/marketplace/actions/docker-meta)
|
[](https://github.com/marketplace/actions/docker-metadata-action)
|
||||||
[](https://github.com/crazy-max/ghaction-docker-meta/actions?workflow=test)
|
[](https://github.com/docker/metadata-action/actions?workflow=test)
|
||||||
[](https://codecov.io/gh/crazy-max/ghaction-docker-meta)
|
[](https://codecov.io/gh/docker/metadata-action)
|
||||||
[](https://github.com/sponsors/crazy-max)
|
|
||||||
[](https://www.paypal.me/crazyws)
|
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
GitHub Action to extract metadata (tags, labels) for Docker. This action is particularly useful if used with
|
GitHub Action to extract metadata from Git reference and GitHub events.
|
||||||
[Docker Build Push](https://github.com/docker/build-push-action) action.
|
This action is particularly useful if used with [Docker Build Push](https://github.com/docker/build-push-action) action to tag and label Docker images.
|
||||||
|
|
||||||
If you are interested, [check out](https://git.io/Je09Y) my other :octocat: GitHub Actions!
|

|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
___
|
___
|
||||||
|
|
||||||
* [Features](#features)
|
|
||||||
* [Usage](#usage)
|
* [Usage](#usage)
|
||||||
* [Basic](#basic)
|
* [Basic](#basic)
|
||||||
* [Semver](#semver)
|
* [Semver](#semver)
|
||||||
* [Complete](#complete)
|
* [Bake definition](#bake-definition)
|
||||||
* [Customizing](#customizing)
|
* [Customizing](#customizing)
|
||||||
* [inputs](#inputs)
|
* [inputs](#inputs)
|
||||||
* [outputs](#outputs)
|
* [outputs](#outputs)
|
||||||
|
* [`flavor` input](#flavor-input)
|
||||||
|
* [`tags` input](#tags-input)
|
||||||
|
* [`type=schedule`](#typeschedule)
|
||||||
|
* [`type=semver`](#typesemver)
|
||||||
|
* [`type=pep440`](#typepep440)
|
||||||
|
* [`type=match`](#typematch)
|
||||||
|
* [`type=edge`](#typeedge)
|
||||||
|
* [`type=ref`](#typeref)
|
||||||
|
* [`type=raw`](#typeraw)
|
||||||
|
* [`type=sha`](#typesha)
|
||||||
* [Notes](#notes)
|
* [Notes](#notes)
|
||||||
* [Latest tag](#latest-tag)
|
* [Latest tag](#latest-tag)
|
||||||
* [`tag-match` examples](#tag-match-examples)
|
* [Global expressions](#global-expressions)
|
||||||
* [Handle semver tag](#handle-semver-tag)
|
* [Major version zero](#major-version-zero)
|
||||||
* [Schedule tag](#schedule-tag)
|
* [JSON output object](#json-output-object)
|
||||||
* [Overwrite labels](#overwrite-labels)
|
* [Overwrite labels](#overwrite-labels)
|
||||||
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
|
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
|
||||||
* [How can I help?](#how-can-i-help)
|
|
||||||
* [License](#license)
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
* Docker tags generated from GitHub action event and Git metadata
|
|
||||||
* [OCI Image Format Specification](https://github.com/opencontainers/image-spec/blob/master/annotations.md) used to generate Docker labels
|
|
||||||
* [Handlebars template](https://handlebarsjs.com/guide/) to apply to schedule tag
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Basic
|
### Basic
|
||||||
|
|
||||||
| Event | Ref | Commit SHA | Docker Tags |
|
|
||||||
|-----------------|-------------------------------|------------|-------------------------------------|
|
|
||||||
| `pull_request` | `refs/pull/2/merge` | `a123b57` | `pr-2` |
|
|
||||||
| `push` | `refs/heads/master` | `cf20257` | `master` |
|
|
||||||
| `push` | `refs/heads/my/branch` | `a5df687` | `my-branch` |
|
|
||||||
| `push tag` | `refs/tags/v1.2.3` | `ad132f5` | `v1.2.3`, `latest` |
|
|
||||||
| `push tag` | `refs/tags/v2.0.8-beta.67` | `fc89efd` | `v2.0.8-beta.67`, `latest` |
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- '**'
|
- 'master'
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
@@ -72,16 +63,10 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: docker_meta
|
id: meta
|
||||||
uses: crazy-max/ghaction-docker-meta@v1
|
uses: docker/metadata-action@v3
|
||||||
with:
|
with:
|
||||||
images: name/app
|
images: name/app
|
||||||
-
|
|
||||||
name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
-
|
-
|
||||||
name: Login to DockerHub
|
name: Login to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
@@ -94,33 +79,33 @@ jobs:
|
|||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/386
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
| Event | Ref | Docker Tags |
|
||||||
|
|-----------------|-------------------------------|-------------------------------------|
|
||||||
|
| `pull_request` | `refs/pull/2/merge` | `pr-2` |
|
||||||
|
| `push` | `refs/heads/master` | `master` |
|
||||||
|
| `push` | `refs/heads/releases/v1` | `releases-v1` |
|
||||||
|
| `push tag` | `refs/tags/v1.2.3` | `v1.2.3`, `latest` |
|
||||||
|
| `push tag` | `refs/tags/v2.0.8-beta.67` | `v2.0.8-beta.67`, `latest` |
|
||||||
|
|
||||||
### Semver
|
### Semver
|
||||||
|
|
||||||
| Event | Ref | Commit SHA | Docker Tags |
|
|
||||||
|-----------------|-------------------------------|------------|-------------------------------------|
|
|
||||||
| `pull_request` | `refs/pull/2/merge` | `a123b57` | `pr-2` |
|
|
||||||
| `push` | `refs/heads/master` | `cf20257` | `master` |
|
|
||||||
| `push` | `refs/heads/my/branch` | `a5df687` | `my-branch` |
|
|
||||||
| `push tag` | `refs/tags/v1.2.3` | `ad132f5` | `1.2.3`, `1.2`, `latest` |
|
|
||||||
| `push tag` | `refs/tags/v2.0.8-beta.67` | `fc89efd` | `2.0.8-beta.67` |
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- '**'
|
- 'master'
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
@@ -131,19 +116,15 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: docker_meta
|
id: meta
|
||||||
uses: crazy-max/ghaction-docker-meta@v1
|
uses: docker/metadata-action@v3
|
||||||
with:
|
with:
|
||||||
images: name/app
|
images: name/app
|
||||||
tag-semver: |
|
tags: |
|
||||||
{{version}}
|
type=ref,event=branch
|
||||||
{{major}}.{{minor}}
|
type=ref,event=pr
|
||||||
-
|
type=semver,pattern={{version}}
|
||||||
name: Set up QEMU
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
-
|
-
|
||||||
name: Login to DockerHub
|
name: Login to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
@@ -156,36 +137,52 @@ jobs:
|
|||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/386
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Complete
|
| Event | Ref | Docker Tags |
|
||||||
|
|-----------------|-------------------------------|-------------------------------------|
|
||||||
|
| `pull_request` | `refs/pull/2/merge` | `pr-2` |
|
||||||
|
| `push` | `refs/heads/master` | `master` |
|
||||||
|
| `push` | `refs/heads/releases/v1` | `releases-v1` |
|
||||||
|
| `push tag` | `refs/tags/v1.2.3` | `1.2.3`, `1.2`, `latest` |
|
||||||
|
| `push tag` | `refs/tags/v2.0.8-beta.67` | `2.0.8-beta.67` |
|
||||||
|
|
||||||
| Event | Ref | Commit SHA | Docker Tags |
|
### Bake definition
|
||||||
|-----------------|-------------------------------|------------|-----------------------------------------|
|
|
||||||
| `schedule` | `refs/heads/master` | `45f132a` | `sha-45f132a`, `nightly` |
|
This action also handles a bake definition file that can be used with the
|
||||||
| `pull_request` | `refs/pull/2/merge` | `a123b57` | `sha-45f132a`, `pr-2` |
|
[Docker Bake action](https://github.com/docker/bake-action). You just have to declare an empty target named
|
||||||
| `push` | `refs/heads/master` | `cf20257` | `sha-45f132a`, `master` |
|
`docker-metadata-action` and inherit from it.
|
||||||
| `push` | `refs/heads/my/branch` | `a5df687` | `sha-45f132a`, `my-branch` |
|
|
||||||
| `push tag` | `refs/tags/v1.2.3` | `ad132f5` | `sha-45f132a`, `1.2.3`, `1.2`, `latest` |
|
```hcl
|
||||||
| `push tag` | `refs/tags/v2.0.8-beta.67` | `fc89efd` | `sha-45f132a`, `2.0.8-beta.67` |
|
// docker-bake.hcl
|
||||||
|
target "docker-metadata-action" {}
|
||||||
|
|
||||||
|
target "build" {
|
||||||
|
inherits = ["docker-metadata-action"]
|
||||||
|
context = "./"
|
||||||
|
dockerfile = "Dockerfile"
|
||||||
|
platforms = [
|
||||||
|
"linux/amd64",
|
||||||
|
"linux/arm/v6",
|
||||||
|
"linux/arm/v7",
|
||||||
|
"linux/arm64",
|
||||||
|
"linux/386"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
|
||||||
- cron: '0 10 * * *' # everyday at 10am
|
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- '**'
|
- 'master'
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
@@ -196,36 +193,55 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: docker_meta
|
id: meta
|
||||||
uses: crazy-max/ghaction-docker-meta@v1
|
uses: docker/metadata-action@v3
|
||||||
with:
|
with:
|
||||||
images: name/app
|
images: name/app
|
||||||
tag-semver: |
|
tags: |
|
||||||
{{version}}
|
type=ref,event=branch
|
||||||
{{major}}.{{minor}}
|
type=ref,event=pr
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=sha
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Build
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/bake-action@v1
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
-
|
|
||||||
name: Login to DockerHub
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
files: |
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
./docker-bake.hcl
|
||||||
-
|
${{ steps.meta.outputs.bake-file }}
|
||||||
name: Build and push
|
targets: build
|
||||||
uses: docker/build-push-action@v2
|
```
|
||||||
with:
|
|
||||||
context: .
|
Content of `${{ steps.meta.outputs.bake-file }}` file will look like this with `refs/tags/v1.2.3` ref:
|
||||||
file: ./Dockerfile
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/386
|
```json
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
{
|
||||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
"target": {
|
||||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
"docker-metadata-action": {
|
||||||
|
"tags": [
|
||||||
|
"name/app:1.2.3",
|
||||||
|
"name/app:1.2",
|
||||||
|
"name/app:sha-90dd603",
|
||||||
|
"name/app:latest"
|
||||||
|
],
|
||||||
|
"labels": {
|
||||||
|
"org.opencontainers.image.title": "Hello-World",
|
||||||
|
"org.opencontainers.image.description": "This your first repo!",
|
||||||
|
"org.opencontainers.image.url": "https://github.com/octocat/Hello-World",
|
||||||
|
"org.opencontainers.image.source": "https://github.com/octocat/Hello-World",
|
||||||
|
"org.opencontainers.image.version": "1.2.3",
|
||||||
|
"org.opencontainers.image.created": "2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision": "90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses": "MIT"
|
||||||
|
},
|
||||||
|
"args": {
|
||||||
|
"DOCKER_META_IMAGES": "name/app",
|
||||||
|
"DOCKER_META_VERSION": "1.2.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Customizing
|
## Customizing
|
||||||
@@ -234,21 +250,28 @@ jobs:
|
|||||||
|
|
||||||
Following inputs can be used as `step.with` keys
|
Following inputs can be used as `step.with` keys
|
||||||
|
|
||||||
|
> `List` type is a newline-delimited string
|
||||||
|
> ```yaml
|
||||||
|
> labels: |
|
||||||
|
> org.opencontainers.image.title=MyCustomTitle
|
||||||
|
> org.opencontainers.image.description=Another description
|
||||||
|
> org.opencontainers.image.vendor=MyCompany
|
||||||
|
> ```
|
||||||
|
|
||||||
|
> `CSV` type is a comma-delimited string
|
||||||
|
> ```yaml
|
||||||
|
> images: name/app,ghcr.io/name/app
|
||||||
|
> ```
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|---------------------|----------|------------------------------------|
|
|---------------------|----------|------------------------------------|
|
||||||
| `images` | List/CSV | List of Docker images to use as base name for tags |
|
| `images` | List/CSV | List of Docker images to use as base name for tags |
|
||||||
| `tag-sha` | Bool | Add git short SHA as Docker tag (default `false`) |
|
| `tags` | List | List of [tags](#tags-input) as key-value pair attributes |
|
||||||
| `tag-edge` | Bool | Enable edge branch tagging (default `false`) |
|
| `flavor` | List | [Flavor](#flavor-input) to apply |
|
||||||
| `tag-edge-branch` | String | Branch that will be tagged as edge (default `repo.default_branch`) |
|
| `labels` | List | List of custom labels |
|
||||||
| `tag-semver` | List | Handle Git tag as semver [template](#handle-semver-tag) if possible |
|
|
||||||
| `tag-match` | String | RegExp to match against a Git tag and use first match as Docker tag |
|
|
||||||
| `tag-match-group` | Number | Group to get if `tag-match` matches (default `0`) |
|
|
||||||
| `tag-match-latest` | Bool | Set `latest` Docker tag if `tag-match` matches or on Git tag event (default `true`) |
|
|
||||||
| `tag-schedule` | String | [Template](#schedule-tag) to apply to schedule tag (default `nightly`) |
|
|
||||||
| `sep-tags` | String | Separator to use for tags output (default `\n`) |
|
| `sep-tags` | String | Separator to use for tags output (default `\n`) |
|
||||||
| `sep-labels` | String | Separator to use for labels output (default `\n`) |
|
| `sep-labels` | String | Separator to use for labels output (default `\n`) |
|
||||||
|
| `bake-target` | String | Bake target name (default `docker-metadata-action`) |
|
||||||
> List/CSV type can be a newline or comma delimited string
|
|
||||||
|
|
||||||
### outputs
|
### outputs
|
||||||
|
|
||||||
@@ -256,62 +279,393 @@ Following outputs are available
|
|||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|---------------|---------|---------------------------------------|
|
|---------------|---------|---------------------------------------|
|
||||||
| `version` | String | Generated Docker image version |
|
| `version` | String | Docker image version |
|
||||||
| `tags` | String | Generated Docker tags |
|
| `tags` | String | Docker tags |
|
||||||
| `labels` | String | Generated Docker labels |
|
| `labels` | String | Docker labels |
|
||||||
|
| `json` | String | JSON output of tags and labels |
|
||||||
|
| `bake-file` | File | [Bake definition file](https://github.com/docker/buildx#file-definition) path |
|
||||||
|
|
||||||
|
## `flavor` input
|
||||||
|
|
||||||
|
`flavor` defines a global behavior for [`tags`](#tags-input):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
flavor: |
|
||||||
|
latest=auto
|
||||||
|
prefix=
|
||||||
|
suffix=
|
||||||
|
```
|
||||||
|
|
||||||
|
* `latest=<auto|true|false>`: Handle [latest tag](#latest-tag) (default `auto`)
|
||||||
|
* `prefix=<string>,onlatest=<true|false>`: A global prefix for each generated tag and optionally for `latest`
|
||||||
|
* `suffix=<string>,onlatest=<true|false>`: A global suffix for each generated tag and optionally for `latest`
|
||||||
|
|
||||||
|
## `tags` input
|
||||||
|
|
||||||
|
`tags` is the core input of this action as everything related to it will reflect the output metadata. This one is in
|
||||||
|
the form of a key-value pair list in CSV format to remove limitations intrinsically linked to GitHub Actions
|
||||||
|
(only string format is handled in the input fields). Here is an example:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=schedule
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=sha
|
||||||
|
```
|
||||||
|
|
||||||
|
Each entry is defined by a `type`, which are:
|
||||||
|
|
||||||
|
* [`type=schedule`](#typeschedule)
|
||||||
|
* [`type=semver`](#typesemver)
|
||||||
|
* [`type=pep440`](#typepep440)
|
||||||
|
* [`type=match`](#typematch)
|
||||||
|
* [`type=edge`](#typeedge)
|
||||||
|
* [`type=ref`](#typeref)
|
||||||
|
* [`type=raw`](#typeraw)
|
||||||
|
* [`type=sha`](#typesha)
|
||||||
|
|
||||||
|
And global attributes:
|
||||||
|
|
||||||
|
* `enable=<true|false>` enable this entry (default `true`)
|
||||||
|
* `priority=<number>` priority to manage the order of tags
|
||||||
|
* `prefix=<string>` add prefix
|
||||||
|
* `suffix=<string>` add suffix
|
||||||
|
|
||||||
|
Default entries if `tags` input is empty:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=schedule
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
type=ref,event=pr
|
||||||
|
```
|
||||||
|
|
||||||
|
### `type=schedule`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# minimal
|
||||||
|
type=schedule
|
||||||
|
# default
|
||||||
|
type=schedule,pattern=nightly
|
||||||
|
# handlebars
|
||||||
|
type=schedule,pattern={{date 'YYYYMMDD'}}
|
||||||
|
```
|
||||||
|
|
||||||
|
Will be used on [schedule event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#schedule).
|
||||||
|
|
||||||
|
`pattern` is a specially crafted attribute to support [Handlebars template](https://handlebarsjs.com/guide/) with
|
||||||
|
the following expressions:
|
||||||
|
* `date 'format'` ; render date by its [moment format](https://momentjs.com/docs/#/displaying/format/)
|
||||||
|
|
||||||
|
| Pattern | Output |
|
||||||
|
|--------------------------|----------------------|
|
||||||
|
| `nightly` | `nightly` |
|
||||||
|
| `{{date 'YYYYMMDD'}}` | `20210326` |
|
||||||
|
|
||||||
|
Extended attributes and default values:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=schedule,enable=true,priority=1000,prefix=,suffix=,pattern=nightly
|
||||||
|
```
|
||||||
|
|
||||||
|
### `type=semver`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# minimal
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
# use custom value instead of git tag
|
||||||
|
type=semver,pattern={{version}},value=v1.0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
Will be used on a [push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push)
|
||||||
|
and requires a valid [semver](https://semver.org/) Git tag, but you can also use a custom value through `value`
|
||||||
|
attribute.
|
||||||
|
|
||||||
|
`pattern` attribute supports [Handlebars template](https://handlebarsjs.com/guide/) with the following expressions:
|
||||||
|
* `raw` ; the actual tag
|
||||||
|
* `version` ; shorthand for `{{major}}.{{minor}}.{{patch}}` (can include pre-release)
|
||||||
|
* `major` ; major version identifier
|
||||||
|
* `minor` ; minor version identifier
|
||||||
|
* `patch` ; patch version identifier
|
||||||
|
|
||||||
|
| Git tag | Pattern | Output |
|
||||||
|
|--------------------|----------------------------------------------------------|----------------------|
|
||||||
|
| `v1.2.3` | `{{raw}}` | `v1.2.3` |
|
||||||
|
| `v1.2.3` | `{{version}}` | `1.2.3` |
|
||||||
|
| `v1.2.3` | `{{major}}.{{minor}}` | `1.2` |
|
||||||
|
| `v1.2.3` | `v{{major}}` | `v1` |
|
||||||
|
| `v1.2.3` | `{{minor}}` | `2` |
|
||||||
|
| `v1.2.3` | `{{patch}}` | `3` |
|
||||||
|
| `v2.0.8-beta.67` | `{{raw}}` | `2.0.8-beta.67`* |
|
||||||
|
| `v2.0.8-beta.67` | `{{version}}` | `2.0.8-beta.67` |
|
||||||
|
| `v2.0.8-beta.67` | `{{major}}.{{minor}}` | `2.0.8-beta.67`* |
|
||||||
|
|
||||||
|
> *Pre-release (rc, beta, alpha) will only extend `{{version}}` as tag because they are updated frequently,
|
||||||
|
> and contain many breaking changes that are (by the author's design) not yet fit for public consumption.
|
||||||
|
|
||||||
|
Extended attributes and default values:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=semver,enable=true,priority=900,prefix=,suffix=,pattern=,value=
|
||||||
|
```
|
||||||
|
|
||||||
|
### `type=pep440`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# minimal
|
||||||
|
type=pep440,pattern={{version}}
|
||||||
|
# use custom value instead of git tag
|
||||||
|
type=pep440,pattern={{version}},value=1.0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
Will be used on a [push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push)
|
||||||
|
and requires a Git tag that conforms to [PEP 440](https://www.python.org/dev/peps/pep-0440/), but you can also use a
|
||||||
|
custom value through `value` attribute.
|
||||||
|
|
||||||
|
`pattern` attribute supports [Handlebars template](https://handlebarsjs.com/guide/) with the following expressions:
|
||||||
|
* `raw` ; the actual tag
|
||||||
|
* `version` ; cleaned version
|
||||||
|
* `major` ; major version identifier
|
||||||
|
* `minor` ; minor version identifier
|
||||||
|
* `patch` ; patch version identifier
|
||||||
|
|
||||||
|
| Git tag | Pattern | Output |
|
||||||
|
|--------------------|----------------------------------------------------------|----------------------|
|
||||||
|
| `1.2.3` | `{{raw}}` | `1.2.3` |
|
||||||
|
| `1.2.3` | `{{version}}` | `1.2.3` |
|
||||||
|
| `v1.2.3` | `{{version}}` | `1.2.3` |
|
||||||
|
| `1.2.3` | `{{major}}.{{minor}}` | `1.2` |
|
||||||
|
| `1.2.3` | `v{{major}}` | `v1` |
|
||||||
|
| `1.2.3rc2` | `{{raw}}` | `1.2.3rc2`* |
|
||||||
|
| `1.2.3rc2` | `{{version}}` | `1.2.3rc2` |
|
||||||
|
| `1.2.3rc2` | `{{major}}.{{minor}}` | `1.2.3rc2`* |
|
||||||
|
| `1.2.3post1` | `{{major}}.{{minor}}` | `1.2.3.post1`* |
|
||||||
|
| `1.2.3beta2` | `{{major}}.{{minor}}` | `1.2.3b2`* |
|
||||||
|
| `1.0dev4` | `{{major}}.{{minor}}` | `1.0.dev4`* |
|
||||||
|
|
||||||
|
> *dev/pre/post release will only extend `{{version}}` as tag because they are updated frequently,
|
||||||
|
> and contain many breaking changes that are (by the author's design) not yet fit for public consumption.
|
||||||
|
|
||||||
|
Extended attributes and default values:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=pep440,enable=true,priority=900,prefix=,suffix=,pattern=,value=
|
||||||
|
```
|
||||||
|
|
||||||
|
### `type=match`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# minimal
|
||||||
|
type=match,pattern=\d.\d.\d
|
||||||
|
# define match group
|
||||||
|
type=match,pattern=v(.*),group=1
|
||||||
|
# use custom value instead of git tag
|
||||||
|
type=match,pattern=v(.*),group=1,value=v1.0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
Can create a regular expression for matching Git tag with a pattern and capturing group. Will be used on a
|
||||||
|
[push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push) but you can also use
|
||||||
|
a custom value through `value` attribute.
|
||||||
|
|
||||||
|
| Git tag | Pattern | Group | Output |
|
||||||
|
|-------------------------|-------------------------------|---------|------------------------|
|
||||||
|
| `v1.2.3` | `\d.\d.\d` | `0` | `1.2.3` |
|
||||||
|
| `v2.0.8-beta.67` | `v(.*)` | `1` | `2.0.8-beta.67` |
|
||||||
|
| `v2.0.8-beta.67` | `v(\d.\d)` | `1` | `2.0` |
|
||||||
|
| `20200110-RC2` | `\d+` | `0` | `20200110` |
|
||||||
|
| `p1/v1.2.3` | `p1-v(\d.\d.\d)` | `1` | `1.2.3` |
|
||||||
|
|
||||||
|
Extended attributes and default values:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=match,enable=true,priority=800,prefix=,suffix=,pattern=,group=0,value=
|
||||||
|
```
|
||||||
|
|
||||||
|
### `type=edge`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# minimal
|
||||||
|
type=edge
|
||||||
|
# define default branch
|
||||||
|
type=edge,branch=main
|
||||||
|
```
|
||||||
|
|
||||||
|
An `edge` tag reflects the last commit of the active branch on your Git repository. I usually prefer to use `edge`
|
||||||
|
as a Docker tag for a better distinction or common pattern. This is also used by official images
|
||||||
|
like [Alpine](https://hub.docker.com/_/alpine).
|
||||||
|
|
||||||
|
Extended attributes and default values:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=edge,enable=true,priority=700,prefix=,suffix=,branch=$repo.default_branch
|
||||||
|
```
|
||||||
|
|
||||||
|
### `type=ref`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# branch event
|
||||||
|
type=ref,event=branch
|
||||||
|
# tag event
|
||||||
|
type=ref,event=tag
|
||||||
|
# pull request event
|
||||||
|
type=ref,event=pr
|
||||||
|
```
|
||||||
|
|
||||||
|
This type handles Git ref (or reference) for the following events:
|
||||||
|
* `branch` ; eg. `refs/heads/master`
|
||||||
|
* `tag` ; eg. `refs/tags/v1.0.0`
|
||||||
|
* `pr` ; eg. `refs/pull/318/merge`
|
||||||
|
|
||||||
|
| Event | Ref | Output |
|
||||||
|
|-----------------|-------------------------------|-------------------------------|
|
||||||
|
| `pull_request` | `refs/pull/2/merge` | `pr-2` |
|
||||||
|
| `push` | `refs/heads/master` | `master` |
|
||||||
|
| `push` | `refs/heads/my/branch` | `my-branch` |
|
||||||
|
| `push tag` | `refs/tags/v1.2.3` | `v1.2.3` |
|
||||||
|
| `push tag` | `refs/tags/v2.0.8-beta.67` | `v2.0.8-beta.67` |
|
||||||
|
|
||||||
|
Extended attributes and default values:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# branch event
|
||||||
|
type=ref,enable=true,priority=600,prefix=,suffix=,event=branch
|
||||||
|
# tag event
|
||||||
|
type=ref,enable=true,priority=600,prefix=,suffix=,event=tag
|
||||||
|
# pull request event
|
||||||
|
type=ref,enable=true,priority=600,prefix=pr-,suffix=,event=pr
|
||||||
|
```
|
||||||
|
|
||||||
|
### `type=raw`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=raw,value=foo
|
||||||
|
type=raw,value=bar
|
||||||
|
# or
|
||||||
|
type=raw,foo
|
||||||
|
type=raw,bar
|
||||||
|
# or
|
||||||
|
foo
|
||||||
|
bar
|
||||||
|
```
|
||||||
|
|
||||||
|
Output custom tags according to your needs.
|
||||||
|
|
||||||
|
Extended attributes and default values:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=raw,enable=true,priority=200,prefix=,suffix=,value=
|
||||||
|
```
|
||||||
|
|
||||||
|
### `type=sha`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# minimal (short sha)
|
||||||
|
type=sha
|
||||||
|
# full length sha
|
||||||
|
type=sha,format=long
|
||||||
|
```
|
||||||
|
|
||||||
|
Output Git short commit (or long if specified) as Docker tag like `sha-ad132f5`.
|
||||||
|
|
||||||
|
Extended attributes and default values:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=sha,enable=true,priority=100,prefix=sha-,suffix=,format=short
|
||||||
|
```
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
### Latest tag
|
### Latest tag
|
||||||
|
|
||||||
Latest Docker tag will be generated by default on `push tag` event. If for example you push the `v1.2.3` Git tag,
|
`latest` tag is handled through the [`flavor` input](#flavor-input). It will be generated by default (`auto` mode) for:
|
||||||
you will have at the output of this action the Docker tags `v1.2.3` and `latest`. But you can allow the latest tag to be
|
* [`type=ref,event=tag`](#typeref)
|
||||||
generated only if the Git tag matches a regular expression with the [`tag-match` input](#tag-match-examples) or if
|
* [`type=semver,pattern=...`](#typesemver)
|
||||||
`tag-semver` is valid [semver](https://semver.org/).
|
* [`type=match,pattern=...`](#typematch)
|
||||||
|
|
||||||
### `tag-match` examples
|
### Global expressions
|
||||||
|
|
||||||
| Git tag | `tag-match` | `tag-match-group` | Match | Output tags | Output version |
|
The following [Handlebars template](https://handlebarsjs.com/guide/) expressions for `prefix`, `suffix` and `value`
|
||||||
|-------------------------|------------------------------------|-------------------|----------------------|---------------------------|------------------------------|
|
attributes are available:
|
||||||
| `v1.2.3` | `\d{1,3}.\d{1,3}.\d{1,3}` | `0` | :white_check_mark: | `1.2.3`, `latest` | `1.2.3` |
|
|
||||||
| `v2.0.8-beta.67` | `v(.*)` | `1` | :white_check_mark: | `2.0.8-beta.67`, `latest` | `2.0.8-beta.67` |
|
|
||||||
| `v2.0.8-beta.67` | `v(\d.\d)` | `1` | :white_check_mark: | `2.0`, `latest` | `2.0` |
|
|
||||||
| `release1` | `\d{1,3}.\d{1,3}` | `0` | :x: | `release1` | `release1` |
|
|
||||||
| `20200110-RC2` | `\d+` | `0` | :white_check_mark: | `20200110`, `latest` | `20200110` |
|
|
||||||
|
|
||||||
### Handle semver tag
|
| Expression | Output |
|
||||||
|
|--------------------------|----------------------|
|
||||||
|
| `{{branch}}` | `master` |
|
||||||
|
| `{{tag}}` | `v1.2.3` |
|
||||||
|
| `{{sha}}` | `90dd603` |
|
||||||
|
| `{{base_ref}}` | `master` |
|
||||||
|
| `{{date 'YYYYMMDD'}}` | `20210326` |
|
||||||
|
|
||||||
If Git tag is a valid [semver](https://semver.org/) you can handle it to output multi Docker tags at once.
|
```yaml
|
||||||
`tag-semver` supports multi-line [Handlebars template](https://handlebarsjs.com/guide/) with the following inputs:
|
tags: |
|
||||||
|
# dynamically set the branch name as a prefix
|
||||||
|
type=sha,prefix={{branch}}-
|
||||||
|
# dynamically set the branch name and sha as a custom tag
|
||||||
|
type=raw,value=mytag-{{branch}}-{{sha}}
|
||||||
|
```
|
||||||
|
|
||||||
| Git tag | `tag-semver` | Valid | Output tags | Output version |
|
### Major version zero
|
||||||
|--------------------|----------------------------------------------------------|--------------------|----------------------------|------------------------------|
|
|
||||||
| `v1.2.3` | `{{raw}}` | :white_check_mark: | `v1.2.3`, `latest` | `v1.2.3` |
|
|
||||||
| `v1.2.3` | `{{version}}` | :white_check_mark: | `1.2.3`, `latest` | `1.2.3` |
|
|
||||||
| `v1.2.3` | `{{major}}.{{minor}}` | :white_check_mark: | `1.2`, `latest` | `1.2` |
|
|
||||||
| `v1.2.3` | `v{{major}}` | :white_check_mark: | `v1`, `latest` | `v1` |
|
|
||||||
| `v1.2.3` | `{{minor}}` | :white_check_mark: | `2`, `latest` | `2` |
|
|
||||||
| `v1.2.3` | `{{patch}}` | :white_check_mark: | `3`, `latest` | `3` |
|
|
||||||
| `v1.2.3` | `{{major}}.{{minor}}`<br>`{{major}}.{{minor}}.{{patch}}` | :white_check_mark: | `1.2`, `1.2.3`, `latest` | `1.2`* |
|
|
||||||
| `v2.0.8-beta.67` | `{{raw}}` | :white_check_mark: | `2.0.8-beta.67` | `2.0.8-beta.67` |
|
|
||||||
| `v2.0.8-beta.67` | `{{version}}` | :white_check_mark: | `2.0.8-beta.67` | `2.0.8-beta.67` |
|
|
||||||
| `v2.0.8-beta.67` | `{{major}}.{{minor}}` | :white_check_mark: | `2.0.8-beta.67`** | `2.0.8-beta.67` |
|
|
||||||
| `release1` | `{{raw}}` | :x: | `release1` | `release1` |
|
|
||||||
|
|
||||||
> *First occurrence of `tag-semver` will be taken as `output.version`
|
Major version zero (`0.y.z`) is for initial development and **may** change at any time. This means the public API
|
||||||
|
[**should not** be considered stable](https://semver.org/#spec-item-4).
|
||||||
|
|
||||||
> **Pre-release (rc, beta, alpha) will only extend `{{version}}` as tag
|
In this case, Docker tag `0` **should not** be generated if you're using [`type=semver`](#typesemver) with `{{major}}`
|
||||||
|
pattern. You can manage this behavior like this:
|
||||||
|
|
||||||
### Schedule tag
|
```yaml
|
||||||
|
# refs/tags/v0.1.2
|
||||||
|
tags: |
|
||||||
|
# output 0.1.2
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
# output 0.1
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
# disabled if major zero
|
||||||
|
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
|
||||||
|
```
|
||||||
|
|
||||||
`tag-schedule` is specially crafted input to support [Handlebars template](https://handlebarsjs.com/guide/) with
|
### JSON output object
|
||||||
the following expressions:
|
|
||||||
|
|
||||||
| Expression | Example | Description |
|
The `json` output is a JSON object composed of the generated tags and labels so that you can reuse them further in your
|
||||||
|-------------------------|-------------------------------------------|------------------------------------------|
|
workflow using the [`fromJSON` function](https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson):
|
||||||
| `{{date 'format'}}` | `{{date 'YYYYMMDD'}}` > `20200110` | Render date by its [moment format](https://momentjs.com/docs/#/displaying/format/)
|
|
||||||
|
|
||||||
You can find more examples in the [CI workflow](.github/workflows/ci.yml).
|
```yaml
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
|
id: meta
|
||||||
|
with:
|
||||||
|
images: name/app
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
build-args: |
|
||||||
|
BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
|
||||||
|
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
|
||||||
|
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
||||||
|
```
|
||||||
|
|
||||||
### Overwrite labels
|
### Overwrite labels
|
||||||
|
|
||||||
@@ -320,16 +674,13 @@ labels generated are not suitable, you can overwrite them like this:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Docker meta
|
||||||
uses: docker/build-push-action@v2
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
with:
|
with:
|
||||||
context: .
|
images: name/app
|
||||||
file: ./Dockerfile
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/386
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
||||||
labels: |
|
labels: |
|
||||||
${{ steps.docker_meta.outputs.labels }}
|
maintainer=CrazyMax
|
||||||
org.opencontainers.image.title=MyCustomTitle
|
org.opencontainers.image.title=MyCustomTitle
|
||||||
org.opencontainers.image.description=Another description
|
org.opencontainers.image.description=Another description
|
||||||
org.opencontainers.image.vendor=MyCompany
|
org.opencontainers.image.vendor=MyCompany
|
||||||
@@ -350,16 +701,3 @@ updates:
|
|||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
```
|
```
|
||||||
|
|
||||||
## How can I help?
|
|
||||||
|
|
||||||
All kinds of contributions are welcome :raised_hands:! The most basic way to show your support is to star :star2:
|
|
||||||
the project, or to raise issues :speech_balloon: You can also support this project by
|
|
||||||
[**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max) :clap: or by making a
|
|
||||||
[Paypal donation](https://www.paypal.me/crazyws) to ensure this journey continues indefinitely! :rocket:
|
|
||||||
|
|
||||||
Thanks again for your support, it is much appreciated! :pray:
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
MIT. See `LICENSE` for more details.
|
|
||||||
|
299
UPGRADE.md
Normal file
299
UPGRADE.md
Normal file
@@ -0,0 +1,299 @@
|
|||||||
|
# Upgrade notes
|
||||||
|
|
||||||
|
## v2 to v3
|
||||||
|
|
||||||
|
* Repository has been moved to docker org. Replace `crazy-max/ghaction-docker-meta@v2` with `docker/metadata-action@v3`
|
||||||
|
* The default bake target has been changed: `ghaction-docker-meta` > `docker-metadata-action`
|
||||||
|
|
||||||
|
## v1 to v2
|
||||||
|
|
||||||
|
* [inputs](#inputs)
|
||||||
|
* [`tag-sha`](#tag-sha)
|
||||||
|
* [`tag-edge` / `tag-edge-branch`](#tag-edge--tag-edge-branch)
|
||||||
|
* [`tag-semver`](#tag-semver)
|
||||||
|
* [`tag-match` / `tag-match-group`](#tag-match--tag-match-group)
|
||||||
|
* [`tag-latest`](#tag-latest)
|
||||||
|
* [`tag-schedule`](#tag-schedule)
|
||||||
|
* [`tag-custom` / `tag-custom-only`](#tag-custom--tag-custom-only)
|
||||||
|
* [`label-custom`](#label-custom)
|
||||||
|
* [Basic workflow](#basic-workflow)
|
||||||
|
* [Semver workflow](#semver-workflow)
|
||||||
|
|
||||||
|
### inputs
|
||||||
|
|
||||||
|
| New | Unchanged | Removed |
|
||||||
|
|------------|-----------------|--------------------|
|
||||||
|
| `tags` | `images` | `tag-sha` |
|
||||||
|
| `flavor` | `sep-tags` | `tag-edge` |
|
||||||
|
| `labels` | `sep-labels` | `tag-edge-branch` |
|
||||||
|
| | | `tag-semver` |
|
||||||
|
| | | `tag-match` |
|
||||||
|
| | | `tag-match-group` |
|
||||||
|
| | | `tag-latest` |
|
||||||
|
| | | `tag-schedule` |
|
||||||
|
| | | `tag-custom` |
|
||||||
|
| | | `tag-custom-only` |
|
||||||
|
| | | `label-custom` |
|
||||||
|
|
||||||
|
#### `tag-sha`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=sha
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `tag-edge` / `tag-edge-branch`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# default branch
|
||||||
|
type=edge
|
||||||
|
# specify branch
|
||||||
|
type=edge,branch=main
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `tag-semver`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `tag-match` / `tag-match-group`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=match,pattern=v(.*),group=1
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `tag-latest`
|
||||||
|
|
||||||
|
`tag-latest` is now handled through the [`flavor` input](README.md#flavor-input):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
flavor: |
|
||||||
|
latest=auto
|
||||||
|
```
|
||||||
|
|
||||||
|
See also the notes about ["latest tag" behavior](README.md#latest-tag)
|
||||||
|
|
||||||
|
#### `tag-schedule`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
# default tag (nightly)
|
||||||
|
type=schedule
|
||||||
|
# specific pattern
|
||||||
|
type=schedule,pattern={{date 'YYYYMMDD'}}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `tag-custom` / `tag-custom-only`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tags: |
|
||||||
|
type=raw,value=foo
|
||||||
|
type=raw,value=bar
|
||||||
|
# or
|
||||||
|
type=raw,foo
|
||||||
|
type=raw,bar
|
||||||
|
# or
|
||||||
|
foo
|
||||||
|
bar
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `label-custom`
|
||||||
|
|
||||||
|
Same behavior for `labels`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
labels: |
|
||||||
|
maintainer=CrazyMax
|
||||||
|
```
|
||||||
|
|
||||||
|
### Basic workflow
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# v1
|
||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v1
|
||||||
|
with:
|
||||||
|
images: name/app
|
||||||
|
-
|
||||||
|
name: Login to DockerHub
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# v2
|
||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
|
with:
|
||||||
|
images: name/app
|
||||||
|
-
|
||||||
|
name: Login to DockerHub
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Semver workflow
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# v1
|
||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v1
|
||||||
|
with:
|
||||||
|
images: name/app
|
||||||
|
tag-semver: |
|
||||||
|
{{version}}
|
||||||
|
{{major}}.{{minor}}
|
||||||
|
-
|
||||||
|
name: Login to DockerHub
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# v2
|
||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
|
with:
|
||||||
|
images: name/app
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
-
|
||||||
|
name: Login to DockerHub
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
```
|
@@ -1,54 +1,162 @@
|
|||||||
|
import * as fs from 'fs';
|
||||||
|
import * as os from 'os';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
import * as context from '../src/context';
|
import * as context from '../src/context';
|
||||||
|
|
||||||
|
jest.spyOn(context, 'tmpDir').mockImplementation((): string => {
|
||||||
|
const tmpDir = path.join('/tmp/.docker-metadata-action-jest').split(path.sep).join(path.posix.sep);
|
||||||
|
if (!fs.existsSync(tmpDir)) {
|
||||||
|
fs.mkdirSync(tmpDir, {recursive: true});
|
||||||
|
}
|
||||||
|
return tmpDir;
|
||||||
|
});
|
||||||
|
|
||||||
describe('getInputList', () => {
|
describe('getInputList', () => {
|
||||||
it('handles single line correctly', async () => {
|
it('single line correctly', async () => {
|
||||||
await setInput('foo', 'bar');
|
await setInput('foo', 'bar');
|
||||||
const res = await context.getInputList('foo');
|
const res = await context.getInputList('foo');
|
||||||
console.log(res);
|
console.log(res);
|
||||||
expect(res).toEqual(['bar']);
|
expect(res).toEqual(['bar']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('handles multiple lines correctly', async () => {
|
it('multiline correctly', async () => {
|
||||||
setInput('foo', 'bar\nbaz');
|
setInput('foo', 'bar\nbaz');
|
||||||
const res = await context.getInputList('foo');
|
const res = await context.getInputList('foo');
|
||||||
console.log(res);
|
console.log(res);
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
expect(res).toEqual(['bar', 'baz']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('remove empty lines correctly', async () => {
|
it('empty lines correctly', async () => {
|
||||||
setInput('foo', 'bar\n\nbaz');
|
setInput('foo', 'bar\n\nbaz');
|
||||||
const res = await context.getInputList('foo');
|
const res = await context.getInputList('foo');
|
||||||
console.log(res);
|
console.log(res);
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
expect(res).toEqual(['bar', 'baz']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('handles comma correctly', async () => {
|
it('comma correctly', async () => {
|
||||||
setInput('foo', 'bar,baz');
|
setInput('foo', 'bar,baz');
|
||||||
const res = await context.getInputList('foo');
|
const res = await context.getInputList('foo');
|
||||||
console.log(res);
|
console.log(res);
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
expect(res).toEqual(['bar', 'baz']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('remove empty result correctly', async () => {
|
it('empty result correctly', async () => {
|
||||||
setInput('foo', 'bar,baz,');
|
setInput('foo', 'bar,baz,');
|
||||||
const res = await context.getInputList('foo');
|
const res = await context.getInputList('foo');
|
||||||
console.log(res);
|
console.log(res);
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
expect(res).toEqual(['bar', 'baz']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('handles different new lines correctly', async () => {
|
it('different new lines correctly', async () => {
|
||||||
setInput('foo', 'bar\r\nbaz');
|
setInput('foo', 'bar\r\nbaz');
|
||||||
const res = await context.getInputList('foo');
|
const res = await context.getInputList('foo');
|
||||||
console.log(res);
|
console.log(res);
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
expect(res).toEqual(['bar', 'baz']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('handles different new lines and comma correctly', async () => {
|
it('different new lines and comma correctly', async () => {
|
||||||
setInput('foo', 'bar\r\nbaz,bat');
|
setInput('foo', 'bar\r\nbaz,bat');
|
||||||
const res = await context.getInputList('foo');
|
const res = await context.getInputList('foo');
|
||||||
console.log(res);
|
console.log(res);
|
||||||
expect(res).toEqual(['bar', 'baz', 'bat']);
|
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'
|
||||||
|
]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('asyncForEach', () => {
|
describe('asyncForEach', () => {
|
||||||
@@ -64,6 +172,27 @@ describe('asyncForEach', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('setOutput', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
process.stdout.write = jest.fn();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('setOutput produces the correct command', () => {
|
||||||
|
context.setOutput('some output', 'some value');
|
||||||
|
assertWriteCalls([`::set-output name=some output::some value${os.EOL}`]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('setOutput handles bools', () => {
|
||||||
|
context.setOutput('some output', false);
|
||||||
|
assertWriteCalls([`::set-output name=some output::false${os.EOL}`]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('setOutput handles numbers', () => {
|
||||||
|
context.setOutput('some output', 1.01);
|
||||||
|
assertWriteCalls([`::set-output name=some output::1.01${os.EOL}`]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// See: https://github.com/actions/toolkit/blob/master/packages/core/src/core.ts#L67
|
// See: https://github.com/actions/toolkit/blob/master/packages/core/src/core.ts#L67
|
||||||
function getInputName(name: string): string {
|
function getInputName(name: string): string {
|
||||||
return `INPUT_${name.replace(/ /g, '_').toUpperCase()}`;
|
return `INPUT_${name.replace(/ /g, '_').toUpperCase()}`;
|
||||||
@@ -72,3 +201,11 @@ function getInputName(name: string): string {
|
|||||||
function setInput(name: string, value: string): void {
|
function setInput(name: string, value: string): void {
|
||||||
process.env[getInputName(name)] = value;
|
process.env[getInputName(name)] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Assert that process.stdout.write calls called only with the given arguments.
|
||||||
|
function assertWriteCalls(calls: string[]): void {
|
||||||
|
expect(process.stdout.write).toHaveBeenCalledTimes(calls.length);
|
||||||
|
for (let i = 0; i < calls.length; i++) {
|
||||||
|
expect(process.stdout.write).toHaveBeenNthCalledWith(i + 1, calls[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -6,7 +6,7 @@ GITHUB_API_URL=https://api.github.com
|
|||||||
GITHUB_BASE_REF=master
|
GITHUB_BASE_REF=master
|
||||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_e00a951d-2585-4fac-b085-459d80e69a2f
|
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_e00a951d-2585-4fac-b085-459d80e69a2f
|
||||||
GITHUB_EVENT_NAME=pull_request
|
GITHUB_EVENT_NAME=pull_request
|
||||||
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
|
GITHUB_EVENT_PATH=./__tests__/fixtures/event_pull_request.json
|
||||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||||
GITHUB_HEAD_REF=pr
|
GITHUB_HEAD_REF=pr
|
||||||
GITHUB_JOB=event
|
GITHUB_JOB=event
|
||||||
|
488
__tests__/fixtures/event_pull_request.json
Normal file
488
__tests__/fixtures/event_pull_request.json
Normal file
@@ -0,0 +1,488 @@
|
|||||||
|
{
|
||||||
|
"action": "opened",
|
||||||
|
"number": 7,
|
||||||
|
"pull_request": {
|
||||||
|
"_links": {
|
||||||
|
"comments": {
|
||||||
|
"href": "https://api.github.com/repos/crazy-max/test-docker-action/issues/7/comments"
|
||||||
|
},
|
||||||
|
"commits": {
|
||||||
|
"href": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/7/commits"
|
||||||
|
},
|
||||||
|
"html": {
|
||||||
|
"href": "https://github.com/crazy-max/test-docker-action/pull/7"
|
||||||
|
},
|
||||||
|
"issue": {
|
||||||
|
"href": "https://api.github.com/repos/crazy-max/test-docker-action/issues/7"
|
||||||
|
},
|
||||||
|
"review_comment": {
|
||||||
|
"href": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/comments{/number}"
|
||||||
|
},
|
||||||
|
"review_comments": {
|
||||||
|
"href": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/7/comments"
|
||||||
|
},
|
||||||
|
"self": {
|
||||||
|
"href": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/7"
|
||||||
|
},
|
||||||
|
"statuses": {
|
||||||
|
"href": "https://api.github.com/repos/crazy-max/test-docker-action/statuses/0337b3a374a0b833cf127b9111ca8c5589d93616"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"active_lock_reason": null,
|
||||||
|
"additions": 0,
|
||||||
|
"assignee": null,
|
||||||
|
"assignees": [],
|
||||||
|
"author_association": "COLLABORATOR",
|
||||||
|
"auto_merge": null,
|
||||||
|
"base": {
|
||||||
|
"label": "docker:master",
|
||||||
|
"ref": "master",
|
||||||
|
"repo": {
|
||||||
|
"allow_auto_merge": false,
|
||||||
|
"allow_forking": true,
|
||||||
|
"allow_merge_commit": true,
|
||||||
|
"allow_rebase_merge": true,
|
||||||
|
"allow_squash_merge": true,
|
||||||
|
"archive_url": "https://api.github.com/repos/crazy-max/test-docker-action/{archive_format}{/ref}",
|
||||||
|
"archived": false,
|
||||||
|
"assignees_url": "https://api.github.com/repos/crazy-max/test-docker-action/assignees{/user}",
|
||||||
|
"blobs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/blobs{/sha}",
|
||||||
|
"branches_url": "https://api.github.com/repos/crazy-max/test-docker-action/branches{/branch}",
|
||||||
|
"clone_url": "https://github.com/crazy-max/test-docker-action.git",
|
||||||
|
"collaborators_url": "https://api.github.com/repos/crazy-max/test-docker-action/collaborators{/collaborator}",
|
||||||
|
"comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/comments{/number}",
|
||||||
|
"commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/commits{/sha}",
|
||||||
|
"compare_url": "https://api.github.com/repos/crazy-max/test-docker-action/compare/{base}...{head}",
|
||||||
|
"contents_url": "https://api.github.com/repos/crazy-max/test-docker-action/contents/{+path}",
|
||||||
|
"contributors_url": "https://api.github.com/repos/crazy-max/test-docker-action/contributors",
|
||||||
|
"created_at": "2020-08-07T09:23:00Z",
|
||||||
|
"default_branch": "master",
|
||||||
|
"delete_branch_on_merge": false,
|
||||||
|
"deployments_url": "https://api.github.com/repos/crazy-max/test-docker-action/deployments",
|
||||||
|
"description": "Test \"Docker\" Actions",
|
||||||
|
"disabled": false,
|
||||||
|
"downloads_url": "https://api.github.com/repos/crazy-max/test-docker-action/downloads",
|
||||||
|
"events_url": "https://api.github.com/repos/crazy-max/test-docker-action/events",
|
||||||
|
"fork": false,
|
||||||
|
"forks": 1,
|
||||||
|
"forks_count": 1,
|
||||||
|
"forks_url": "https://api.github.com/repos/crazy-max/test-docker-action/forks",
|
||||||
|
"full_name": "docker/test-docker-action",
|
||||||
|
"git_commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/commits{/sha}",
|
||||||
|
"git_refs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/refs{/sha}",
|
||||||
|
"git_tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/tags{/sha}",
|
||||||
|
"git_url": "git://github.com/crazy-max/test-docker-action.git",
|
||||||
|
"has_downloads": true,
|
||||||
|
"has_issues": false,
|
||||||
|
"has_pages": false,
|
||||||
|
"has_projects": false,
|
||||||
|
"has_wiki": false,
|
||||||
|
"homepage": "",
|
||||||
|
"hooks_url": "https://api.github.com/repos/crazy-max/test-docker-action/hooks",
|
||||||
|
"html_url": "https://github.com/crazy-max/test-docker-action",
|
||||||
|
"id": 285789493,
|
||||||
|
"is_template": false,
|
||||||
|
"issue_comment_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/comments{/number}",
|
||||||
|
"issue_events_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/events{/number}",
|
||||||
|
"issues_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues{/number}",
|
||||||
|
"keys_url": "https://api.github.com/repos/crazy-max/test-docker-action/keys{/key_id}",
|
||||||
|
"labels_url": "https://api.github.com/repos/crazy-max/test-docker-action/labels{/name}",
|
||||||
|
"language": "JavaScript",
|
||||||
|
"languages_url": "https://api.github.com/repos/crazy-max/test-docker-action/languages",
|
||||||
|
"license": {
|
||||||
|
"key": "mit",
|
||||||
|
"name": "MIT License",
|
||||||
|
"node_id": "MDc6TGljZW5zZTEz",
|
||||||
|
"spdx_id": "MIT",
|
||||||
|
"url": "https://api.github.com/licenses/mit"
|
||||||
|
},
|
||||||
|
"merges_url": "https://api.github.com/repos/crazy-max/test-docker-action/merges",
|
||||||
|
"milestones_url": "https://api.github.com/repos/crazy-max/test-docker-action/milestones{/number}",
|
||||||
|
"mirror_url": null,
|
||||||
|
"name": "test-docker-action",
|
||||||
|
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||||
|
"notifications_url": "https://api.github.com/repos/crazy-max/test-docker-action/notifications{?since,all,participating}",
|
||||||
|
"open_issues": 5,
|
||||||
|
"open_issues_count": 5,
|
||||||
|
"owner": {
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||||
|
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
|
||||||
|
"followers_url": "https://api.github.com/users/crazy-max/followers",
|
||||||
|
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"html_url": "https://github.com/crazy-max",
|
||||||
|
"id": 5429470,
|
||||||
|
"login": "docker",
|
||||||
|
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||||
|
"organizations_url": "https://api.github.com/users/crazy-max/users",
|
||||||
|
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
|
||||||
|
"repos_url": "https://api.github.com/users/crazy-max/repos",
|
||||||
|
"site_admin": false,
|
||||||
|
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
|
||||||
|
"type": "Organization",
|
||||||
|
"url": "https://api.github.com/users/crazy-max"
|
||||||
|
},
|
||||||
|
"private": true,
|
||||||
|
"pulls_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls{/number}",
|
||||||
|
"pushed_at": "2021-10-21T21:44:34Z",
|
||||||
|
"releases_url": "https://api.github.com/repos/crazy-max/test-docker-action/releases{/id}",
|
||||||
|
"size": 714,
|
||||||
|
"ssh_url": "git@github.com:docker/test-docker-action.git",
|
||||||
|
"stargazers_count": 0,
|
||||||
|
"stargazers_url": "https://api.github.com/repos/crazy-max/test-docker-action/stargazers",
|
||||||
|
"statuses_url": "https://api.github.com/repos/crazy-max/test-docker-action/statuses/{sha}",
|
||||||
|
"subscribers_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscribers",
|
||||||
|
"subscription_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscription",
|
||||||
|
"svn_url": "https://github.com/crazy-max/test-docker-action",
|
||||||
|
"tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/tags",
|
||||||
|
"teams_url": "https://api.github.com/repos/crazy-max/test-docker-action/teams",
|
||||||
|
"topics": [],
|
||||||
|
"trees_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/trees{/sha}",
|
||||||
|
"updated_at": "2021-10-21T21:44:37Z",
|
||||||
|
"url": "https://api.github.com/repos/crazy-max/test-docker-action",
|
||||||
|
"visibility": "private",
|
||||||
|
"watchers": 0,
|
||||||
|
"watchers_count": 0
|
||||||
|
},
|
||||||
|
"sha": "ce1a91a20f9e2c064bcd76a7b95e091f831cf653",
|
||||||
|
"user": {
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||||
|
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
|
||||||
|
"followers_url": "https://api.github.com/users/crazy-max/followers",
|
||||||
|
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"html_url": "https://github.com/crazy-max",
|
||||||
|
"id": 5429470,
|
||||||
|
"login": "docker",
|
||||||
|
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||||
|
"organizations_url": "https://api.github.com/users/crazy-max/users",
|
||||||
|
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
|
||||||
|
"repos_url": "https://api.github.com/users/crazy-max/repos",
|
||||||
|
"site_admin": false,
|
||||||
|
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
|
||||||
|
"type": "Organization",
|
||||||
|
"url": "https://api.github.com/users/crazy-max"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": null,
|
||||||
|
"changed_files": 0,
|
||||||
|
"closed_at": null,
|
||||||
|
"comments": 0,
|
||||||
|
"comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/7/comments",
|
||||||
|
"commits": 1,
|
||||||
|
"commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/7/commits",
|
||||||
|
"created_at": "2021-10-21T21:46:27Z",
|
||||||
|
"deletions": 0,
|
||||||
|
"diff_url": "https://github.com/crazy-max/test-docker-action/pull/7.diff",
|
||||||
|
"draft": false,
|
||||||
|
"head": {
|
||||||
|
"label": "crazy-max:test-pr",
|
||||||
|
"ref": "test-pr",
|
||||||
|
"repo": {
|
||||||
|
"allow_auto_merge": false,
|
||||||
|
"allow_forking": true,
|
||||||
|
"allow_merge_commit": true,
|
||||||
|
"allow_rebase_merge": true,
|
||||||
|
"allow_squash_merge": true,
|
||||||
|
"archive_url": "https://api.github.com/repos/crazy-max/test-docker-action/{archive_format}{/ref}",
|
||||||
|
"archived": false,
|
||||||
|
"assignees_url": "https://api.github.com/repos/crazy-max/test-docker-action/assignees{/user}",
|
||||||
|
"blobs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/blobs{/sha}",
|
||||||
|
"branches_url": "https://api.github.com/repos/crazy-max/test-docker-action/branches{/branch}",
|
||||||
|
"clone_url": "https://github.com/crazy-max/test-docker-action.git",
|
||||||
|
"collaborators_url": "https://api.github.com/repos/crazy-max/test-docker-action/collaborators{/collaborator}",
|
||||||
|
"comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/comments{/number}",
|
||||||
|
"commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/commits{/sha}",
|
||||||
|
"compare_url": "https://api.github.com/repos/crazy-max/test-docker-action/compare/{base}...{head}",
|
||||||
|
"contents_url": "https://api.github.com/repos/crazy-max/test-docker-action/contents/{+path}",
|
||||||
|
"contributors_url": "https://api.github.com/repos/crazy-max/test-docker-action/contributors",
|
||||||
|
"created_at": "2021-07-11T17:34:22Z",
|
||||||
|
"default_branch": "master",
|
||||||
|
"delete_branch_on_merge": false,
|
||||||
|
"deployments_url": "https://api.github.com/repos/crazy-max/test-docker-action/deployments",
|
||||||
|
"description": "Test \"Docker\" Actions",
|
||||||
|
"disabled": false,
|
||||||
|
"downloads_url": "https://api.github.com/repos/crazy-max/test-docker-action/downloads",
|
||||||
|
"events_url": "https://api.github.com/repos/crazy-max/test-docker-action/events",
|
||||||
|
"fork": true,
|
||||||
|
"forks": 0,
|
||||||
|
"forks_count": 0,
|
||||||
|
"forks_url": "https://api.github.com/repos/crazy-max/test-docker-action/forks",
|
||||||
|
"full_name": "crazy-max/test-docker-action",
|
||||||
|
"git_commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/commits{/sha}",
|
||||||
|
"git_refs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/refs{/sha}",
|
||||||
|
"git_tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/tags{/sha}",
|
||||||
|
"git_url": "git://github.com/crazy-max/test-docker-action.git",
|
||||||
|
"has_downloads": true,
|
||||||
|
"has_issues": false,
|
||||||
|
"has_pages": false,
|
||||||
|
"has_projects": true,
|
||||||
|
"has_wiki": false,
|
||||||
|
"homepage": "",
|
||||||
|
"hooks_url": "https://api.github.com/repos/crazy-max/test-docker-action/hooks",
|
||||||
|
"html_url": "https://github.com/crazy-max/test-docker-action",
|
||||||
|
"id": 385013169,
|
||||||
|
"is_template": false,
|
||||||
|
"issue_comment_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/comments{/number}",
|
||||||
|
"issue_events_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/events{/number}",
|
||||||
|
"issues_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues{/number}",
|
||||||
|
"keys_url": "https://api.github.com/repos/crazy-max/test-docker-action/keys{/key_id}",
|
||||||
|
"labels_url": "https://api.github.com/repos/crazy-max/test-docker-action/labels{/name}",
|
||||||
|
"language": "Dockerfile",
|
||||||
|
"languages_url": "https://api.github.com/repos/crazy-max/test-docker-action/languages",
|
||||||
|
"license": {
|
||||||
|
"key": "mit",
|
||||||
|
"name": "MIT License",
|
||||||
|
"node_id": "MDc6TGljZW5zZTEz",
|
||||||
|
"spdx_id": "MIT",
|
||||||
|
"url": "https://api.github.com/licenses/mit"
|
||||||
|
},
|
||||||
|
"merges_url": "https://api.github.com/repos/crazy-max/test-docker-action/merges",
|
||||||
|
"milestones_url": "https://api.github.com/repos/crazy-max/test-docker-action/milestones{/number}",
|
||||||
|
"mirror_url": null,
|
||||||
|
"name": "test-docker-action",
|
||||||
|
"node_id": "MDEwOlJlcG9zaXRvcnkzODUwMTMxNjk=",
|
||||||
|
"notifications_url": "https://api.github.com/repos/crazy-max/test-docker-action/notifications{?since,all,participating}",
|
||||||
|
"open_issues": 0,
|
||||||
|
"open_issues_count": 0,
|
||||||
|
"owner": {
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/1951866?v=4",
|
||||||
|
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
|
||||||
|
"followers_url": "https://api.github.com/users/crazy-max/followers",
|
||||||
|
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"html_url": "https://github.com/crazy-max",
|
||||||
|
"id": 1951866,
|
||||||
|
"login": "crazy-max",
|
||||||
|
"node_id": "MDQ6VXNlcjE5NTE4NjY=",
|
||||||
|
"organizations_url": "https://api.github.com/users/crazy-max/users",
|
||||||
|
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
|
||||||
|
"repos_url": "https://api.github.com/users/crazy-max/repos",
|
||||||
|
"site_admin": false,
|
||||||
|
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
|
||||||
|
"type": "User",
|
||||||
|
"url": "https://api.github.com/users/crazy-max"
|
||||||
|
},
|
||||||
|
"private": true,
|
||||||
|
"pulls_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls{/number}",
|
||||||
|
"pushed_at": "2021-10-21T21:46:11Z",
|
||||||
|
"releases_url": "https://api.github.com/repos/crazy-max/test-docker-action/releases{/id}",
|
||||||
|
"size": 151,
|
||||||
|
"ssh_url": "git@github.com:crazy-max/test-docker-action.git",
|
||||||
|
"stargazers_count": 0,
|
||||||
|
"stargazers_url": "https://api.github.com/repos/crazy-max/test-docker-action/stargazers",
|
||||||
|
"statuses_url": "https://api.github.com/repos/crazy-max/test-docker-action/statuses/{sha}",
|
||||||
|
"subscribers_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscribers",
|
||||||
|
"subscription_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscription",
|
||||||
|
"svn_url": "https://github.com/crazy-max/test-docker-action",
|
||||||
|
"tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/tags",
|
||||||
|
"teams_url": "https://api.github.com/repos/crazy-max/test-docker-action/teams",
|
||||||
|
"topics": [],
|
||||||
|
"trees_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/trees{/sha}",
|
||||||
|
"updated_at": "2021-07-15T07:56:00Z",
|
||||||
|
"url": "https://api.github.com/repos/crazy-max/test-docker-action",
|
||||||
|
"visibility": "private",
|
||||||
|
"watchers": 0,
|
||||||
|
"watchers_count": 0
|
||||||
|
},
|
||||||
|
"sha": "0337b3a374a0b833cf127b9111ca8c5589d93616",
|
||||||
|
"user": {
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/1951866?v=4",
|
||||||
|
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
|
||||||
|
"followers_url": "https://api.github.com/users/crazy-max/followers",
|
||||||
|
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"html_url": "https://github.com/crazy-max",
|
||||||
|
"id": 1951866,
|
||||||
|
"login": "crazy-max",
|
||||||
|
"node_id": "MDQ6VXNlcjE5NTE4NjY=",
|
||||||
|
"organizations_url": "https://api.github.com/users/crazy-max/users",
|
||||||
|
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
|
||||||
|
"repos_url": "https://api.github.com/users/crazy-max/repos",
|
||||||
|
"site_admin": false,
|
||||||
|
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
|
||||||
|
"type": "User",
|
||||||
|
"url": "https://api.github.com/users/crazy-max"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"html_url": "https://github.com/crazy-max/test-docker-action/pull/7",
|
||||||
|
"id": 763682530,
|
||||||
|
"issue_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/7",
|
||||||
|
"labels": [],
|
||||||
|
"locked": false,
|
||||||
|
"maintainer_can_modify": true,
|
||||||
|
"merge_commit_sha": null,
|
||||||
|
"mergeable": null,
|
||||||
|
"mergeable_state": "unknown",
|
||||||
|
"merged": false,
|
||||||
|
"merged_at": null,
|
||||||
|
"merged_by": null,
|
||||||
|
"milestone": null,
|
||||||
|
"node_id": "PR_kwDOEQjNNc4thN7i",
|
||||||
|
"number": 7,
|
||||||
|
"patch_url": "https://github.com/crazy-max/test-docker-action/pull/7.patch",
|
||||||
|
"rebaseable": null,
|
||||||
|
"requested_reviewers": [],
|
||||||
|
"requested_teams": [],
|
||||||
|
"review_comment_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/comments{/number}",
|
||||||
|
"review_comments": 0,
|
||||||
|
"review_comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/7/comments",
|
||||||
|
"state": "open",
|
||||||
|
"statuses_url": "https://api.github.com/repos/crazy-max/test-docker-action/statuses/0337b3a374a0b833cf127b9111ca8c5589d93616",
|
||||||
|
"title": "Trigger notification",
|
||||||
|
"updated_at": "2021-10-21T21:46:27Z",
|
||||||
|
"url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/7",
|
||||||
|
"user": {
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/1951866?v=4",
|
||||||
|
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
|
||||||
|
"followers_url": "https://api.github.com/users/crazy-max/followers",
|
||||||
|
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"html_url": "https://github.com/crazy-max",
|
||||||
|
"id": 1951866,
|
||||||
|
"login": "crazy-max",
|
||||||
|
"node_id": "MDQ6VXNlcjE5NTE4NjY=",
|
||||||
|
"organizations_url": "https://api.github.com/users/crazy-max/users",
|
||||||
|
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
|
||||||
|
"repos_url": "https://api.github.com/users/crazy-max/repos",
|
||||||
|
"site_admin": false,
|
||||||
|
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
|
||||||
|
"type": "User",
|
||||||
|
"url": "https://api.github.com/users/crazy-max"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"allow_forking": true,
|
||||||
|
"archive_url": "https://api.github.com/repos/crazy-max/test-docker-action/{archive_format}{/ref}",
|
||||||
|
"archived": false,
|
||||||
|
"assignees_url": "https://api.github.com/repos/crazy-max/test-docker-action/assignees{/user}",
|
||||||
|
"blobs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/blobs{/sha}",
|
||||||
|
"branches_url": "https://api.github.com/repos/crazy-max/test-docker-action/branches{/branch}",
|
||||||
|
"clone_url": "https://github.com/crazy-max/test-docker-action.git",
|
||||||
|
"collaborators_url": "https://api.github.com/repos/crazy-max/test-docker-action/collaborators{/collaborator}",
|
||||||
|
"comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/comments{/number}",
|
||||||
|
"commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/commits{/sha}",
|
||||||
|
"compare_url": "https://api.github.com/repos/crazy-max/test-docker-action/compare/{base}...{head}",
|
||||||
|
"contents_url": "https://api.github.com/repos/crazy-max/test-docker-action/contents/{+path}",
|
||||||
|
"contributors_url": "https://api.github.com/repos/crazy-max/test-docker-action/contributors",
|
||||||
|
"created_at": "2020-08-07T09:23:00Z",
|
||||||
|
"default_branch": "master",
|
||||||
|
"deployments_url": "https://api.github.com/repos/crazy-max/test-docker-action/deployments",
|
||||||
|
"description": "Test \"Docker\" Actions",
|
||||||
|
"disabled": false,
|
||||||
|
"downloads_url": "https://api.github.com/repos/crazy-max/test-docker-action/downloads",
|
||||||
|
"events_url": "https://api.github.com/repos/crazy-max/test-docker-action/events",
|
||||||
|
"fork": false,
|
||||||
|
"forks": 1,
|
||||||
|
"forks_count": 1,
|
||||||
|
"forks_url": "https://api.github.com/repos/crazy-max/test-docker-action/forks",
|
||||||
|
"full_name": "docker/test-docker-action",
|
||||||
|
"git_commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/commits{/sha}",
|
||||||
|
"git_refs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/refs{/sha}",
|
||||||
|
"git_tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/tags{/sha}",
|
||||||
|
"git_url": "git://github.com/crazy-max/test-docker-action.git",
|
||||||
|
"has_downloads": true,
|
||||||
|
"has_issues": false,
|
||||||
|
"has_pages": false,
|
||||||
|
"has_projects": false,
|
||||||
|
"has_wiki": false,
|
||||||
|
"homepage": "",
|
||||||
|
"hooks_url": "https://api.github.com/repos/crazy-max/test-docker-action/hooks",
|
||||||
|
"html_url": "https://github.com/crazy-max/test-docker-action",
|
||||||
|
"id": 285789493,
|
||||||
|
"is_template": false,
|
||||||
|
"issue_comment_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/comments{/number}",
|
||||||
|
"issue_events_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/events{/number}",
|
||||||
|
"issues_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues{/number}",
|
||||||
|
"keys_url": "https://api.github.com/repos/crazy-max/test-docker-action/keys{/key_id}",
|
||||||
|
"labels_url": "https://api.github.com/repos/crazy-max/test-docker-action/labels{/name}",
|
||||||
|
"language": "JavaScript",
|
||||||
|
"languages_url": "https://api.github.com/repos/crazy-max/test-docker-action/languages",
|
||||||
|
"license": {
|
||||||
|
"key": "mit",
|
||||||
|
"name": "MIT License",
|
||||||
|
"node_id": "MDc6TGljZW5zZTEz",
|
||||||
|
"spdx_id": "MIT",
|
||||||
|
"url": "https://api.github.com/licenses/mit"
|
||||||
|
},
|
||||||
|
"merges_url": "https://api.github.com/repos/crazy-max/test-docker-action/merges",
|
||||||
|
"milestones_url": "https://api.github.com/repos/crazy-max/test-docker-action/milestones{/number}",
|
||||||
|
"mirror_url": null,
|
||||||
|
"name": "test-docker-action",
|
||||||
|
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||||
|
"notifications_url": "https://api.github.com/repos/crazy-max/test-docker-action/notifications{?since,all,participating}",
|
||||||
|
"open_issues": 5,
|
||||||
|
"open_issues_count": 5,
|
||||||
|
"owner": {
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||||
|
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
|
||||||
|
"followers_url": "https://api.github.com/users/crazy-max/followers",
|
||||||
|
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"html_url": "https://github.com/crazy-max",
|
||||||
|
"id": 5429470,
|
||||||
|
"login": "docker",
|
||||||
|
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||||
|
"organizations_url": "https://api.github.com/users/crazy-max/users",
|
||||||
|
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
|
||||||
|
"repos_url": "https://api.github.com/users/crazy-max/repos",
|
||||||
|
"site_admin": false,
|
||||||
|
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
|
||||||
|
"type": "Organization",
|
||||||
|
"url": "https://api.github.com/users/crazy-max"
|
||||||
|
},
|
||||||
|
"private": true,
|
||||||
|
"pulls_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls{/number}",
|
||||||
|
"pushed_at": "2021-10-21T21:44:34Z",
|
||||||
|
"releases_url": "https://api.github.com/repos/crazy-max/test-docker-action/releases{/id}",
|
||||||
|
"size": 714,
|
||||||
|
"ssh_url": "git@github.com:docker/test-docker-action.git",
|
||||||
|
"stargazers_count": 0,
|
||||||
|
"stargazers_url": "https://api.github.com/repos/crazy-max/test-docker-action/stargazers",
|
||||||
|
"statuses_url": "https://api.github.com/repos/crazy-max/test-docker-action/statuses/{sha}",
|
||||||
|
"subscribers_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscribers",
|
||||||
|
"subscription_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscription",
|
||||||
|
"svn_url": "https://github.com/crazy-max/test-docker-action",
|
||||||
|
"tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/tags",
|
||||||
|
"teams_url": "https://api.github.com/repos/crazy-max/test-docker-action/teams",
|
||||||
|
"topics": [],
|
||||||
|
"trees_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/trees{/sha}",
|
||||||
|
"updated_at": "2021-10-21T21:44:37Z",
|
||||||
|
"url": "https://api.github.com/repos/crazy-max/test-docker-action",
|
||||||
|
"visibility": "private",
|
||||||
|
"watchers": 0,
|
||||||
|
"watchers_count": 0
|
||||||
|
},
|
||||||
|
"sender": {
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/1951866?v=4",
|
||||||
|
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
|
||||||
|
"followers_url": "https://api.github.com/users/crazy-max/followers",
|
||||||
|
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"html_url": "https://github.com/crazy-max",
|
||||||
|
"id": 1951866,
|
||||||
|
"login": "crazy-max",
|
||||||
|
"node_id": "MDQ6VXNlcjE5NTE4NjY=",
|
||||||
|
"organizations_url": "https://api.github.com/users/crazy-max/users",
|
||||||
|
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
|
||||||
|
"repos_url": "https://api.github.com/users/crazy-max/repos",
|
||||||
|
"site_admin": false,
|
||||||
|
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
|
||||||
|
"type": "User",
|
||||||
|
"url": "https://api.github.com/users/crazy-max"
|
||||||
|
}
|
||||||
|
}
|
25
__tests__/fixtures/event_pull_request_target.env
Normal file
25
__tests__/fixtures/event_pull_request_target.env
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
GITHUB_ACTION=crazy-maxghaction-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_cc4da131-0660-4771-8663-0f96c0fc944f
|
||||||
|
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-target
|
||||||
|
GITHUB_JOB=build
|
||||||
|
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_cc4da131-0660-4771-8663-0f96c0fc944f
|
||||||
|
GITHUB_REF=refs/heads/master
|
||||||
|
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||||
|
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||||
|
GITHUB_RETENTION_DAYS=90
|
||||||
|
GITHUB_RUN_ID=867725119
|
||||||
|
GITHUB_RUN_NUMBER=12
|
||||||
|
GITHUB_SERVER_URL=https://github.com
|
||||||
|
GITHUB_SHA=f24900bfcfee76d8055c8421a164c7e57ad20e68
|
||||||
|
GITHUB_WORKFLOW=push-ghcr
|
||||||
|
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
476
__tests__/fixtures/event_pull_request_target.json
Normal file
476
__tests__/fixtures/event_pull_request_target.json
Normal file
@@ -0,0 +1,476 @@
|
|||||||
|
{
|
||||||
|
"action": "synchronize",
|
||||||
|
"after": "57a8fb29acfb3c1e27c66226a8993fb4ef722e26",
|
||||||
|
"before": "18c4c149d695bdeba42643ef8343a6b8e466970c",
|
||||||
|
"number": 8,
|
||||||
|
"pull_request": {
|
||||||
|
"_links": {
|
||||||
|
"comments": {
|
||||||
|
"href": "https://api.github.com/repos/crazy-max/test-docker-action/issues/8/comments"
|
||||||
|
},
|
||||||
|
"commits": {
|
||||||
|
"href": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/8/commits"
|
||||||
|
},
|
||||||
|
"html": {
|
||||||
|
"href": "https://github.com/crazy-max/test-docker-action/pull/8"
|
||||||
|
},
|
||||||
|
"issue": {
|
||||||
|
"href": "https://api.github.com/repos/crazy-max/test-docker-action/issues/8"
|
||||||
|
},
|
||||||
|
"review_comment": {
|
||||||
|
"href": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/comments{/number}"
|
||||||
|
},
|
||||||
|
"review_comments": {
|
||||||
|
"href": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/8/comments"
|
||||||
|
},
|
||||||
|
"self": {
|
||||||
|
"href": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/8"
|
||||||
|
},
|
||||||
|
"statuses": {
|
||||||
|
"href": "https://api.github.com/repos/crazy-max/test-docker-action/statuses/57a8fb29acfb3c1e27c66226a8993fb4ef722e26"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"active_lock_reason": null,
|
||||||
|
"additions": 1,
|
||||||
|
"assignee": null,
|
||||||
|
"assignees": [],
|
||||||
|
"author_association": "OWNER",
|
||||||
|
"auto_merge": null,
|
||||||
|
"base": {
|
||||||
|
"label": "crazy-max:master",
|
||||||
|
"ref": "master",
|
||||||
|
"repo": {
|
||||||
|
"allow_merge_commit": true,
|
||||||
|
"allow_rebase_merge": true,
|
||||||
|
"allow_squash_merge": true,
|
||||||
|
"archive_url": "https://api.github.com/repos/crazy-max/test-docker-action/{archive_format}{/ref}",
|
||||||
|
"archived": false,
|
||||||
|
"assignees_url": "https://api.github.com/repos/crazy-max/test-docker-action/assignees{/user}",
|
||||||
|
"blobs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/blobs{/sha}",
|
||||||
|
"branches_url": "https://api.github.com/repos/crazy-max/test-docker-action/branches{/branch}",
|
||||||
|
"clone_url": "https://github.com/crazy-max/test-docker-action.git",
|
||||||
|
"collaborators_url": "https://api.github.com/repos/crazy-max/test-docker-action/collaborators{/collaborator}",
|
||||||
|
"comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/comments{/number}",
|
||||||
|
"commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/commits{/sha}",
|
||||||
|
"compare_url": "https://api.github.com/repos/crazy-max/test-docker-action/compare/{base}...{head}",
|
||||||
|
"contents_url": "https://api.github.com/repos/crazy-max/test-docker-action/contents/{+path}",
|
||||||
|
"contributors_url": "https://api.github.com/repos/crazy-max/test-docker-action/contributors",
|
||||||
|
"created_at": "2020-08-07T09:23:00Z",
|
||||||
|
"default_branch": "master",
|
||||||
|
"delete_branch_on_merge": false,
|
||||||
|
"deployments_url": "https://api.github.com/repos/crazy-max/test-docker-action/deployments",
|
||||||
|
"description": "Test \"Docker\" Actions",
|
||||||
|
"disabled": false,
|
||||||
|
"downloads_url": "https://api.github.com/repos/crazy-max/test-docker-action/downloads",
|
||||||
|
"events_url": "https://api.github.com/repos/crazy-max/test-docker-action/events",
|
||||||
|
"fork": false,
|
||||||
|
"forks": 4,
|
||||||
|
"forks_count": 4,
|
||||||
|
"forks_url": "https://api.github.com/repos/crazy-max/test-docker-action/forks",
|
||||||
|
"full_name": "crazy-max/test-docker-action",
|
||||||
|
"git_commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/commits{/sha}",
|
||||||
|
"git_refs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/refs{/sha}",
|
||||||
|
"git_tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/tags{/sha}",
|
||||||
|
"git_url": "git://github.com/crazy-max/test-docker-action.git",
|
||||||
|
"has_downloads": true,
|
||||||
|
"has_issues": false,
|
||||||
|
"has_pages": false,
|
||||||
|
"has_projects": false,
|
||||||
|
"has_wiki": false,
|
||||||
|
"homepage": "",
|
||||||
|
"hooks_url": "https://api.github.com/repos/crazy-max/test-docker-action/hooks",
|
||||||
|
"html_url": "https://github.com/crazy-max/test-docker-action",
|
||||||
|
"id": 285789493,
|
||||||
|
"issue_comment_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/comments{/number}",
|
||||||
|
"issue_events_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/events{/number}",
|
||||||
|
"issues_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues{/number}",
|
||||||
|
"keys_url": "https://api.github.com/repos/crazy-max/test-docker-action/keys{/key_id}",
|
||||||
|
"labels_url": "https://api.github.com/repos/crazy-max/test-docker-action/labels{/name}",
|
||||||
|
"language": "Dockerfile",
|
||||||
|
"languages_url": "https://api.github.com/repos/crazy-max/test-docker-action/languages",
|
||||||
|
"license": {
|
||||||
|
"key": "mit",
|
||||||
|
"name": "MIT License",
|
||||||
|
"node_id": "MDc6TGljZW5zZTEz",
|
||||||
|
"spdx_id": "MIT",
|
||||||
|
"url": "https://api.github.com/licenses/mit"
|
||||||
|
},
|
||||||
|
"merges_url": "https://api.github.com/repos/crazy-max/test-docker-action/merges",
|
||||||
|
"milestones_url": "https://api.github.com/repos/crazy-max/test-docker-action/milestones{/number}",
|
||||||
|
"mirror_url": null,
|
||||||
|
"name": "test-docker-action",
|
||||||
|
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||||
|
"notifications_url": "https://api.github.com/repos/crazy-max/test-docker-action/notifications{?since,all,participating}",
|
||||||
|
"open_issues": 4,
|
||||||
|
"open_issues_count": 4,
|
||||||
|
"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": false,
|
||||||
|
"pulls_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls{/number}",
|
||||||
|
"pushed_at": "2021-05-23T01:38:41Z",
|
||||||
|
"releases_url": "https://api.github.com/repos/crazy-max/test-docker-action/releases{/id}",
|
||||||
|
"size": 137,
|
||||||
|
"ssh_url": "git@github.com:crazy-max/test-docker-action.git",
|
||||||
|
"stargazers_count": 3,
|
||||||
|
"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",
|
||||||
|
"trees_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/trees{/sha}",
|
||||||
|
"updated_at": "2021-05-23T01:37:33Z",
|
||||||
|
"url": "https://api.github.com/repos/crazy-max/test-docker-action",
|
||||||
|
"watchers": 3,
|
||||||
|
"watchers_count": 3
|
||||||
|
},
|
||||||
|
"sha": "2b13c4617af78dc00a6304390682f234a53f3665",
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": "",
|
||||||
|
"changed_files": 1,
|
||||||
|
"closed_at": null,
|
||||||
|
"comments": 0,
|
||||||
|
"comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/8/comments",
|
||||||
|
"commits": 2,
|
||||||
|
"commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/8/commits",
|
||||||
|
"created_at": "2021-05-23T01:24:57Z",
|
||||||
|
"deletions": 1,
|
||||||
|
"diff_url": "https://github.com/crazy-max/test-docker-action/pull/8.diff",
|
||||||
|
"draft": false,
|
||||||
|
"head": {
|
||||||
|
"label": "crazy-max:test-pr-target",
|
||||||
|
"ref": "test-pr-target",
|
||||||
|
"repo": {
|
||||||
|
"allow_merge_commit": true,
|
||||||
|
"allow_rebase_merge": true,
|
||||||
|
"allow_squash_merge": true,
|
||||||
|
"archive_url": "https://api.github.com/repos/crazy-max/test-docker-action/{archive_format}{/ref}",
|
||||||
|
"archived": false,
|
||||||
|
"assignees_url": "https://api.github.com/repos/crazy-max/test-docker-action/assignees{/user}",
|
||||||
|
"blobs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/blobs{/sha}",
|
||||||
|
"branches_url": "https://api.github.com/repos/crazy-max/test-docker-action/branches{/branch}",
|
||||||
|
"clone_url": "https://github.com/crazy-max/test-docker-action.git",
|
||||||
|
"collaborators_url": "https://api.github.com/repos/crazy-max/test-docker-action/collaborators{/collaborator}",
|
||||||
|
"comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/comments{/number}",
|
||||||
|
"commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/commits{/sha}",
|
||||||
|
"compare_url": "https://api.github.com/repos/crazy-max/test-docker-action/compare/{base}...{head}",
|
||||||
|
"contents_url": "https://api.github.com/repos/crazy-max/test-docker-action/contents/{+path}",
|
||||||
|
"contributors_url": "https://api.github.com/repos/crazy-max/test-docker-action/contributors",
|
||||||
|
"created_at": "2020-08-07T09:23:00Z",
|
||||||
|
"default_branch": "master",
|
||||||
|
"delete_branch_on_merge": false,
|
||||||
|
"deployments_url": "https://api.github.com/repos/crazy-max/test-docker-action/deployments",
|
||||||
|
"description": "Test \"Docker\" Actions",
|
||||||
|
"disabled": false,
|
||||||
|
"downloads_url": "https://api.github.com/repos/crazy-max/test-docker-action/downloads",
|
||||||
|
"events_url": "https://api.github.com/repos/crazy-max/test-docker-action/events",
|
||||||
|
"fork": false,
|
||||||
|
"forks": 4,
|
||||||
|
"forks_count": 4,
|
||||||
|
"forks_url": "https://api.github.com/repos/crazy-max/test-docker-action/forks",
|
||||||
|
"full_name": "crazy-max/test-docker-action",
|
||||||
|
"git_commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/commits{/sha}",
|
||||||
|
"git_refs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/refs{/sha}",
|
||||||
|
"git_tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/tags{/sha}",
|
||||||
|
"git_url": "git://github.com/crazy-max/test-docker-action.git",
|
||||||
|
"has_downloads": true,
|
||||||
|
"has_issues": false,
|
||||||
|
"has_pages": false,
|
||||||
|
"has_projects": false,
|
||||||
|
"has_wiki": false,
|
||||||
|
"homepage": "",
|
||||||
|
"hooks_url": "https://api.github.com/repos/crazy-max/test-docker-action/hooks",
|
||||||
|
"html_url": "https://github.com/crazy-max/test-docker-action",
|
||||||
|
"id": 285789493,
|
||||||
|
"issue_comment_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/comments{/number}",
|
||||||
|
"issue_events_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/events{/number}",
|
||||||
|
"issues_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues{/number}",
|
||||||
|
"keys_url": "https://api.github.com/repos/crazy-max/test-docker-action/keys{/key_id}",
|
||||||
|
"labels_url": "https://api.github.com/repos/crazy-max/test-docker-action/labels{/name}",
|
||||||
|
"language": "Dockerfile",
|
||||||
|
"languages_url": "https://api.github.com/repos/crazy-max/test-docker-action/languages",
|
||||||
|
"license": {
|
||||||
|
"key": "mit",
|
||||||
|
"name": "MIT License",
|
||||||
|
"node_id": "MDc6TGljZW5zZTEz",
|
||||||
|
"spdx_id": "MIT",
|
||||||
|
"url": "https://api.github.com/licenses/mit"
|
||||||
|
},
|
||||||
|
"merges_url": "https://api.github.com/repos/crazy-max/test-docker-action/merges",
|
||||||
|
"milestones_url": "https://api.github.com/repos/crazy-max/test-docker-action/milestones{/number}",
|
||||||
|
"mirror_url": null,
|
||||||
|
"name": "test-docker-action",
|
||||||
|
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||||
|
"notifications_url": "https://api.github.com/repos/crazy-max/test-docker-action/notifications{?since,all,participating}",
|
||||||
|
"open_issues": 4,
|
||||||
|
"open_issues_count": 4,
|
||||||
|
"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": false,
|
||||||
|
"pulls_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls{/number}",
|
||||||
|
"pushed_at": "2021-05-23T01:38:41Z",
|
||||||
|
"releases_url": "https://api.github.com/repos/crazy-max/test-docker-action/releases{/id}",
|
||||||
|
"size": 137,
|
||||||
|
"ssh_url": "git@github.com:crazy-max/test-docker-action.git",
|
||||||
|
"stargazers_count": 3,
|
||||||
|
"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",
|
||||||
|
"trees_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/trees{/sha}",
|
||||||
|
"updated_at": "2021-05-23T01:37:33Z",
|
||||||
|
"url": "https://api.github.com/repos/crazy-max/test-docker-action",
|
||||||
|
"watchers": 3,
|
||||||
|
"watchers_count": 3
|
||||||
|
},
|
||||||
|
"sha": "57a8fb29acfb3c1e27c66226a8993fb4ef722e26",
|
||||||
|
"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/crazy-max/test-docker-action/pull/8",
|
||||||
|
"id": 650710002,
|
||||||
|
"issue_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/8",
|
||||||
|
"labels": [],
|
||||||
|
"locked": false,
|
||||||
|
"maintainer_can_modify": false,
|
||||||
|
"merge_commit_sha": "823b99c3c3cf5421e6ff0514b13a44bf21c7a4f0",
|
||||||
|
"mergeable": null,
|
||||||
|
"mergeable_state": "unknown",
|
||||||
|
"merged": false,
|
||||||
|
"merged_at": null,
|
||||||
|
"merged_by": null,
|
||||||
|
"milestone": null,
|
||||||
|
"node_id": "MDExOlB1bGxSZXF1ZXN0NjUwNzEwMDAy",
|
||||||
|
"number": 8,
|
||||||
|
"patch_url": "https://github.com/crazy-max/test-docker-action/pull/8.patch",
|
||||||
|
"rebaseable": null,
|
||||||
|
"requested_reviewers": [],
|
||||||
|
"requested_teams": [],
|
||||||
|
"review_comment_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/comments{/number}",
|
||||||
|
"review_comments": 0,
|
||||||
|
"review_comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/8/comments",
|
||||||
|
"state": "open",
|
||||||
|
"statuses_url": "https://api.github.com/repos/crazy-max/test-docker-action/statuses/57a8fb29acfb3c1e27c66226a8993fb4ef722e26",
|
||||||
|
"title": "Test PR target",
|
||||||
|
"updated_at": "2021-05-23T01:38:42Z",
|
||||||
|
"url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls/8",
|
||||||
|
"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": {
|
||||||
|
"archive_url": "https://api.github.com/repos/crazy-max/test-docker-action/{archive_format}{/ref}",
|
||||||
|
"archived": false,
|
||||||
|
"assignees_url": "https://api.github.com/repos/crazy-max/test-docker-action/assignees{/user}",
|
||||||
|
"blobs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/blobs{/sha}",
|
||||||
|
"branches_url": "https://api.github.com/repos/crazy-max/test-docker-action/branches{/branch}",
|
||||||
|
"clone_url": "https://github.com/crazy-max/test-docker-action.git",
|
||||||
|
"collaborators_url": "https://api.github.com/repos/crazy-max/test-docker-action/collaborators{/collaborator}",
|
||||||
|
"comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/comments{/number}",
|
||||||
|
"commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/commits{/sha}",
|
||||||
|
"compare_url": "https://api.github.com/repos/crazy-max/test-docker-action/compare/{base}...{head}",
|
||||||
|
"contents_url": "https://api.github.com/repos/crazy-max/test-docker-action/contents/{+path}",
|
||||||
|
"contributors_url": "https://api.github.com/repos/crazy-max/test-docker-action/contributors",
|
||||||
|
"created_at": "2020-08-07T09:23:00Z",
|
||||||
|
"default_branch": "master",
|
||||||
|
"deployments_url": "https://api.github.com/repos/crazy-max/test-docker-action/deployments",
|
||||||
|
"description": "Test \"Docker\" Actions",
|
||||||
|
"disabled": false,
|
||||||
|
"downloads_url": "https://api.github.com/repos/crazy-max/test-docker-action/downloads",
|
||||||
|
"events_url": "https://api.github.com/repos/crazy-max/test-docker-action/events",
|
||||||
|
"fork": false,
|
||||||
|
"forks": 4,
|
||||||
|
"forks_count": 4,
|
||||||
|
"forks_url": "https://api.github.com/repos/crazy-max/test-docker-action/forks",
|
||||||
|
"full_name": "crazy-max/test-docker-action",
|
||||||
|
"git_commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/commits{/sha}",
|
||||||
|
"git_refs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/refs{/sha}",
|
||||||
|
"git_tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/tags{/sha}",
|
||||||
|
"git_url": "git://github.com/crazy-max/test-docker-action.git",
|
||||||
|
"has_downloads": true,
|
||||||
|
"has_issues": false,
|
||||||
|
"has_pages": false,
|
||||||
|
"has_projects": false,
|
||||||
|
"has_wiki": false,
|
||||||
|
"homepage": "",
|
||||||
|
"hooks_url": "https://api.github.com/repos/crazy-max/test-docker-action/hooks",
|
||||||
|
"html_url": "https://github.com/crazy-max/test-docker-action",
|
||||||
|
"id": 285789493,
|
||||||
|
"issue_comment_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/comments{/number}",
|
||||||
|
"issue_events_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/events{/number}",
|
||||||
|
"issues_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues{/number}",
|
||||||
|
"keys_url": "https://api.github.com/repos/crazy-max/test-docker-action/keys{/key_id}",
|
||||||
|
"labels_url": "https://api.github.com/repos/crazy-max/test-docker-action/labels{/name}",
|
||||||
|
"language": "Dockerfile",
|
||||||
|
"languages_url": "https://api.github.com/repos/crazy-max/test-docker-action/languages",
|
||||||
|
"license": {
|
||||||
|
"key": "mit",
|
||||||
|
"name": "MIT License",
|
||||||
|
"node_id": "MDc6TGljZW5zZTEz",
|
||||||
|
"spdx_id": "MIT",
|
||||||
|
"url": "https://api.github.com/licenses/mit"
|
||||||
|
},
|
||||||
|
"merges_url": "https://api.github.com/repos/crazy-max/test-docker-action/merges",
|
||||||
|
"milestones_url": "https://api.github.com/repos/crazy-max/test-docker-action/milestones{/number}",
|
||||||
|
"mirror_url": null,
|
||||||
|
"name": "test-docker-action",
|
||||||
|
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||||
|
"notifications_url": "https://api.github.com/repos/crazy-max/test-docker-action/notifications{?since,all,participating}",
|
||||||
|
"open_issues": 4,
|
||||||
|
"open_issues_count": 4,
|
||||||
|
"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": false,
|
||||||
|
"pulls_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls{/number}",
|
||||||
|
"pushed_at": "2021-05-23T01:38:41Z",
|
||||||
|
"releases_url": "https://api.github.com/repos/crazy-max/test-docker-action/releases{/id}",
|
||||||
|
"size": 137,
|
||||||
|
"ssh_url": "git@github.com:crazy-max/test-docker-action.git",
|
||||||
|
"stargazers_count": 3,
|
||||||
|
"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",
|
||||||
|
"trees_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/trees{/sha}",
|
||||||
|
"updated_at": "2021-05-23T01:37:33Z",
|
||||||
|
"url": "https://api.github.com/repos/crazy-max/test-docker-action",
|
||||||
|
"watchers": 3,
|
||||||
|
"watchers_count": 3
|
||||||
|
},
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
@@ -6,7 +6,7 @@ GITHUB_API_URL=https://api.github.com
|
|||||||
GITHUB_BASE_REF=
|
GITHUB_BASE_REF=
|
||||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_89a016e8-e5b7-4039-a67e-c8da08f87a0c
|
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_89a016e8-e5b7-4039-a67e-c8da08f87a0c
|
||||||
GITHUB_EVENT_NAME=push
|
GITHUB_EVENT_NAME=push
|
||||||
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
|
GITHUB_EVENT_PATH=./__tests__/fixtures/event_push.json
|
||||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||||
GITHUB_HEAD_REF=
|
GITHUB_HEAD_REF=
|
||||||
GITHUB_JOB=event
|
GITHUB_JOB=event
|
||||||
|
181
__tests__/fixtures/event_push.json
Normal file
181
__tests__/fixtures/event_push.json
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
{
|
||||||
|
"after": "ce1a91a20f9e2c064bcd76a7b95e091f831cf653",
|
||||||
|
"base_ref": null,
|
||||||
|
"before": "b0d66d13d5e8c795e0fc4b6c732b6b521807eca7",
|
||||||
|
"commits": [
|
||||||
|
{
|
||||||
|
"author": {
|
||||||
|
"email": "crazy-max@users.noreply.github.com",
|
||||||
|
"name": "CrazyMax",
|
||||||
|
"username": "crazy-max"
|
||||||
|
},
|
||||||
|
"committer": {
|
||||||
|
"email": "crazy-max@users.noreply.github.com",
|
||||||
|
"name": "CrazyMax",
|
||||||
|
"username": "crazy-max"
|
||||||
|
},
|
||||||
|
"distinct": true,
|
||||||
|
"id": "ce1a91a20f9e2c064bcd76a7b95e091f831cf653",
|
||||||
|
"message": "Fix workflow",
|
||||||
|
"timestamp": "2021-10-21T23:44:33+02:00",
|
||||||
|
"tree_id": "8e46bf0c7fd95050deb02b11f0bc8c475c7428f3",
|
||||||
|
"url": "https://github.com/crazy-max/test-docker-action/commit/ce1a91a20f9e2c064bcd76a7b95e091f831cf653"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"compare": "https://github.com/crazy-max/test-docker-action/compare/b0d66d13d5e8...ce1a91a20f9e",
|
||||||
|
"created": false,
|
||||||
|
"deleted": false,
|
||||||
|
"forced": false,
|
||||||
|
"head_commit": {
|
||||||
|
"author": {
|
||||||
|
"email": "crazy-max@users.noreply.github.com",
|
||||||
|
"name": "CrazyMax",
|
||||||
|
"username": "crazy-max"
|
||||||
|
},
|
||||||
|
"committer": {
|
||||||
|
"email": "crazy-max@users.noreply.github.com",
|
||||||
|
"name": "CrazyMax",
|
||||||
|
"username": "crazy-max"
|
||||||
|
},
|
||||||
|
"distinct": true,
|
||||||
|
"id": "ce1a91a20f9e2c064bcd76a7b95e091f831cf653",
|
||||||
|
"message": "Fix workflow",
|
||||||
|
"timestamp": "2021-10-21T23:44:33+02:00",
|
||||||
|
"tree_id": "8e46bf0c7fd95050deb02b11f0bc8c475c7428f3",
|
||||||
|
"url": "https://github.com/crazy-max/test-docker-action/commit/ce1a91a20f9e2c064bcd76a7b95e091f831cf653"
|
||||||
|
},
|
||||||
|
"pusher": {
|
||||||
|
"email": "crazy-max@users.noreply.github.com",
|
||||||
|
"name": "crazy-max"
|
||||||
|
},
|
||||||
|
"ref": "refs/heads/master",
|
||||||
|
"repository": {
|
||||||
|
"allow_forking": true,
|
||||||
|
"archive_url": "https://api.github.com/repos/crazy-max/test-docker-action/{archive_format}{/ref}",
|
||||||
|
"archived": false,
|
||||||
|
"assignees_url": "https://api.github.com/repos/crazy-max/test-docker-action/assignees{/user}",
|
||||||
|
"blobs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/blobs{/sha}",
|
||||||
|
"branches_url": "https://api.github.com/repos/crazy-max/test-docker-action/branches{/branch}",
|
||||||
|
"clone_url": "https://github.com/crazy-max/test-docker-action.git",
|
||||||
|
"collaborators_url": "https://api.github.com/repos/crazy-max/test-docker-action/collaborators{/collaborator}",
|
||||||
|
"comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/comments{/number}",
|
||||||
|
"commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/commits{/sha}",
|
||||||
|
"compare_url": "https://api.github.com/repos/crazy-max/test-docker-action/compare/{base}...{head}",
|
||||||
|
"contents_url": "https://api.github.com/repos/crazy-max/test-docker-action/contents/{+path}",
|
||||||
|
"contributors_url": "https://api.github.com/repos/crazy-max/test-docker-action/contributors",
|
||||||
|
"created_at": 1596792180,
|
||||||
|
"default_branch": "master",
|
||||||
|
"deployments_url": "https://api.github.com/repos/crazy-max/test-docker-action/deployments",
|
||||||
|
"description": "Test \"Docker\" Actions",
|
||||||
|
"disabled": false,
|
||||||
|
"downloads_url": "https://api.github.com/repos/crazy-max/test-docker-action/downloads",
|
||||||
|
"events_url": "https://api.github.com/repos/crazy-max/test-docker-action/events",
|
||||||
|
"fork": false,
|
||||||
|
"forks": 1,
|
||||||
|
"forks_count": 1,
|
||||||
|
"forks_url": "https://api.github.com/repos/crazy-max/test-docker-action/forks",
|
||||||
|
"full_name": "crazy-max/test-docker-action",
|
||||||
|
"git_commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/commits{/sha}",
|
||||||
|
"git_refs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/refs{/sha}",
|
||||||
|
"git_tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/tags{/sha}",
|
||||||
|
"git_url": "git://github.com/crazy-max/test-docker-action.git",
|
||||||
|
"has_downloads": true,
|
||||||
|
"has_issues": false,
|
||||||
|
"has_pages": false,
|
||||||
|
"has_projects": false,
|
||||||
|
"has_wiki": false,
|
||||||
|
"homepage": "",
|
||||||
|
"hooks_url": "https://api.github.com/repos/crazy-max/test-docker-action/hooks",
|
||||||
|
"html_url": "https://github.com/crazy-max/test-docker-action",
|
||||||
|
"id": 285789493,
|
||||||
|
"is_template": false,
|
||||||
|
"issue_comment_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/comments{/number}",
|
||||||
|
"issue_events_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/events{/number}",
|
||||||
|
"issues_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues{/number}",
|
||||||
|
"keys_url": "https://api.github.com/repos/crazy-max/test-docker-action/keys{/key_id}",
|
||||||
|
"labels_url": "https://api.github.com/repos/crazy-max/test-docker-action/labels{/name}",
|
||||||
|
"language": "JavaScript",
|
||||||
|
"languages_url": "https://api.github.com/repos/crazy-max/test-docker-action/languages",
|
||||||
|
"license": {
|
||||||
|
"key": "mit",
|
||||||
|
"name": "MIT License",
|
||||||
|
"node_id": "MDc6TGljZW5zZTEz",
|
||||||
|
"spdx_id": "MIT",
|
||||||
|
"url": "https://api.github.com/licenses/mit"
|
||||||
|
},
|
||||||
|
"master_branch": "master",
|
||||||
|
"merges_url": "https://api.github.com/repos/crazy-max/test-docker-action/merges",
|
||||||
|
"milestones_url": "https://api.github.com/repos/crazy-max/test-docker-action/milestones{/number}",
|
||||||
|
"mirror_url": null,
|
||||||
|
"name": "test-docker-action",
|
||||||
|
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||||
|
"notifications_url": "https://api.github.com/repos/crazy-max/test-docker-action/notifications{?since,all,participating}",
|
||||||
|
"open_issues": 4,
|
||||||
|
"open_issues_count": 4,
|
||||||
|
"organization": "docker",
|
||||||
|
"owner": {
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||||
|
"email": "info@docker.com",
|
||||||
|
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
|
||||||
|
"followers_url": "https://api.github.com/users/crazy-max/followers",
|
||||||
|
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"html_url": "https://github.com/crazy-max",
|
||||||
|
"id": 5429470,
|
||||||
|
"login": "docker",
|
||||||
|
"name": "docker",
|
||||||
|
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||||
|
"organizations_url": "https://api.github.com/users/crazy-max/users",
|
||||||
|
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
|
||||||
|
"repos_url": "https://api.github.com/users/crazy-max/repos",
|
||||||
|
"site_admin": false,
|
||||||
|
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
|
||||||
|
"type": "Organization",
|
||||||
|
"url": "https://api.github.com/users/crazy-max"
|
||||||
|
},
|
||||||
|
"private": true,
|
||||||
|
"pulls_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls{/number}",
|
||||||
|
"pushed_at": 1634852674,
|
||||||
|
"releases_url": "https://api.github.com/repos/crazy-max/test-docker-action/releases{/id}",
|
||||||
|
"size": 714,
|
||||||
|
"ssh_url": "git@github.com:crazy-max/test-docker-action.git",
|
||||||
|
"stargazers": 0,
|
||||||
|
"stargazers_count": 0,
|
||||||
|
"stargazers_url": "https://api.github.com/repos/crazy-max/test-docker-action/stargazers",
|
||||||
|
"statuses_url": "https://api.github.com/repos/crazy-max/test-docker-action/statuses/{sha}",
|
||||||
|
"subscribers_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscribers",
|
||||||
|
"subscription_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscription",
|
||||||
|
"svn_url": "https://github.com/crazy-max/test-docker-action",
|
||||||
|
"tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/tags",
|
||||||
|
"teams_url": "https://api.github.com/repos/crazy-max/test-docker-action/teams",
|
||||||
|
"topics": [],
|
||||||
|
"trees_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/trees{/sha}",
|
||||||
|
"updated_at": "2021-10-21T21:43:51Z",
|
||||||
|
"url": "https://github.com/crazy-max/test-docker-action",
|
||||||
|
"visibility": "private",
|
||||||
|
"watchers": 0,
|
||||||
|
"watchers_count": 0
|
||||||
|
},
|
||||||
|
"sender": {
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/1951866?v=4",
|
||||||
|
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
|
||||||
|
"followers_url": "https://api.github.com/users/crazy-max/followers",
|
||||||
|
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"html_url": "https://github.com/crazy-max",
|
||||||
|
"id": 1951866,
|
||||||
|
"login": "crazy-max",
|
||||||
|
"node_id": "MDQ6VXNlcjE5NTE4NjY=",
|
||||||
|
"organizations_url": "https://api.github.com/users/crazy-max/users",
|
||||||
|
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
|
||||||
|
"repos_url": "https://api.github.com/users/crazy-max/repos",
|
||||||
|
"site_admin": false,
|
||||||
|
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
|
||||||
|
"type": "User",
|
||||||
|
"url": "https://api.github.com/users/crazy-max"
|
||||||
|
}
|
||||||
|
}
|
23
__tests__/fixtures/event_push_invalidchars.env
Normal file
23
__tests__/fixtures/event_push_invalidchars.env
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
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/my/feature#1245"
|
||||||
|
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
|
23
__tests__/fixtures/event_tag_1.0dev4.env
Normal file
23
__tests__/fixtures/event_tag_1.0dev4.env
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
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_6ee180c2-b331-434a-a867-89534cbefd83
|
||||||
|
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_6ee180c2-b331-434a-a867-89534cbefd83
|
||||||
|
GITHUB_REF=refs/tags/1.0dev4
|
||||||
|
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||||
|
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||||
|
GITHUB_RETENTION_DAYS=90
|
||||||
|
GITHUB_RUN_ID=325968230
|
||||||
|
GITHUB_RUN_NUMBER=4
|
||||||
|
GITHUB_SERVER_URL=https://github.com
|
||||||
|
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||||
|
GITHUB_WORKFLOW=event
|
||||||
|
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
23
__tests__/fixtures/event_tag_1.1beta2.env
Normal file
23
__tests__/fixtures/event_tag_1.1beta2.env
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
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_6ee180c2-b331-434a-a867-89534cbefd83
|
||||||
|
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_6ee180c2-b331-434a-a867-89534cbefd83
|
||||||
|
GITHUB_REF=refs/tags/1.1beta2
|
||||||
|
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||||
|
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||||
|
GITHUB_RETENTION_DAYS=90
|
||||||
|
GITHUB_RUN_ID=325968230
|
||||||
|
GITHUB_RUN_NUMBER=4
|
||||||
|
GITHUB_SERVER_URL=https://github.com
|
||||||
|
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||||
|
GITHUB_WORKFLOW=event
|
||||||
|
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
23
__tests__/fixtures/event_tag_1.2.3rc2.env
Normal file
23
__tests__/fixtures/event_tag_1.2.3rc2.env
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
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_6ee180c2-b331-434a-a867-89534cbefd83
|
||||||
|
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_6ee180c2-b331-434a-a867-89534cbefd83
|
||||||
|
GITHUB_REF=refs/tags/1.2.3rc2
|
||||||
|
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||||
|
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||||
|
GITHUB_RETENTION_DAYS=90
|
||||||
|
GITHUB_RUN_ID=325968230
|
||||||
|
GITHUB_RUN_NUMBER=4
|
||||||
|
GITHUB_SERVER_URL=https://github.com
|
||||||
|
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||||
|
GITHUB_WORKFLOW=event
|
||||||
|
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
23
__tests__/fixtures/event_tag_1.2.env
Normal file
23
__tests__/fixtures/event_tag_1.2.env
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
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_6ee180c2-b331-434a-a867-89534cbefd83
|
||||||
|
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_6ee180c2-b331-434a-a867-89534cbefd83
|
||||||
|
GITHUB_REF=refs/tags/1.2
|
||||||
|
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||||
|
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||||
|
GITHUB_RETENTION_DAYS=90
|
||||||
|
GITHUB_RUN_ID=325968230
|
||||||
|
GITHUB_RUN_NUMBER=4
|
||||||
|
GITHUB_SERVER_URL=https://github.com
|
||||||
|
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||||
|
GITHUB_WORKFLOW=event
|
||||||
|
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
23
__tests__/fixtures/event_tag_1.2post1.env
Normal file
23
__tests__/fixtures/event_tag_1.2post1.env
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
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_6ee180c2-b331-434a-a867-89534cbefd83
|
||||||
|
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_6ee180c2-b331-434a-a867-89534cbefd83
|
||||||
|
GITHUB_REF=refs/tags/1.2post1
|
||||||
|
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||||
|
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||||
|
GITHUB_RETENTION_DAYS=90
|
||||||
|
GITHUB_RUN_ID=325968230
|
||||||
|
GITHUB_RUN_NUMBER=4
|
||||||
|
GITHUB_SERVER_URL=https://github.com
|
||||||
|
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||||
|
GITHUB_WORKFLOW=event
|
||||||
|
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
23
__tests__/fixtures/event_tag_p1-v1.0.0.env
Normal file
23
__tests__/fixtures/event_tag_p1-v1.0.0.env
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
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_6ee180c2-b331-434a-a867-89534cbefd83
|
||||||
|
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_6ee180c2-b331-434a-a867-89534cbefd83
|
||||||
|
GITHUB_REF=refs/tags/p1/v1.0.0
|
||||||
|
GITHUB_REPOSITORY=crazy-max/test-docker-action
|
||||||
|
GITHUB_REPOSITORY_OWNER=crazy-max
|
||||||
|
GITHUB_RETENTION_DAYS=90
|
||||||
|
GITHUB_RUN_ID=325968230
|
||||||
|
GITHUB_RUN_NUMBER=4
|
||||||
|
GITHUB_SERVER_URL=https://github.com
|
||||||
|
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
|
||||||
|
GITHUB_WORKFLOW=event
|
||||||
|
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action
|
@@ -6,7 +6,7 @@ GITHUB_API_URL=https://api.github.com
|
|||||||
GITHUB_BASE_REF=
|
GITHUB_BASE_REF=
|
||||||
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_6ee180c2-b331-434a-a867-89534cbefd83
|
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_6ee180c2-b331-434a-a867-89534cbefd83
|
||||||
GITHUB_EVENT_NAME=push
|
GITHUB_EVENT_NAME=push
|
||||||
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
|
GITHUB_EVENT_PATH=./__tests__/fixtures/event_tag_v1.1.1.json
|
||||||
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
|
||||||
GITHUB_HEAD_REF=
|
GITHUB_HEAD_REF=
|
||||||
GITHUB_JOB=event
|
GITHUB_JOB=event
|
||||||
|
162
__tests__/fixtures/event_tag_v1.1.1.json
Normal file
162
__tests__/fixtures/event_tag_v1.1.1.json
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
{
|
||||||
|
"after": "8415a46e9494b78eca43a2dd8dca716b86b9df85",
|
||||||
|
"base_ref": "refs/heads/master",
|
||||||
|
"before": "0000000000000000000000000000000000000000",
|
||||||
|
"commits": [],
|
||||||
|
"compare": "https://github.com/crazy-max/test-docker-action/compare/v1.1.1",
|
||||||
|
"created": true,
|
||||||
|
"deleted": false,
|
||||||
|
"forced": false,
|
||||||
|
"head_commit": {
|
||||||
|
"author": {
|
||||||
|
"email": "crazy-max@users.noreply.github.com",
|
||||||
|
"name": "CrazyMax",
|
||||||
|
"username": "crazy-max"
|
||||||
|
},
|
||||||
|
"committer": {
|
||||||
|
"email": "noreply@github.com",
|
||||||
|
"name": "GitHub",
|
||||||
|
"username": "web-flow"
|
||||||
|
},
|
||||||
|
"distinct": true,
|
||||||
|
"id": "8415a46e9494b78eca43a2dd8dca716b86b9df85",
|
||||||
|
"message": "Trigger notification (#11)\n\nCo-authored-by: CrazyMax <crazy-max@users.noreply.github.com>",
|
||||||
|
"timestamp": "2021-10-21T23:47:22+02:00",
|
||||||
|
"tree_id": "8e46bf0c7fd95050deb02b11f0bc8c475c7428f3",
|
||||||
|
"url": "https://github.com/crazy-max/test-docker-action/commit/8415a46e9494b78eca43a2dd8dca716b86b9df85"
|
||||||
|
},
|
||||||
|
"pusher": {
|
||||||
|
"email": "crazy-max@users.noreply.github.com",
|
||||||
|
"name": "crazy-max"
|
||||||
|
},
|
||||||
|
"ref": "refs/tags/v1.1.1",
|
||||||
|
"repository": {
|
||||||
|
"allow_forking": true,
|
||||||
|
"archive_url": "https://api.github.com/repos/crazy-max/test-docker-action/{archive_format}{/ref}",
|
||||||
|
"archived": false,
|
||||||
|
"assignees_url": "https://api.github.com/repos/crazy-max/test-docker-action/assignees{/user}",
|
||||||
|
"blobs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/blobs{/sha}",
|
||||||
|
"branches_url": "https://api.github.com/repos/crazy-max/test-docker-action/branches{/branch}",
|
||||||
|
"clone_url": "https://github.com/crazy-max/test-docker-action.git",
|
||||||
|
"collaborators_url": "https://api.github.com/repos/crazy-max/test-docker-action/collaborators{/collaborator}",
|
||||||
|
"comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/comments{/number}",
|
||||||
|
"commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/commits{/sha}",
|
||||||
|
"compare_url": "https://api.github.com/repos/crazy-max/test-docker-action/compare/{base}...{head}",
|
||||||
|
"contents_url": "https://api.github.com/repos/crazy-max/test-docker-action/contents/{+path}",
|
||||||
|
"contributors_url": "https://api.github.com/repos/crazy-max/test-docker-action/contributors",
|
||||||
|
"created_at": 1596792180,
|
||||||
|
"default_branch": "master",
|
||||||
|
"deployments_url": "https://api.github.com/repos/crazy-max/test-docker-action/deployments",
|
||||||
|
"description": "Test \"Docker\" Actions",
|
||||||
|
"disabled": false,
|
||||||
|
"downloads_url": "https://api.github.com/repos/crazy-max/test-docker-action/downloads",
|
||||||
|
"events_url": "https://api.github.com/repos/crazy-max/test-docker-action/events",
|
||||||
|
"fork": false,
|
||||||
|
"forks": 1,
|
||||||
|
"forks_count": 1,
|
||||||
|
"forks_url": "https://api.github.com/repos/crazy-max/test-docker-action/forks",
|
||||||
|
"full_name": "crazy-max/test-docker-action",
|
||||||
|
"git_commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/commits{/sha}",
|
||||||
|
"git_refs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/refs{/sha}",
|
||||||
|
"git_tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/tags{/sha}",
|
||||||
|
"git_url": "git://github.com/crazy-max/test-docker-action.git",
|
||||||
|
"has_downloads": true,
|
||||||
|
"has_issues": false,
|
||||||
|
"has_pages": false,
|
||||||
|
"has_projects": false,
|
||||||
|
"has_wiki": false,
|
||||||
|
"homepage": "",
|
||||||
|
"hooks_url": "https://api.github.com/repos/crazy-max/test-docker-action/hooks",
|
||||||
|
"html_url": "https://github.com/crazy-max/test-docker-action",
|
||||||
|
"id": 285789493,
|
||||||
|
"is_template": false,
|
||||||
|
"issue_comment_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/comments{/number}",
|
||||||
|
"issue_events_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/events{/number}",
|
||||||
|
"issues_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues{/number}",
|
||||||
|
"keys_url": "https://api.github.com/repos/crazy-max/test-docker-action/keys{/key_id}",
|
||||||
|
"labels_url": "https://api.github.com/repos/crazy-max/test-docker-action/labels{/name}",
|
||||||
|
"language": "JavaScript",
|
||||||
|
"languages_url": "https://api.github.com/repos/crazy-max/test-docker-action/languages",
|
||||||
|
"license": {
|
||||||
|
"key": "mit",
|
||||||
|
"name": "MIT License",
|
||||||
|
"node_id": "MDc6TGljZW5zZTEz",
|
||||||
|
"spdx_id": "MIT",
|
||||||
|
"url": "https://api.github.com/licenses/mit"
|
||||||
|
},
|
||||||
|
"master_branch": "master",
|
||||||
|
"merges_url": "https://api.github.com/repos/crazy-max/test-docker-action/merges",
|
||||||
|
"milestones_url": "https://api.github.com/repos/crazy-max/test-docker-action/milestones{/number}",
|
||||||
|
"mirror_url": null,
|
||||||
|
"name": "test-docker-action",
|
||||||
|
"node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=",
|
||||||
|
"notifications_url": "https://api.github.com/repos/crazy-max/test-docker-action/notifications{?since,all,participating}",
|
||||||
|
"open_issues": 4,
|
||||||
|
"open_issues_count": 4,
|
||||||
|
"organization": "docker",
|
||||||
|
"owner": {
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4",
|
||||||
|
"email": "info@docker.com",
|
||||||
|
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
|
||||||
|
"followers_url": "https://api.github.com/users/crazy-max/followers",
|
||||||
|
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"html_url": "https://github.com/crazy-max",
|
||||||
|
"id": 5429470,
|
||||||
|
"login": "docker",
|
||||||
|
"name": "docker",
|
||||||
|
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=",
|
||||||
|
"organizations_url": "https://api.github.com/users/crazy-max/users",
|
||||||
|
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
|
||||||
|
"repos_url": "https://api.github.com/users/crazy-max/repos",
|
||||||
|
"site_admin": false,
|
||||||
|
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
|
||||||
|
"type": "Organization",
|
||||||
|
"url": "https://api.github.com/users/crazy-max"
|
||||||
|
},
|
||||||
|
"private": true,
|
||||||
|
"pulls_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls{/number}",
|
||||||
|
"pushed_at": 1634852872,
|
||||||
|
"releases_url": "https://api.github.com/repos/crazy-max/test-docker-action/releases{/id}",
|
||||||
|
"size": 714,
|
||||||
|
"ssh_url": "git@github.com:crazy-max/test-docker-action.git",
|
||||||
|
"stargazers": 0,
|
||||||
|
"stargazers_count": 0,
|
||||||
|
"stargazers_url": "https://api.github.com/repos/crazy-max/test-docker-action/stargazers",
|
||||||
|
"statuses_url": "https://api.github.com/repos/crazy-max/test-docker-action/statuses/{sha}",
|
||||||
|
"subscribers_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscribers",
|
||||||
|
"subscription_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscription",
|
||||||
|
"svn_url": "https://github.com/crazy-max/test-docker-action",
|
||||||
|
"tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/tags",
|
||||||
|
"teams_url": "https://api.github.com/repos/crazy-max/test-docker-action/teams",
|
||||||
|
"topics": [],
|
||||||
|
"trees_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/trees{/sha}",
|
||||||
|
"updated_at": "2021-10-21T21:47:25Z",
|
||||||
|
"url": "https://github.com/crazy-max/test-docker-action",
|
||||||
|
"visibility": "private",
|
||||||
|
"watchers": 0,
|
||||||
|
"watchers_count": 0
|
||||||
|
},
|
||||||
|
"sender": {
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/1951866?v=4",
|
||||||
|
"events_url": "https://api.github.com/users/crazy-max/events{/privacy}",
|
||||||
|
"followers_url": "https://api.github.com/users/crazy-max/followers",
|
||||||
|
"following_url": "https://api.github.com/users/crazy-max/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"html_url": "https://github.com/crazy-max",
|
||||||
|
"id": 1951866,
|
||||||
|
"login": "crazy-max",
|
||||||
|
"node_id": "MDQ6VXNlcjE5NTE4NjY=",
|
||||||
|
"organizations_url": "https://api.github.com/users/crazy-max/users",
|
||||||
|
"received_events_url": "https://api.github.com/users/crazy-max/received_events",
|
||||||
|
"repos_url": "https://api.github.com/users/crazy-max/repos",
|
||||||
|
"site_admin": false,
|
||||||
|
"starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions",
|
||||||
|
"type": "User",
|
||||||
|
"url": "https://api.github.com/users/crazy-max"
|
||||||
|
}
|
||||||
|
}
|
180
__tests__/flavor.test.ts
Normal file
180
__tests__/flavor.test.ts
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
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);
|
||||||
|
console.log(flavor);
|
||||||
|
expect(flavor).toEqual(expected);
|
||||||
|
} catch (err) {
|
||||||
|
if (!invalid) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
expect(true).toBe(invalid);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
@@ -1,12 +1,9 @@
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as github from '../src/github';
|
import * as github from '../src/github';
|
||||||
import {ReposGetResponseData} from '@octokit/types';
|
|
||||||
|
|
||||||
jest.spyOn(github, 'repo').mockImplementation(
|
jest.spyOn(github, 'repo').mockImplementation((): Promise<github.ReposGetResponseData> => {
|
||||||
(): Promise<ReposGetResponseData> => {
|
return <Promise<github.ReposGetResponseData>>require(path.join(__dirname, 'fixtures', 'repo.json'));
|
||||||
return <Promise<ReposGetResponseData>>require(path.join(__dirname, 'fixtures', 'repo.json'));
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
describe('repo', () => {
|
describe('repo', () => {
|
||||||
it('returns GitHub repository', async () => {
|
it('returns GitHub repository', async () => {
|
||||||
|
File diff suppressed because it is too large
Load Diff
441
__tests__/tag.test.ts
Normal file
441
__tests__/tag.test.ts
Normal file
@@ -0,0 +1,441 @@
|
|||||||
|
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);
|
||||||
|
console.log(tags);
|
||||||
|
expect(tags).toEqual(expected);
|
||||||
|
} catch (err) {
|
||||||
|
if (!invalid) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
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=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,enable=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);
|
||||||
|
console.log(tag);
|
||||||
|
expect(tag).toEqual(expected);
|
||||||
|
} catch (err) {
|
||||||
|
if (!invalid) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
expect(true).toBe(invalid);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
43
action.yml
43
action.yml
@@ -1,43 +1,23 @@
|
|||||||
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
|
# 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"
|
description: "GitHub Action to extract metadata (tags, labels) for Docker"
|
||||||
author: 'crazy-max'
|
author: 'docker'
|
||||||
branding:
|
branding:
|
||||||
|
icon: 'anchor'
|
||||||
color: 'blue'
|
color: 'blue'
|
||||||
icon: 'layers'
|
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
images:
|
images:
|
||||||
description: 'List of Docker images to use as base name for tags'
|
description: 'List of Docker images to use as base name for tags'
|
||||||
required: true
|
required: true
|
||||||
tag-sha:
|
tags:
|
||||||
description: 'Add git short SHA as Docker tag'
|
description: 'List of tags as key-value pair attributes'
|
||||||
default: 'false'
|
|
||||||
required: false
|
required: false
|
||||||
tag-edge:
|
flavor:
|
||||||
description: 'Enable edge branch tagging'
|
description: 'Flavors to apply'
|
||||||
default: 'false'
|
|
||||||
required: false
|
required: false
|
||||||
tag-edge-branch:
|
labels:
|
||||||
description: 'Branch that will be tagged as edge (default repo.default_branch)'
|
description: 'List of custom labels'
|
||||||
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-match-latest:
|
|
||||||
description: '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
|
required: false
|
||||||
sep-tags:
|
sep-tags:
|
||||||
description: 'Separator to use for tags output (default \n)'
|
description: 'Separator to use for tags output (default \n)'
|
||||||
@@ -45,6 +25,9 @@ inputs:
|
|||||||
sep-labels:
|
sep-labels:
|
||||||
description: 'Separator to use for labels output (default \n)'
|
description: 'Separator to use for labels output (default \n)'
|
||||||
required: false
|
required: false
|
||||||
|
bake-target:
|
||||||
|
description: 'Bake target name (default docker-metadata-action)'
|
||||||
|
required: false
|
||||||
github-token:
|
github-token:
|
||||||
description: 'GitHub Token as provided by secrets'
|
description: 'GitHub Token as provided by secrets'
|
||||||
default: ${{ github.token }}
|
default: ${{ github.token }}
|
||||||
@@ -57,6 +40,8 @@ outputs:
|
|||||||
description: 'Generated Docker tags'
|
description: 'Generated Docker tags'
|
||||||
labels:
|
labels:
|
||||||
description: 'Generated Docker labels'
|
description: 'Generated Docker labels'
|
||||||
|
bake-file:
|
||||||
|
description: 'Bake definiton file'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
|
3
codecov.yml
Normal file
3
codecov.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
comment: false
|
||||||
|
github_checks:
|
||||||
|
annotations: false
|
15528
dist/index.js
generated
vendored
15528
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
@@ -1,42 +1,70 @@
|
|||||||
|
variable "NODE_VERSION" {
|
||||||
|
default = "12"
|
||||||
|
}
|
||||||
|
|
||||||
|
target "node-version" {
|
||||||
|
args = {
|
||||||
|
NODE_VERSION = NODE_VERSION
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
group "default" {
|
group "default" {
|
||||||
targets = ["build"]
|
targets = ["build"]
|
||||||
}
|
}
|
||||||
|
|
||||||
group "pre-checkin" {
|
group "pre-checkin" {
|
||||||
targets = ["update-yarn", "format", "build"]
|
targets = ["vendor-update", "format", "build"]
|
||||||
}
|
}
|
||||||
|
|
||||||
group "validate" {
|
group "validate" {
|
||||||
targets = ["validate-format", "validate-build", "validate-yarn"]
|
targets = ["format-validate", "build-validate", "vendor-validate"]
|
||||||
}
|
|
||||||
|
|
||||||
target "update-yarn" {
|
|
||||||
target = "update-yarn"
|
|
||||||
output = ["."]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target "build" {
|
target "build" {
|
||||||
target = "dist"
|
inherits = ["node-version"]
|
||||||
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
|
target = "build-update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "test" {
|
target "build-validate" {
|
||||||
target = "test"
|
inherits = ["node-version"]
|
||||||
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
|
target = "build-validate"
|
||||||
|
output = ["type=cacheonly"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "format" {
|
target "format" {
|
||||||
target = "format"
|
inherits = ["node-version"]
|
||||||
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
|
target = "format-update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "validate-format" {
|
target "format-validate" {
|
||||||
target = "validate-format"
|
inherits = ["node-version"]
|
||||||
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
|
target = "format-validate"
|
||||||
|
output = ["type=cacheonly"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "validate-build" {
|
target "vendor-update" {
|
||||||
target = "validate-build"
|
inherits = ["node-version"]
|
||||||
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
|
target = "vendor-update"
|
||||||
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "validate-yarn" {
|
target "vendor-validate" {
|
||||||
target = "validate-yarn"
|
inherits = ["node-version"]
|
||||||
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
|
target = "vendor-validate"
|
||||||
|
output = ["type=cacheonly"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "test" {
|
||||||
|
inherits = ["node-version"]
|
||||||
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
|
target = "test-coverage"
|
||||||
|
output = ["./coverage"]
|
||||||
}
|
}
|
||||||
|
71
hack/build.Dockerfile
Normal file
71
hack/build.Dockerfile
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
# syntax=docker/dockerfile:1.3-labs
|
||||||
|
|
||||||
|
ARG NODE_VERSION
|
||||||
|
|
||||||
|
FROM node:${NODE_VERSION}-alpine AS base
|
||||||
|
RUN apk add --no-cache cpio findutils git
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
FROM base AS deps
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--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-update"'
|
||||||
|
git status --porcelain -- yarn.lock
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
EOT
|
||||||
|
|
||||||
|
FROM deps AS build
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--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/node_modules \
|
||||||
|
yarn run format \
|
||||||
|
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out
|
||||||
|
|
||||||
|
FROM scratch AS format-update
|
||||||
|
COPY --from=format /out /
|
||||||
|
|
||||||
|
FROM deps AS format-validate
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn run format-check
|
||||||
|
|
||||||
|
FROM deps AS test
|
||||||
|
ENV RUNNER_TEMP=/tmp/github_runner
|
||||||
|
ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn run test --coverageDirectory=/tmp/coverage
|
||||||
|
|
||||||
|
FROM scratch AS test-coverage
|
||||||
|
COPY --from=test /tmp/coverage /
|
46
package.json
46
package.json
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "docker-meta",
|
"name": "docker-metadata-action",
|
||||||
"description": "GitHub Action to extract metadata (tags, labels) for Docker",
|
"description": "GitHub Action to extract metadata (tags, labels) for Docker",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -11,34 +11,42 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/crazy-max/ghaction-docker-meta.git"
|
"url": "git+https://github.com/docker/metadata-action.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"actions",
|
"actions",
|
||||||
"docker",
|
"docker",
|
||||||
"meta",
|
"metadata",
|
||||||
"tag",
|
"tag",
|
||||||
"label"
|
"label"
|
||||||
],
|
],
|
||||||
"author": "CrazyMax",
|
"author": "Docker",
|
||||||
"license": "MIT",
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "CrazyMax",
|
||||||
|
"url": "https://crazymax.dev"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.6.0",
|
||||||
"@actions/github": "^4.0.0",
|
"@actions/github": "^5.0.0",
|
||||||
"handlebars": "^4.7.6",
|
"@renovate/pep440": "^1.0.0",
|
||||||
|
"csv-parse": "^4.16.3",
|
||||||
|
"handlebars": "^4.7.7",
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"semver": "^7.3.2"
|
"semver": "^7.3.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.0",
|
"@types/jest": "^26.0.23",
|
||||||
"@types/node": "^14.11.2",
|
"@types/node": "^14.17.4",
|
||||||
"@vercel/ncc": "^0.24.1",
|
"@vercel/ncc": "^0.28.6",
|
||||||
"dotenv": "^8.2.0",
|
"dotenv": "^8.6.0",
|
||||||
"jest": "^26.0.1",
|
"jest": "^26.6.3",
|
||||||
"jest-circus": "^26.0.1",
|
"jest-circus": "^26.6.3",
|
||||||
"jest-runtime": "^26.0.1",
|
"jest-runtime": "^26.6.3",
|
||||||
"prettier": "^2.0.4",
|
"prettier": "^2.3.2",
|
||||||
"ts-jest": "^26.4.1",
|
"ts-jest": "^26.5.6",
|
||||||
"typescript": "^4.0.3"
|
"typescript": "^4.3.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,46 +1,68 @@
|
|||||||
|
import csvparse from 'csv-parse/lib/sync';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
import {issueCommand} from '@actions/core/lib/command';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import * as os from 'os';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
|
let _tmpDir: string;
|
||||||
|
|
||||||
export interface Inputs {
|
export interface Inputs {
|
||||||
images: string[];
|
images: string[];
|
||||||
tagSha: boolean;
|
tags: string[];
|
||||||
tagEdge: boolean;
|
flavor: string[];
|
||||||
tagEdgeBranch: string;
|
labels: string[];
|
||||||
tagSemver: string[];
|
|
||||||
tagMatch: string;
|
|
||||||
tagMatchGroup: number;
|
|
||||||
tagMatchLatest: boolean;
|
|
||||||
tagSchedule: string;
|
|
||||||
sepTags: string;
|
sepTags: string;
|
||||||
sepLabels: string;
|
sepLabels: string;
|
||||||
|
bakeTarget: string;
|
||||||
githubToken: string;
|
githubToken: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function tmpDir(): string {
|
||||||
|
if (!_tmpDir) {
|
||||||
|
_tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-metadata-action-')).split(path.sep).join(path.posix.sep);
|
||||||
|
}
|
||||||
|
return _tmpDir;
|
||||||
|
}
|
||||||
|
|
||||||
export function getInputs(): Inputs {
|
export function getInputs(): Inputs {
|
||||||
return {
|
return {
|
||||||
images: getInputList('images'),
|
images: getInputList('images'),
|
||||||
tagSha: /true/i.test(core.getInput('tag-sha') || 'false'),
|
tags: getInputList('tags', true),
|
||||||
tagEdge: /true/i.test(core.getInput('tag-edge') || 'false'),
|
flavor: getInputList('flavor', true),
|
||||||
tagEdgeBranch: core.getInput('tag-edge-branch'),
|
labels: getInputList('labels', true),
|
||||||
tagSemver: getInputList('tag-semver'),
|
|
||||||
tagMatch: core.getInput('tag-match'),
|
|
||||||
tagMatchGroup: Number(core.getInput('tag-match-group')) || 0,
|
|
||||||
tagMatchLatest: /true/i.test(core.getInput('tag-match-latest') || 'true'),
|
|
||||||
tagSchedule: core.getInput('tag-schedule') || 'nightly',
|
|
||||||
sepTags: core.getInput('sep-tags') || `\n`,
|
sepTags: core.getInput('sep-tags') || `\n`,
|
||||||
sepLabels: core.getInput('sep-labels') || `\n`,
|
sepLabels: core.getInput('sep-labels') || `\n`,
|
||||||
|
bakeTarget: core.getInput('bake-target') || `docker-metadata-action`,
|
||||||
githubToken: core.getInput('github-token')
|
githubToken: core.getInput('github-token')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getInputList(name: string): string[] {
|
export function getInputList(name: string, ignoreComma?: boolean): string[] {
|
||||||
|
let res: Array<string> = [];
|
||||||
|
|
||||||
const items = core.getInput(name);
|
const items = core.getInput(name);
|
||||||
if (items == '') {
|
if (items == '') {
|
||||||
return [];
|
return res;
|
||||||
}
|
}
|
||||||
return items
|
|
||||||
.split(/\r?\n/)
|
for (let output of csvparse(items, {
|
||||||
.filter(x => x)
|
columns: false,
|
||||||
.reduce<string[]>((acc, line) => acc.concat(line.split(',').filter(x => x)).map(pat => pat.trim()), []);
|
relax: true,
|
||||||
|
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 const asyncForEach = async (array, callback) => {
|
export const asyncForEach = async (array, callback) => {
|
||||||
@@ -48,3 +70,8 @@ export const asyncForEach = async (array, callback) => {
|
|||||||
await callback(array[index], index, array);
|
await callback(array[index], index, array);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// FIXME: Temp fix https://github.com/actions/toolkit/issues/777
|
||||||
|
export function setOutput(name: string, value: any): void {
|
||||||
|
issueCommand('set-output', {name}, value);
|
||||||
|
}
|
||||||
|
87
src/flavor.ts
Normal file
87
src/flavor.ts
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
|
import csvparse from 'csv-parse/lib/sync';
|
||||||
|
|
||||||
|
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 = csvparse(input, {
|
||||||
|
relaxColumnCount: true,
|
||||||
|
skipLinesWithEmptyValues: 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 +1,18 @@
|
|||||||
import * as github from '@actions/github';
|
import * as github from '@actions/github';
|
||||||
import {Context} from '@actions/github/lib/context';
|
import {Context} from '@actions/github/lib/context';
|
||||||
import {ReposGetResponseData} from '@octokit/types';
|
import {components as OctoOpenApiTypes} from '@octokit/openapi-types';
|
||||||
|
|
||||||
|
export type ReposGetResponseData = OctoOpenApiTypes['schemas']['repository'];
|
||||||
|
|
||||||
export function context(): Context {
|
export function context(): Context {
|
||||||
return github.context;
|
return github.context;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function repo(token: string): Promise<ReposGetResponseData> {
|
export async function repo(token: string): Promise<ReposGetResponseData> {
|
||||||
const octokit = github.getOctokit(token);
|
return github
|
||||||
const repo = await octokit.repos.get({
|
.getOctokit(token)
|
||||||
|
.rest.repos.get({
|
||||||
...github.context.repo
|
...github.context.repo
|
||||||
});
|
})
|
||||||
if (!repo?.data) {
|
.then(response => response.data as ReposGetResponseData);
|
||||||
throw new Error('Cannot get GitHub repository');
|
|
||||||
}
|
|
||||||
return repo.data;
|
|
||||||
}
|
}
|
||||||
|
42
src/main.ts
42
src/main.ts
@@ -1,9 +1,9 @@
|
|||||||
import {getInputs, Inputs} from './context';
|
import * as fs from 'fs';
|
||||||
|
import {getInputs, Inputs, setOutput} from './context';
|
||||||
import * as github from './github';
|
import * as github from './github';
|
||||||
import {Meta, Version} from './meta';
|
import {Meta, Version} from './meta';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import {Context} from '@actions/github/lib/context';
|
import {Context} from '@actions/github/lib/context';
|
||||||
import {ReposGetResponseData} from '@octokit/types';
|
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
@@ -13,7 +13,7 @@ async function run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const context: Context = github.context();
|
const context: Context = github.context();
|
||||||
const repo: ReposGetResponseData = await github.repo(inputs.githubToken);
|
const repo: github.ReposGetResponseData = await github.repo(inputs.githubToken);
|
||||||
core.startGroup(`Context info`);
|
core.startGroup(`Context info`);
|
||||||
core.info(`eventName: ${context.eventName}`);
|
core.info(`eventName: ${context.eventName}`);
|
||||||
core.info(`sha: ${context.sha}`);
|
core.info(`sha: ${context.sha}`);
|
||||||
@@ -27,27 +27,51 @@ async function run() {
|
|||||||
|
|
||||||
const meta: Meta = new Meta(inputs, context, repo);
|
const meta: Meta = new Meta(inputs, context, repo);
|
||||||
|
|
||||||
const version: Version = meta.version();
|
const version: Version = meta.version;
|
||||||
|
if (meta.version.main == undefined || meta.version.main.length == 0) {
|
||||||
|
core.warning(`No Docker image version has been generated. Check tags input.`);
|
||||||
|
} else {
|
||||||
core.startGroup(`Docker image version`);
|
core.startGroup(`Docker image version`);
|
||||||
core.info(version.main || '');
|
core.info(version.main || '');
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
core.setOutput('version', version.main || '');
|
}
|
||||||
|
setOutput('version', version.main || '');
|
||||||
|
|
||||||
const tags: Array<string> = meta.tags();
|
// Docker tags
|
||||||
|
const tags: Array<string> = meta.getTags();
|
||||||
|
if (tags.length == 0) {
|
||||||
|
core.warning('No Docker tag has been generated. Check tags input.');
|
||||||
|
} else {
|
||||||
core.startGroup(`Docker tags`);
|
core.startGroup(`Docker tags`);
|
||||||
for (let tag of tags) {
|
for (let tag of tags) {
|
||||||
core.info(tag);
|
core.info(tag);
|
||||||
}
|
}
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
core.setOutput('tags', tags.join(inputs.sepTags));
|
}
|
||||||
|
setOutput('tags', tags.join(inputs.sepTags));
|
||||||
|
|
||||||
const labels: Array<string> = meta.labels();
|
// Docker labels
|
||||||
|
const labels: Array<string> = meta.getLabels();
|
||||||
core.startGroup(`Docker labels`);
|
core.startGroup(`Docker labels`);
|
||||||
for (let label of labels) {
|
for (let label of labels) {
|
||||||
core.info(label);
|
core.info(label);
|
||||||
}
|
}
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
core.setOutput('labels', labels.join(inputs.sepTags));
|
setOutput('labels', labels.join(inputs.sepLabels));
|
||||||
|
|
||||||
|
// JSON
|
||||||
|
const jsonOutput = meta.getJSON();
|
||||||
|
core.startGroup(`JSON output`);
|
||||||
|
core.info(JSON.stringify(jsonOutput, null, 2));
|
||||||
|
core.endGroup();
|
||||||
|
setOutput('json', jsonOutput);
|
||||||
|
|
||||||
|
// Bake definition file
|
||||||
|
const bakeFile: string = meta.getBakeFile();
|
||||||
|
core.startGroup(`Bake definition file`);
|
||||||
|
core.info(fs.readFileSync(bakeFile, 'utf8'));
|
||||||
|
core.endGroup();
|
||||||
|
setOutput('bake-file', bakeFile);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
|
451
src/meta.ts
451
src/meta.ts
@@ -1,124 +1,437 @@
|
|||||||
import * as handlebars from 'handlebars';
|
import * as handlebars from 'handlebars';
|
||||||
import * as moment from 'moment';
|
import * as fs from 'fs';
|
||||||
|
import * as path from 'path';
|
||||||
|
import moment from 'moment';
|
||||||
|
import * as pep440 from '@renovate/pep440';
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
import {Inputs} from './context';
|
import {Inputs, tmpDir} from './context';
|
||||||
|
import {ReposGetResponseData} from './github';
|
||||||
|
import * as tcl from './tag';
|
||||||
|
import * as fcl from './flavor';
|
||||||
|
import * as core from '@actions/core';
|
||||||
import {Context} from '@actions/github/lib/context';
|
import {Context} from '@actions/github/lib/context';
|
||||||
import {ReposGetResponseData} from '@octokit/types';
|
|
||||||
|
|
||||||
export interface Version {
|
export interface Version {
|
||||||
main: string | undefined;
|
main: string | undefined;
|
||||||
partial: string[];
|
partial: string[];
|
||||||
latest: boolean;
|
latest: boolean | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Meta {
|
export class Meta {
|
||||||
|
public readonly version: Version;
|
||||||
|
|
||||||
private readonly inputs: Inputs;
|
private readonly inputs: Inputs;
|
||||||
private readonly context: Context;
|
private readonly context: Context;
|
||||||
private readonly repo: ReposGetResponseData;
|
private readonly repo: ReposGetResponseData;
|
||||||
|
private readonly tags: tcl.Tag[];
|
||||||
|
private readonly flavor: fcl.Flavor;
|
||||||
private readonly date: Date;
|
private readonly date: Date;
|
||||||
|
|
||||||
constructor(inputs: Inputs, context: Context, repo: ReposGetResponseData) {
|
constructor(inputs: Inputs, context: Context, repo: ReposGetResponseData) {
|
||||||
this.inputs = inputs;
|
// Needs to override Git reference with pr ref instead of upstream branch ref
|
||||||
if (!this.inputs.tagEdgeBranch) {
|
// for pull_request_target event
|
||||||
this.inputs.tagEdgeBranch = repo.default_branch;
|
if (/pull_request_target/.test(context.eventName)) {
|
||||||
|
context.ref = `refs/pull/${context.payload.number}/merge`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.inputs = inputs;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.repo = repo;
|
this.repo = repo;
|
||||||
|
this.tags = tcl.Transform(inputs.tags);
|
||||||
|
this.flavor = fcl.Transform(inputs.flavor);
|
||||||
this.date = new Date();
|
this.date = new Date();
|
||||||
|
this.version = this.getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
public version(): Version {
|
private getVersion(): Version {
|
||||||
const currentDate = this.date;
|
let version: Version = {
|
||||||
const version: Version = {
|
|
||||||
main: undefined,
|
main: undefined,
|
||||||
partial: [],
|
partial: [],
|
||||||
latest: false
|
latest: undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
if (/schedule/.test(this.context.eventName)) {
|
for (const tag of this.tags) {
|
||||||
version.main = handlebars.compile(this.inputs.tagSchedule)({
|
if (!/true/i.test(tag.attrs['enable'])) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
case tcl.Type.Edge: {
|
||||||
|
version = this.procEdge(version, tag);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case tcl.Type.Raw: {
|
||||||
|
version = this.procRaw(version, tag);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case tcl.Type.Sha: {
|
||||||
|
version = this.procSha(version, tag);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
version.partial = version.partial.filter((item, index) => version.partial.indexOf(item) === index);
|
||||||
|
if (version.latest == undefined) {
|
||||||
|
version.latest = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
private procSchedule(version: Version, tag: tcl.Tag): Version {
|
||||||
|
if (!/schedule/.test(this.context.eventName)) {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentDate = this.date;
|
||||||
|
const vraw = this.setValue(
|
||||||
|
handlebars.compile(tag.attrs['pattern'])({
|
||||||
|
date: function (format) {
|
||||||
|
return moment(currentDate).utc().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: boolean = false;
|
||||||
|
const sver = semver.parse(vraw, {
|
||||||
|
includePrerelease: true
|
||||||
|
});
|
||||||
|
if (semver.prerelease(vraw)) {
|
||||||
|
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: boolean = false;
|
||||||
|
const pver = pep440.explain(vraw);
|
||||||
|
if (pver.is_prerelease || pver.is_postrelease || pver.is_devrelease) {
|
||||||
|
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, '').replace(/\//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, '').replace(/[^a-zA-Z0-9._-]+/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, '').replace(/\//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;
|
||||||
|
}
|
||||||
|
|
||||||
|
let val = this.context.ref.replace(/^refs\/heads\//g, '').replace(/[^a-zA-Z0-9._-]+/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 = this.context.sha.substr(0, 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
private setValue(val: string, tag: tcl.Tag): string {
|
||||||
|
if (tag.attrs.hasOwnProperty('prefix')) {
|
||||||
|
val = `${this.setGlobalExp(tag.attrs['prefix'])}${val}`;
|
||||||
|
} else if (this.flavor.prefix.length > 0) {
|
||||||
|
val = `${this.setGlobalExp(this.flavor.prefix)}${val}`;
|
||||||
|
}
|
||||||
|
if (tag.attrs.hasOwnProperty('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 {
|
||||||
|
const ctx = this.context;
|
||||||
|
const currentDate = this.date;
|
||||||
|
return handlebars.compile(val)({
|
||||||
|
branch: function () {
|
||||||
|
if (!/^refs\/heads\//.test(ctx.ref)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return ctx.ref.replace(/^refs\/heads\//g, '').replace(/[^a-zA-Z0-9._-]+/g, '-');
|
||||||
|
},
|
||||||
|
tag: function () {
|
||||||
|
if (!/^refs\/tags\//.test(ctx.ref)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return ctx.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
||||||
|
},
|
||||||
|
sha: function () {
|
||||||
|
return ctx.sha.substr(0, 7);
|
||||||
|
},
|
||||||
|
base_ref: function () {
|
||||||
|
if (/^refs\/tags\//.test(ctx.ref)) {
|
||||||
|
return ctx.payload?.base_ref.replace(/^refs\/heads\//g, '').replace(/\//g, '-');
|
||||||
|
}
|
||||||
|
if (/^refs\/pull\//.test(ctx.ref)) {
|
||||||
|
return ctx.payload?.pull_request?.base?.ref;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
},
|
||||||
date: function (format) {
|
date: function (format) {
|
||||||
return moment(currentDate).utc().format(format);
|
return moment(currentDate).utc().format(format);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} 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)) {
|
|
||||||
const sver = semver.parse(version.main, {
|
|
||||||
includePrerelease: true
|
|
||||||
});
|
|
||||||
version.latest = !semver.prerelease(version.main);
|
|
||||||
version.main = handlebars.compile(this.inputs.tagSemver[0])(sver);
|
|
||||||
if (version.latest) {
|
|
||||||
for (const semverTpl of this.inputs.tagSemver) {
|
|
||||||
const partial = handlebars.compile(semverTpl)(sver);
|
|
||||||
if (partial == version.main) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
version.partial.push(partial);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} 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);
|
|
||||||
}
|
|
||||||
if (tagMatch) {
|
|
||||||
version.main = tagMatch[this.inputs.tagMatchGroup];
|
|
||||||
version.latest = this.inputs.tagMatchLatest;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
version.latest = this.inputs.tagMatchLatest;
|
|
||||||
}
|
|
||||||
} else if (/^refs\/heads\//.test(this.context.ref)) {
|
|
||||||
version.main = this.context.ref.replace(/^refs\/heads\//g, '').replace(/\//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, '')}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
version.partial = version.partial.filter((item, index) => version.partial.indexOf(item) === index);
|
public getTags(): Array<string> {
|
||||||
return version;
|
if (!this.version.main) {
|
||||||
}
|
|
||||||
|
|
||||||
public tags(): Array<string> {
|
|
||||||
const version: Version = this.version();
|
|
||||||
if (!version.main) {
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
let tags: Array<string> = [];
|
let tags: Array<string> = [];
|
||||||
for (const image of this.inputs.images) {
|
for (const image of this.inputs.images) {
|
||||||
const imageLc = image.toLowerCase();
|
const imageLc = image.toLowerCase();
|
||||||
tags.push(`${imageLc}:${version.main}`);
|
tags.push(`${imageLc}:${this.version.main}`);
|
||||||
for (const partial of version.partial) {
|
for (const partial of this.version.partial) {
|
||||||
tags.push(`${imageLc}:${partial}`);
|
tags.push(`${imageLc}:${partial}`);
|
||||||
}
|
}
|
||||||
if (version.latest) {
|
if (this.version.latest) {
|
||||||
tags.push(`${imageLc}:latest`);
|
tags.push(`${imageLc}:${this.flavor.prefixLatest ? this.flavor.prefix : ''}latest${this.flavor.suffixLatest ? this.flavor.suffix : ''}`);
|
||||||
}
|
|
||||||
if (this.context.sha && this.inputs.tagSha) {
|
|
||||||
tags.push(`${imageLc}:sha-${this.context.sha.substr(0, 7)}`);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public labels(): Array<string> {
|
public getLabels(): Array<string> {
|
||||||
return [
|
let labels: Array<string> = [
|
||||||
`org.opencontainers.image.title=${this.repo.name || ''}`,
|
`org.opencontainers.image.title=${this.repo.name || ''}`,
|
||||||
`org.opencontainers.image.description=${this.repo.description || ''}`,
|
`org.opencontainers.image.description=${this.repo.description || ''}`,
|
||||||
`org.opencontainers.image.url=${this.repo.html_url || ''}`,
|
`org.opencontainers.image.url=${this.repo.html_url || ''}`,
|
||||||
`org.opencontainers.image.source=${this.repo.html_url || ''}`,
|
`org.opencontainers.image.source=${this.repo.html_url || ''}`,
|
||||||
`org.opencontainers.image.version=${this.version().main || ''}`,
|
`org.opencontainers.image.version=${this.version.main || ''}`,
|
||||||
`org.opencontainers.image.created=${this.date.toISOString()}`,
|
`org.opencontainers.image.created=${this.date.toISOString()}`,
|
||||||
`org.opencontainers.image.revision=${this.context.sha || ''}`,
|
`org.opencontainers.image.revision=${this.context.sha || ''}`,
|
||||||
`org.opencontainers.image.licenses=${this.repo.license?.spdx_id || ''}`
|
`org.opencontainers.image.licenses=${this.repo.license?.spdx_id || ''}`
|
||||||
];
|
];
|
||||||
|
labels.push(...this.inputs.labels);
|
||||||
|
return labels;
|
||||||
|
}
|
||||||
|
|
||||||
|
public getJSON(): {} {
|
||||||
|
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;
|
||||||
|
}, {})
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public getBakeFile(): string {
|
||||||
|
const bakeFile = path.join(tmpDir(), 'docker-metadata-action-bake.json').split(path.sep).join(path.posix.sep);
|
||||||
|
fs.writeFileSync(
|
||||||
|
bakeFile,
|
||||||
|
JSON.stringify(
|
||||||
|
{
|
||||||
|
target: {
|
||||||
|
[this.inputs.bakeTarget]: {
|
||||||
|
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.inputs.images.join(','),
|
||||||
|
DOCKER_META_VERSION: this.version.main
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
2
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return bakeFile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
39
src/pep440.d.ts
vendored
Normal file
39
src/pep440.d.ts
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
interface ExplainedVersion {
|
||||||
|
epoch: number;
|
||||||
|
release: [number, number, number];
|
||||||
|
pre?: [string, number];
|
||||||
|
post?: number;
|
||||||
|
dev?: number;
|
||||||
|
local?: string;
|
||||||
|
public: string;
|
||||||
|
base_version: string;
|
||||||
|
is_prerelease: boolean;
|
||||||
|
is_devrelease: boolean;
|
||||||
|
is_postrelease: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Version {
|
||||||
|
epoch: number;
|
||||||
|
release: [number, number, number];
|
||||||
|
pre?: [string, number] | null;
|
||||||
|
post?: [string, number] | null;
|
||||||
|
dev?: [string, number] | null;
|
||||||
|
local?: Array<number> | null;
|
||||||
|
public: string;
|
||||||
|
base_version: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module '@renovate/pep440' {
|
||||||
|
function valid(version: string): string | null;
|
||||||
|
function clean(version: string): string;
|
||||||
|
function explain(version: string): ExplainedVersion;
|
||||||
|
function major(input: string): string;
|
||||||
|
function minor(input: string): string;
|
||||||
|
function patch(input: string): string;
|
||||||
|
function inc(input: string, release: string, preReleaseIdentifier?: string): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module '@renovate/pep440/lib/version' {
|
||||||
|
function stringify(parsed: Version): string;
|
||||||
|
function parse(version: string): Version;
|
||||||
|
}
|
214
src/tag.ts
Normal file
214
src/tag.ts
Normal file
@@ -0,0 +1,214 @@
|
|||||||
|
import csvparse from 'csv-parse/lib/sync';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
|
export enum Type {
|
||||||
|
Schedule = 'schedule',
|
||||||
|
Semver = 'semver',
|
||||||
|
Pep440 = 'pep440',
|
||||||
|
Match = 'match',
|
||||||
|
Edge = 'edge',
|
||||||
|
Ref = 'ref',
|
||||||
|
Raw = 'raw',
|
||||||
|
Sha = 'sha'
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum RefEvent {
|
||||||
|
Branch = 'branch',
|
||||||
|
Tag = 'tag',
|
||||||
|
PR = 'pr'
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum ShaFormat {
|
||||||
|
Short = 'short',
|
||||||
|
Long = 'long'
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Tag {
|
||||||
|
public type?: Type;
|
||||||
|
public attrs: Record<string, string>;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.attrs = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
public toString(): string {
|
||||||
|
const out: string[] = [`type=${this.type}`];
|
||||||
|
for (let attr in this.attrs) {
|
||||||
|
out.push(`${attr}=${this.attrs[attr]}`);
|
||||||
|
}
|
||||||
|
return out.join(',');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const DefaultPriorities: Record<Type, string> = {
|
||||||
|
[Type.Schedule]: '1000',
|
||||||
|
[Type.Semver]: '900',
|
||||||
|
[Type.Pep440]: '900',
|
||||||
|
[Type.Match]: '800',
|
||||||
|
[Type.Edge]: '700',
|
||||||
|
[Type.Ref]: '600',
|
||||||
|
[Type.Raw]: '200',
|
||||||
|
[Type.Sha]: '100'
|
||||||
|
};
|
||||||
|
|
||||||
|
export function Transform(inputs: string[]): Tag[] {
|
||||||
|
const tags: Tag[] = [];
|
||||||
|
if (inputs.length == 0) {
|
||||||
|
// prettier-ignore
|
||||||
|
inputs = [
|
||||||
|
`type=schedule`,
|
||||||
|
`type=ref,event=${RefEvent.Branch}`,
|
||||||
|
`type=ref,event=${RefEvent.Tag}`,
|
||||||
|
`type=ref,event=${RefEvent.PR}`
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const input of inputs) {
|
||||||
|
tags.push(Parse(input));
|
||||||
|
}
|
||||||
|
const sorted = tags.sort((tag1, tag2) => {
|
||||||
|
if (Number(tag1.attrs['priority']) < Number(tag2.attrs['priority'])) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (Number(tag1.attrs['priority']) > Number(tag2.attrs['priority'])) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
core.startGroup(`Processing tags input`);
|
||||||
|
for (const tag of sorted) {
|
||||||
|
core.info(tag.toString());
|
||||||
|
}
|
||||||
|
core.endGroup();
|
||||||
|
|
||||||
|
return sorted;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Parse(s: string): Tag {
|
||||||
|
const fields = csvparse(s, {
|
||||||
|
relaxColumnCount: true,
|
||||||
|
skipLinesWithEmptyValues: true
|
||||||
|
})[0];
|
||||||
|
|
||||||
|
const tag = new Tag();
|
||||||
|
for (const field of fields) {
|
||||||
|
const parts = field
|
||||||
|
.toString()
|
||||||
|
.split('=')
|
||||||
|
.map(item => item.trim());
|
||||||
|
if (parts.length == 1) {
|
||||||
|
tag.attrs['value'] = parts[0];
|
||||||
|
} else {
|
||||||
|
const key = parts[0].toLowerCase();
|
||||||
|
const value = parts[1];
|
||||||
|
switch (key) {
|
||||||
|
case 'type': {
|
||||||
|
if (!Object.values(Type).includes(value)) {
|
||||||
|
throw new Error(`Unknown tag type attribute: ${value}`);
|
||||||
|
}
|
||||||
|
tag.type = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
tag.attrs[key] = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tag.type == undefined) {
|
||||||
|
tag.type = Type.Raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (tag.type) {
|
||||||
|
case Type.Schedule: {
|
||||||
|
if (!tag.attrs.hasOwnProperty('pattern')) {
|
||||||
|
tag.attrs['pattern'] = 'nightly';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Type.Semver:
|
||||||
|
case Type.Pep440: {
|
||||||
|
if (!tag.attrs.hasOwnProperty('pattern')) {
|
||||||
|
throw new Error(`Missing pattern attribute for ${s}`);
|
||||||
|
}
|
||||||
|
if (!tag.attrs.hasOwnProperty('value')) {
|
||||||
|
tag.attrs['value'] = '';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Type.Match: {
|
||||||
|
if (!tag.attrs.hasOwnProperty('pattern')) {
|
||||||
|
throw new Error(`Missing pattern attribute for ${s}`);
|
||||||
|
}
|
||||||
|
if (!tag.attrs.hasOwnProperty('group')) {
|
||||||
|
tag.attrs['group'] = '0';
|
||||||
|
}
|
||||||
|
if (isNaN(+tag.attrs['group'])) {
|
||||||
|
throw new Error(`Invalid match group for ${s}`);
|
||||||
|
}
|
||||||
|
if (!tag.attrs.hasOwnProperty('value')) {
|
||||||
|
tag.attrs['value'] = '';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Type.Edge: {
|
||||||
|
if (!tag.attrs.hasOwnProperty('branch')) {
|
||||||
|
tag.attrs['branch'] = '';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Type.Ref: {
|
||||||
|
if (!tag.attrs.hasOwnProperty('event')) {
|
||||||
|
throw new Error(`Missing event attribute for ${s}`);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
!Object.keys(RefEvent)
|
||||||
|
.map(k => RefEvent[k])
|
||||||
|
.includes(tag.attrs['event'])
|
||||||
|
) {
|
||||||
|
throw new Error(`Invalid event for ${s}`);
|
||||||
|
}
|
||||||
|
if (tag.attrs['event'] == RefEvent.PR && !tag.attrs.hasOwnProperty('prefix')) {
|
||||||
|
tag.attrs['prefix'] = 'pr-';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Type.Raw: {
|
||||||
|
if (!tag.attrs.hasOwnProperty('value')) {
|
||||||
|
throw new Error(`Missing value attribute for ${s}`);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Type.Sha: {
|
||||||
|
if (!tag.attrs.hasOwnProperty('prefix')) {
|
||||||
|
tag.attrs['prefix'] = 'sha-';
|
||||||
|
}
|
||||||
|
if (!tag.attrs.hasOwnProperty('format')) {
|
||||||
|
tag.attrs['format'] = ShaFormat.Short;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
!Object.keys(ShaFormat)
|
||||||
|
.map(k => ShaFormat[k])
|
||||||
|
.includes(tag.attrs['format'])
|
||||||
|
) {
|
||||||
|
throw new Error(`Invalid format for ${s}`);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!tag.attrs.hasOwnProperty('enable')) {
|
||||||
|
tag.attrs['enable'] = 'true';
|
||||||
|
}
|
||||||
|
if (!tag.attrs.hasOwnProperty('priority')) {
|
||||||
|
tag.attrs['priority'] = DefaultPriorities[tag.type];
|
||||||
|
}
|
||||||
|
if (!['true', 'false'].includes(tag.attrs['enable'])) {
|
||||||
|
throw new Error(`Invalid value for enable attribute: ${tag.attrs['enable']}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tag;
|
||||||
|
}
|
38
test/docker-bake.hcl
Normal file
38
test/docker-bake.hcl
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
target "docker-metadata-action" {}
|
||||||
|
|
||||||
|
group "default" {
|
||||||
|
targets = ["db", "app"]
|
||||||
|
}
|
||||||
|
|
||||||
|
group "release" {
|
||||||
|
targets = ["db", "app-plus"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "db" {
|
||||||
|
context = "./test"
|
||||||
|
tags = ["docker.io/tonistiigi/db"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "app" {
|
||||||
|
inherits = ["docker-metadata-action"]
|
||||||
|
context = "./test"
|
||||||
|
dockerfile = "Dockerfile"
|
||||||
|
args = {
|
||||||
|
name = "foo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
target "cross" {
|
||||||
|
platforms = [
|
||||||
|
"linux/amd64",
|
||||||
|
"linux/arm64",
|
||||||
|
"linux/386"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "app-plus" {
|
||||||
|
inherits = ["app", "cross"]
|
||||||
|
args = {
|
||||||
|
IAMPLUS = "true"
|
||||||
|
}
|
||||||
|
}
|
@@ -11,9 +11,11 @@
|
|||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"esModuleInterop": false,
|
"esModuleInterop": true,
|
||||||
"resolveJsonModule": true,
|
|
||||||
"sourceMap": true
|
"sourceMap": true
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "**/*.test.ts"]
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"**/*.test.ts"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user