Compare commits
42 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
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 |
4
.github/dependabot.yml
vendored
4
.github/dependabot.yml
vendored
@@ -4,8 +4,6 @@ updates:
|
|||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
time: "06:00"
|
|
||||||
timezone: "Europe/Paris"
|
|
||||||
labels:
|
labels:
|
||||||
- ":game_die: dependencies"
|
- ":game_die: dependencies"
|
||||||
- ":robot: bot"
|
- ":robot: bot"
|
||||||
@@ -13,8 +11,6 @@ updates:
|
|||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
time: "06:00"
|
|
||||||
timezone: "Europe/Paris"
|
|
||||||
allow:
|
allow:
|
||||||
- dependency-type: "production"
|
- dependency-type: "production"
|
||||||
labels:
|
labels:
|
||||||
|
24
.github/workflows/ci.yml
vendored
24
.github/workflows/ci.yml
vendored
@@ -165,6 +165,30 @@ jobs:
|
|||||||
org.opencontainers.image.description=Another description
|
org.opencontainers.image.description=Another description
|
||||||
org.opencontainers.image.vendor=MyCompany
|
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
|
||||||
services:
|
services:
|
||||||
|
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -29,6 +29,6 @@ jobs:
|
|||||||
targets: test
|
targets: test
|
||||||
-
|
-
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v1
|
uses: codecov/codecov-action@v2
|
||||||
with:
|
with:
|
||||||
file: ./coverage/clover.xml
|
file: ./coverage/clover.xml
|
||||||
|
109
README.md
109
README.md
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
GitHub Action to extract metadata (tags, labels) for Docker. This action is particularly useful if used with
|
GitHub Action to extract metadata from Git reference and GitHub events.
|
||||||
[Docker Build Push](https://github.com/docker/build-push-action) action.
|
This action is particularly useful if used with [Docker Build Push](https://github.com/docker/build-push-action) action to tag and label Docker images.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -23,6 +23,7 @@ ___
|
|||||||
* [`tags` input](#tags-input)
|
* [`tags` input](#tags-input)
|
||||||
* [`type=schedule`](#typeschedule)
|
* [`type=schedule`](#typeschedule)
|
||||||
* [`type=semver`](#typesemver)
|
* [`type=semver`](#typesemver)
|
||||||
|
* [`type=pep440`](#typepep440)
|
||||||
* [`type=match`](#typematch)
|
* [`type=match`](#typematch)
|
||||||
* [`type=edge`](#typeedge)
|
* [`type=edge`](#typeedge)
|
||||||
* [`type=ref`](#typeref)
|
* [`type=ref`](#typeref)
|
||||||
@@ -32,6 +33,7 @@ ___
|
|||||||
* [Latest tag](#latest-tag)
|
* [Latest tag](#latest-tag)
|
||||||
* [Global expressions](#global-expressions)
|
* [Global expressions](#global-expressions)
|
||||||
* [Major version zero](#major-version-zero)
|
* [Major version zero](#major-version-zero)
|
||||||
|
* [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)
|
||||||
|
|
||||||
@@ -162,7 +164,13 @@ target "build" {
|
|||||||
inherits = ["docker-metadata-action"]
|
inherits = ["docker-metadata-action"]
|
||||||
context = "./"
|
context = "./"
|
||||||
dockerfile = "Dockerfile"
|
dockerfile = "Dockerfile"
|
||||||
platforms = ["linux/amd64", "linux/arm/v6", "linux/arm/v7", "linux/arm64", "linux/386", "linux/ppc64le"]
|
platforms = [
|
||||||
|
"linux/amd64",
|
||||||
|
"linux/arm/v6",
|
||||||
|
"linux/arm/v7",
|
||||||
|
"linux/arm64",
|
||||||
|
"linux/386"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -274,6 +282,7 @@ Following outputs are available
|
|||||||
| `version` | String | Docker image version |
|
| `version` | String | Docker image version |
|
||||||
| `tags` | String | Docker tags |
|
| `tags` | String | Docker tags |
|
||||||
| `labels` | String | 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 |
|
| `bake-file` | File | [Bake definition file](https://github.com/docker/buildx#file-definition) path |
|
||||||
|
|
||||||
## `flavor` input
|
## `flavor` input
|
||||||
@@ -288,8 +297,8 @@ flavor: |
|
|||||||
```
|
```
|
||||||
|
|
||||||
* `latest=<auto|true|false>`: Handle [latest tag](#latest-tag) (default `auto`)
|
* `latest=<auto|true|false>`: Handle [latest tag](#latest-tag) (default `auto`)
|
||||||
* `prefix=<string>`: A global prefix for each generated tag
|
* `prefix=<string>,onlatest=<true|false>`: A global prefix for each generated tag and optionnally for `latest`
|
||||||
* `suffix=<string>`: A global suffix for each generated tag
|
* `suffix=<string>,onlatest=<true|false>`: A global suffix for each generated tag and optionnally for `latest`
|
||||||
|
|
||||||
## `tags` input
|
## `tags` input
|
||||||
|
|
||||||
@@ -376,11 +385,11 @@ tags: |
|
|||||||
```
|
```
|
||||||
|
|
||||||
Will be used on a [push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push)
|
Will be used on a [push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push)
|
||||||
and requires a valid Git tag [semver](https://semver.org/) but you can also use a custom value through `value`
|
and requires a valid [semver](https://semver.org/) Git tag, but you can also use a custom value through `value`
|
||||||
attribute.
|
attribute.
|
||||||
|
|
||||||
`pattern` attribute supports [Handlebars template](https://handlebarsjs.com/guide/) with the following expressions:
|
`pattern` attribute supports [Handlebars template](https://handlebarsjs.com/guide/) with the following expressions:
|
||||||
* `raw` ; the actual semver
|
* `raw` ; the actual tag
|
||||||
* `version` ; shorthand for `{{major}}.{{minor}}.{{patch}}` (can include pre-release)
|
* `version` ; shorthand for `{{major}}.{{minor}}.{{patch}}` (can include pre-release)
|
||||||
* `major` ; major version identifier
|
* `major` ; major version identifier
|
||||||
* `minor` ; minor version identifier
|
* `minor` ; minor version identifier
|
||||||
@@ -408,6 +417,51 @@ tags: |
|
|||||||
type=semver,enable=true,priority=900,prefix=,suffix=,pattern=,value=
|
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`
|
### `type=match`
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@@ -490,11 +544,11 @@ Extended attributes and default values:
|
|||||||
```yaml
|
```yaml
|
||||||
tags: |
|
tags: |
|
||||||
# branch event
|
# branch event
|
||||||
type=ref,enable=true,priority=600,prefix=,suffix=,event=
|
type=ref,enable=true,priority=600,prefix=,suffix=,event=branch
|
||||||
# tag event
|
# tag event
|
||||||
type=ref,enable=true,priority=600,prefix=,suffix=,event=
|
type=ref,enable=true,priority=600,prefix=,suffix=,event=tag
|
||||||
# pull request event
|
# pull request event
|
||||||
type=ref,enable=true,priority=600,prefix=pr-,suffix=,event=
|
type=ref,enable=true,priority=600,prefix=pr-,suffix=,event=pr
|
||||||
```
|
```
|
||||||
|
|
||||||
### `type=raw`
|
### `type=raw`
|
||||||
@@ -524,13 +578,7 @@ tags: |
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
tags: |
|
tags: |
|
||||||
# minimal
|
# minimal (short sha)
|
||||||
type=sha
|
|
||||||
```
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
tags: |
|
|
||||||
# minimal using short sha
|
|
||||||
type=sha
|
type=sha
|
||||||
# full length sha
|
# full length sha
|
||||||
type=sha,format=long
|
type=sha,format=long
|
||||||
@@ -564,6 +612,7 @@ attributes are available:
|
|||||||
| `{{branch}}` | `master` |
|
| `{{branch}}` | `master` |
|
||||||
| `{{tag}}` | `v1.2.3` |
|
| `{{tag}}` | `v1.2.3` |
|
||||||
| `{{sha}}` | `90dd603` |
|
| `{{sha}}` | `90dd603` |
|
||||||
|
| `{{date 'YYYYMMDD'}}` | `20210326` |
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
tags: |
|
tags: |
|
||||||
@@ -592,6 +641,30 @@ tags: |
|
|||||||
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
|
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### JSON output object
|
||||||
|
|
||||||
|
The `json` output is a JSON object composed of the generated tags and labels so that you can reuse them further in your
|
||||||
|
workflow using the [`fromJSON` function](https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#fromjson):
|
||||||
|
|
||||||
|
```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
|
||||||
|
|
||||||
If some of the [OCI Image Format Specification](https://github.com/opencontainers/image-spec/blob/master/annotations.md)
|
If some of the [OCI Image Format Specification](https://github.com/opencontainers/image-spec/blob/master/annotations.md)
|
||||||
@@ -600,7 +673,7 @@ labels generated are not suitable, you can overwrite them like this:
|
|||||||
```yaml
|
```yaml
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: docker_meta
|
id: meta
|
||||||
uses: docker/metadata-action@v3
|
uses: docker/metadata-action@v3
|
||||||
with:
|
with:
|
||||||
images: name/app
|
images: name/app
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
}
|
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
|
@@ -32,7 +32,9 @@ describe('transform', () => {
|
|||||||
{
|
{
|
||||||
latest: "true",
|
latest: "true",
|
||||||
prefix: "",
|
prefix: "",
|
||||||
suffix: ""
|
prefixLatest: false,
|
||||||
|
suffix: "",
|
||||||
|
suffixLatest: false,
|
||||||
} as Flavor,
|
} as Flavor,
|
||||||
false
|
false
|
||||||
],
|
],
|
||||||
@@ -43,7 +45,9 @@ describe('transform', () => {
|
|||||||
{
|
{
|
||||||
latest: "false",
|
latest: "false",
|
||||||
prefix: "",
|
prefix: "",
|
||||||
suffix: ""
|
prefixLatest: false,
|
||||||
|
suffix: "",
|
||||||
|
suffixLatest: false,
|
||||||
} as Flavor,
|
} as Flavor,
|
||||||
false
|
false
|
||||||
],
|
],
|
||||||
@@ -54,7 +58,9 @@ describe('transform', () => {
|
|||||||
{
|
{
|
||||||
latest: "auto",
|
latest: "auto",
|
||||||
prefix: "",
|
prefix: "",
|
||||||
suffix: ""
|
prefixLatest: false,
|
||||||
|
suffix: "",
|
||||||
|
suffixLatest: false,
|
||||||
} as Flavor,
|
} as Flavor,
|
||||||
false
|
false
|
||||||
],
|
],
|
||||||
@@ -72,7 +78,9 @@ describe('transform', () => {
|
|||||||
{
|
{
|
||||||
latest: "auto",
|
latest: "auto",
|
||||||
prefix: "sha-",
|
prefix: "sha-",
|
||||||
suffix: ""
|
prefixLatest: false,
|
||||||
|
suffix: "",
|
||||||
|
suffixLatest: false,
|
||||||
} as Flavor,
|
} as Flavor,
|
||||||
false
|
false
|
||||||
],
|
],
|
||||||
@@ -83,7 +91,9 @@ describe('transform', () => {
|
|||||||
{
|
{
|
||||||
latest: "auto",
|
latest: "auto",
|
||||||
prefix: "",
|
prefix: "",
|
||||||
suffix: "-alpine"
|
prefixLatest: false,
|
||||||
|
suffix: "-alpine",
|
||||||
|
suffixLatest: false,
|
||||||
} as Flavor,
|
} as Flavor,
|
||||||
false
|
false
|
||||||
],
|
],
|
||||||
@@ -96,7 +106,49 @@ describe('transform', () => {
|
|||||||
{
|
{
|
||||||
latest: "false",
|
latest: "false",
|
||||||
prefix: "dev-",
|
prefix: "dev-",
|
||||||
suffix: "-alpine"
|
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,
|
} as Flavor,
|
||||||
false
|
false
|
||||||
],
|
],
|
||||||
|
@@ -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 () => {
|
||||||
|
@@ -6,19 +6,14 @@ import {getInputs, Inputs} from '../src/context';
|
|||||||
import * as github from '../src/github';
|
import * as github from '../src/github';
|
||||||
import {Meta, Version} from '../src/meta';
|
import {Meta, Version} from '../src/meta';
|
||||||
import {Context} from '@actions/github/lib/context';
|
import {Context} from '@actions/github/lib/context';
|
||||||
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'));
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
jest.spyOn(github, 'context').mockImplementation(
|
jest.spyOn(github, 'context').mockImplementation((): Context => {
|
||||||
(): Context => {
|
|
||||||
return new Context();
|
return new Context();
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
jest.spyOn(global.Date.prototype, 'toISOString').mockImplementation(() => {
|
jest.spyOn(global.Date.prototype, 'toISOString').mockImplementation(() => {
|
||||||
return '2020-01-10T00:30:00.000Z';
|
return '2020-01-10T00:30:00.000Z';
|
||||||
@@ -384,14 +379,12 @@ describe('push', () => {
|
|||||||
],
|
],
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
main: 'master',
|
main: 'sha-90dd603',
|
||||||
partial: ['sha-90dd603'],
|
partial: [],
|
||||||
latest: false
|
latest: false
|
||||||
} as Version,
|
} as Version,
|
||||||
[
|
[
|
||||||
'org/app:master',
|
|
||||||
'org/app:sha-90dd603',
|
'org/app:sha-90dd603',
|
||||||
'ghcr.io/user/app:master',
|
|
||||||
'ghcr.io/user/app:sha-90dd603'
|
'ghcr.io/user/app:sha-90dd603'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -399,7 +392,7 @@ describe('push', () => {
|
|||||||
"org.opencontainers.image.description=This your first repo!",
|
"org.opencontainers.image.description=This your first repo!",
|
||||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||||
"org.opencontainers.image.version=master",
|
"org.opencontainers.image.version=sha-90dd603",
|
||||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
"org.opencontainers.image.licenses=MIT"
|
"org.opencontainers.image.licenses=MIT"
|
||||||
@@ -416,14 +409,12 @@ describe('push', () => {
|
|||||||
],
|
],
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
main: 'my-feature-1245',
|
main: 'sha-90dd603',
|
||||||
partial: ['sha-90dd603'],
|
partial: [],
|
||||||
latest: false
|
latest: false
|
||||||
} as Version,
|
} as Version,
|
||||||
[
|
[
|
||||||
'org/app:my-feature-1245',
|
|
||||||
'org/app:sha-90dd603',
|
'org/app:sha-90dd603',
|
||||||
'ghcr.io/user/app:my-feature-1245',
|
|
||||||
'ghcr.io/user/app:sha-90dd603'
|
'ghcr.io/user/app:sha-90dd603'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -431,7 +422,7 @@ describe('push', () => {
|
|||||||
"org.opencontainers.image.description=This your first repo!",
|
"org.opencontainers.image.description=This your first repo!",
|
||||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||||
"org.opencontainers.image.version=my-feature-1245",
|
"org.opencontainers.image.version=sha-90dd603",
|
||||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
"org.opencontainers.image.licenses=MIT"
|
"org.opencontainers.image.licenses=MIT"
|
||||||
@@ -444,24 +435,22 @@ describe('push', () => {
|
|||||||
images: ['org/app', 'ghcr.io/user/app'],
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
tags: [
|
tags: [
|
||||||
`type=semver,pattern={{version}}`,
|
`type=semver,pattern={{version}}`,
|
||||||
|
`type=pep440,pattern={{version}}`,
|
||||||
`type=edge`
|
`type=edge`
|
||||||
],
|
],
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
main: 'my-feature-1245',
|
main: undefined,
|
||||||
partial: [],
|
partial: [],
|
||||||
latest: false
|
latest: false
|
||||||
} as Version,
|
} as Version,
|
||||||
[
|
[],
|
||||||
'org/app:my-feature-1245',
|
|
||||||
'ghcr.io/user/app:my-feature-1245'
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"org.opencontainers.image.title=Hello-World",
|
"org.opencontainers.image.title=Hello-World",
|
||||||
"org.opencontainers.image.description=This your first repo!",
|
"org.opencontainers.image.description=This your first repo!",
|
||||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||||
"org.opencontainers.image.version=my-feature-1245",
|
"org.opencontainers.image.version=",
|
||||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
"org.opencontainers.image.licenses=MIT"
|
"org.opencontainers.image.licenses=MIT"
|
||||||
@@ -504,6 +493,7 @@ describe('push', () => {
|
|||||||
images: ['user/app'],
|
images: ['user/app'],
|
||||||
tags: [
|
tags: [
|
||||||
`type=semver,pattern={{version}},value=v1.2.3`,
|
`type=semver,pattern={{version}},value=v1.2.3`,
|
||||||
|
`type=pep440,pattern={{version}},value=v1.2.3`,
|
||||||
`type=edge`
|
`type=edge`
|
||||||
],
|
],
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
@@ -595,16 +585,18 @@ describe('push', () => {
|
|||||||
images: ['user/app'],
|
images: ['user/app'],
|
||||||
tags: [
|
tags: [
|
||||||
`type=raw,value=mytag-{{branch}}`,
|
`type=raw,value=mytag-{{branch}}`,
|
||||||
|
`type=raw,value=mytag-{{date 'YYYYMMDD'}}`,
|
||||||
`type=raw,value=mytag-{{tag}}`
|
`type=raw,value=mytag-{{tag}}`
|
||||||
],
|
],
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
main: 'mytag-master',
|
main: 'mytag-master',
|
||||||
partial: ['mytag-'],
|
partial: ['mytag-20200110', 'mytag-'],
|
||||||
latest: false
|
latest: false
|
||||||
} as Version,
|
} as Version,
|
||||||
[
|
[
|
||||||
'user/app:mytag-master',
|
'user/app:mytag-master',
|
||||||
|
'user/app:mytag-20200110',
|
||||||
'user/app:mytag-'
|
'user/app:mytag-'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -650,6 +642,37 @@ describe('push', () => {
|
|||||||
"org.opencontainers.image.licenses=MIT"
|
"org.opencontainers.image.licenses=MIT"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'push19',
|
||||||
|
'event_push.env',
|
||||||
|
{
|
||||||
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=edge,branch=master`,
|
||||||
|
`type=ref,event=branch,enable=false`,
|
||||||
|
`type=sha,format=long`
|
||||||
|
],
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: 'sha-90dd6032fac8bda1b6c4436a2e65de27961ed071',
|
||||||
|
partial: [],
|
||||||
|
latest: false
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'org/app:sha-90dd6032fac8bda1b6c4436a2e65de27961ed071',
|
||||||
|
'ghcr.io/user/app:sha-90dd6032fac8bda1b6c4436a2e65de27961ed071'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"org.opencontainers.image.title=Hello-World",
|
||||||
|
"org.opencontainers.image.description=This your first repo!",
|
||||||
|
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||||
|
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||||
|
"org.opencontainers.image.version=sha-90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
|
]
|
||||||
])('given %p with %p event', tagsLabelsTest);
|
])('given %p with %p event', tagsLabelsTest);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1302,7 +1325,332 @@ describe('tag', () => {
|
|||||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
"org.opencontainers.image.licenses=MIT"
|
"org.opencontainers.image.licenses=MIT"
|
||||||
]
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'tag21',
|
||||||
|
'event_tag_v1.1.1.env',
|
||||||
|
{
|
||||||
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=semver,pattern={{version}}`,
|
||||||
|
`type=semver,pattern={{major}}.{{minor}}.{{patch}}`
|
||||||
|
],
|
||||||
|
flavor: [
|
||||||
|
`suffix=-dev,onlatest=true`
|
||||||
]
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: '1.1.1-dev',
|
||||||
|
partial: [],
|
||||||
|
latest: true
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'org/app:1.1.1-dev',
|
||||||
|
'org/app:latest-dev',
|
||||||
|
'ghcr.io/user/app:1.1.1-dev',
|
||||||
|
'ghcr.io/user/app:latest-dev'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"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.1.1-dev",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'tag22',
|
||||||
|
'event_tag_v1.1.1.env',
|
||||||
|
{
|
||||||
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=semver,pattern={{version}}`,
|
||||||
|
`type=semver,pattern={{major}}.{{minor}}.{{patch}}`
|
||||||
|
],
|
||||||
|
flavor: [
|
||||||
|
`prefix=foo-,onlatest=true`,
|
||||||
|
`suffix=-dev,onlatest=true`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: 'foo-1.1.1-dev',
|
||||||
|
partial: [],
|
||||||
|
latest: true
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'org/app:foo-1.1.1-dev',
|
||||||
|
'org/app:foo-latest-dev',
|
||||||
|
'ghcr.io/user/app:foo-1.1.1-dev',
|
||||||
|
'ghcr.io/user/app:foo-latest-dev'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"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=foo-1.1.1-dev",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'tag23',
|
||||||
|
'event_tag_v1.1.1.env',
|
||||||
|
{
|
||||||
|
images: ['org/app'],
|
||||||
|
tags: [
|
||||||
|
`type=pep440,pattern={{raw}}`,
|
||||||
|
`type=pep440,pattern={{major}}.{{minor}}`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: 'v1.1.1',
|
||||||
|
partial: ['1.1'],
|
||||||
|
latest: true
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'org/app:v1.1.1',
|
||||||
|
'org/app:1.1',
|
||||||
|
'org/app:latest'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"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=v1.1.1",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'tag24',
|
||||||
|
'event_tag_1.2.env',
|
||||||
|
{
|
||||||
|
images: ['org/app'],
|
||||||
|
tags: [
|
||||||
|
`type=pep440,pattern={{version}}`,
|
||||||
|
`type=pep440,pattern={{major}}.{{minor}}`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: '1.2',
|
||||||
|
partial: [],
|
||||||
|
latest: true
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'org/app:1.2',
|
||||||
|
'org/app:latest',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"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",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'tag25',
|
||||||
|
'event_tag_1.1beta2.env',
|
||||||
|
{
|
||||||
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=pep440,pattern={{major}}.{{minor}}`,
|
||||||
|
`type=pep440,pattern={{major}}`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: '1.1b2',
|
||||||
|
partial: [],
|
||||||
|
latest: false
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'org/app:1.1b2',
|
||||||
|
'ghcr.io/user/app:1.1b2'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"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.1b2",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'tag26',
|
||||||
|
'event_tag_1.0dev4.env',
|
||||||
|
{
|
||||||
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=pep440,pattern={{major}}.{{minor}}`,
|
||||||
|
`type=pep440,pattern={{major}}`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: '1.0.dev4',
|
||||||
|
partial: [],
|
||||||
|
latest: false
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'org/app:1.0.dev4',
|
||||||
|
'ghcr.io/user/app:1.0.dev4'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"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.0.dev4",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'tag27',
|
||||||
|
'event_tag_1.2.3rc2.env',
|
||||||
|
{
|
||||||
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=pep440,pattern={{raw}}`,
|
||||||
|
`type=pep440,pattern={{version}}`,
|
||||||
|
`type=pep440,pattern={{major}}.{{minor}}`,
|
||||||
|
`type=pep440,pattern={{major}}`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: '1.2.3rc2',
|
||||||
|
partial: [],
|
||||||
|
latest: false
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'org/app:1.2.3rc2',
|
||||||
|
'ghcr.io/user/app:1.2.3rc2'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"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.3rc2",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'tag28',
|
||||||
|
'event_tag_v1.1.1.env',
|
||||||
|
{
|
||||||
|
images: ['org/app'],
|
||||||
|
tags: [
|
||||||
|
`type=pep440,pattern={{version}}`,
|
||||||
|
`type=pep440,pattern={{major}}.{{minor}}.{{patch}}`,
|
||||||
|
`type=pep440,pattern={{major}}.{{minor}}`,
|
||||||
|
`type=pep440,pattern={{major}}`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: '1.1.1',
|
||||||
|
partial: [
|
||||||
|
"1.1",
|
||||||
|
"1"
|
||||||
|
],
|
||||||
|
latest: true
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'org/app:1.1.1',
|
||||||
|
'org/app:1.1',
|
||||||
|
'org/app:1',
|
||||||
|
'org/app:latest'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"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.1.1",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'tag29',
|
||||||
|
'event_tag_1.2post1.env',
|
||||||
|
{
|
||||||
|
images: ['org/app'],
|
||||||
|
tags: [
|
||||||
|
`type=pep440,pattern={{version}}`,
|
||||||
|
`type=pep440,pattern={{major}}.{{minor}}`,
|
||||||
|
`type=pep440,pattern={{major}}`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: '1.2.post1',
|
||||||
|
partial: [],
|
||||||
|
latest: false
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'org/app:1.2.post1'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"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.post1",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'tag30',
|
||||||
|
'event_tag_sometag.env',
|
||||||
|
{
|
||||||
|
images: ['ghcr.io/user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=ref,event=tag`,
|
||||||
|
`type=pep440,pattern={{version}}`,
|
||||||
|
`type=pep440,pattern={{major}}.{{minor}}`,
|
||||||
|
`type=pep440,pattern={{major}}`
|
||||||
|
],
|
||||||
|
flavor: [
|
||||||
|
`latest=false`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: 'sometag',
|
||||||
|
partial: [],
|
||||||
|
latest: false
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'ghcr.io/user/app:sometag'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"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=sometag",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
|
],
|
||||||
])('given %p with %p event', tagsLabelsTest);
|
])('given %p with %p event', tagsLabelsTest);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1776,6 +2124,108 @@ describe('pr', () => {
|
|||||||
"org.opencontainers.image.revision=1e9249f05bfc090e0688b8fb9c1b347586add504",
|
"org.opencontainers.image.revision=1e9249f05bfc090e0688b8fb9c1b347586add504",
|
||||||
"org.opencontainers.image.licenses=MIT"
|
"org.opencontainers.image.licenses=MIT"
|
||||||
]
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pr07',
|
||||||
|
'event_pull_request_target.env',
|
||||||
|
{
|
||||||
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=sha,priority=2000`,
|
||||||
|
`type=ref,event=pr`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: 'sha-f24900b',
|
||||||
|
partial: ['pr-8'],
|
||||||
|
latest: false
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'org/app:sha-f24900b',
|
||||||
|
'org/app:pr-8',
|
||||||
|
'ghcr.io/user/app:sha-f24900b',
|
||||||
|
'ghcr.io/user/app:pr-8'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"org.opencontainers.image.title=Hello-World",
|
||||||
|
"org.opencontainers.image.description=This your first repo!",
|
||||||
|
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||||
|
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||||
|
"org.opencontainers.image.version=sha-f24900b",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=f24900bfcfee76d8055c8421a164c7e57ad20e68",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pr08',
|
||||||
|
'event_pull_request_target.env',
|
||||||
|
{
|
||||||
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=ref,event=pr,prefix=`
|
||||||
|
],
|
||||||
|
flavor: [
|
||||||
|
`prefix=glo-`,
|
||||||
|
`suffix=-bal`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: '8-bal',
|
||||||
|
partial: [],
|
||||||
|
latest: false
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'org/app:8-bal',
|
||||||
|
'ghcr.io/user/app:8-bal'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"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=8-bal",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=f24900bfcfee76d8055c8421a164c7e57ad20e68",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pr09',
|
||||||
|
'event_pull_request_target.env',
|
||||||
|
{
|
||||||
|
images: ['org/app'],
|
||||||
|
tags: [
|
||||||
|
`type=ref,event=tag`,
|
||||||
|
`type=ref,event=pr`,
|
||||||
|
`type=ref,event=branch`,
|
||||||
|
`type=sha`,
|
||||||
|
`type=sha,format=long`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: 'pr-8',
|
||||||
|
partial: [
|
||||||
|
'sha-f24900b',
|
||||||
|
'sha-f24900bfcfee76d8055c8421a164c7e57ad20e68'
|
||||||
|
],
|
||||||
|
latest: false
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'org/app:pr-8',
|
||||||
|
'org/app:sha-f24900b',
|
||||||
|
'org/app:sha-f24900bfcfee76d8055c8421a164c7e57ad20e68'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"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=pr-8",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=f24900bfcfee76d8055c8421a164c7e57ad20e68",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
]
|
]
|
||||||
])('given %p with %p event', tagsLabelsTest);
|
])('given %p with %p event', tagsLabelsTest);
|
||||||
});
|
});
|
||||||
@@ -2394,6 +2844,258 @@ describe('raw', () => {
|
|||||||
])('given %p wth %p event', tagsLabelsTest);
|
])('given %p wth %p event', tagsLabelsTest);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('json', () => {
|
||||||
|
// prettier-ignore
|
||||||
|
test.each([
|
||||||
|
[
|
||||||
|
'json01',
|
||||||
|
'event_push.env',
|
||||||
|
{
|
||||||
|
images: ['user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=ref,event=branch`,
|
||||||
|
`type=raw,my`,
|
||||||
|
`type=raw,custom`,
|
||||||
|
`type=raw,tags`
|
||||||
|
],
|
||||||
|
labels: [
|
||||||
|
"invalid"
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
"tags": [
|
||||||
|
"user/app:dev",
|
||||||
|
"user/app:my",
|
||||||
|
"user/app:custom",
|
||||||
|
"user/app:tags"
|
||||||
|
],
|
||||||
|
"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": "dev",
|
||||||
|
"org.opencontainers.image.created": "2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision": "90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses": "MIT"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'json02',
|
||||||
|
'event_push.env',
|
||||||
|
{
|
||||||
|
images: ['user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=ref,event=branch`,
|
||||||
|
`type=raw,my`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
"tags": [
|
||||||
|
"user/app:dev",
|
||||||
|
"user/app:my",
|
||||||
|
],
|
||||||
|
"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": "dev",
|
||||||
|
"org.opencontainers.image.created": "2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision": "90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses": "MIT"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'json03',
|
||||||
|
'event_tag_release1.env',
|
||||||
|
{
|
||||||
|
images: ['user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=ref,event=tag`,
|
||||||
|
`type=raw,my`,
|
||||||
|
`type=raw,custom`,
|
||||||
|
`type=raw,tags`
|
||||||
|
],
|
||||||
|
bakeTarget: "meta"
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
"tags": [
|
||||||
|
"user/app:release1",
|
||||||
|
"user/app:my",
|
||||||
|
"user/app:custom",
|
||||||
|
"user/app:tags",
|
||||||
|
"user/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": "release1",
|
||||||
|
"org.opencontainers.image.created": "2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision": "90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses": "MIT"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'json04',
|
||||||
|
'event_tag_20200110-RC2.env',
|
||||||
|
{
|
||||||
|
images: ['user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=match,pattern=\\d{8}`,
|
||||||
|
`type=raw,my`,
|
||||||
|
`type=raw,custom`,
|
||||||
|
`type=raw,tags`
|
||||||
|
],
|
||||||
|
flavor: [
|
||||||
|
`latest=false`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
"tags": [
|
||||||
|
"user/app:20200110",
|
||||||
|
"user/app:my",
|
||||||
|
"user/app:custom",
|
||||||
|
"user/app:tags"
|
||||||
|
],
|
||||||
|
"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": "20200110",
|
||||||
|
"org.opencontainers.image.created": "2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision": "90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses": "MIT"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'json05',
|
||||||
|
'event_tag_v1.1.1.env',
|
||||||
|
{
|
||||||
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=semver,pattern={{version}}`,
|
||||||
|
`type=semver,pattern={{major}}.{{minor}}`,
|
||||||
|
`type=semver,pattern={{major}}`,
|
||||||
|
`type=raw,my`,
|
||||||
|
`type=raw,custom`,
|
||||||
|
`type=raw,tags`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
"tags": [
|
||||||
|
"org/app:1.1.1",
|
||||||
|
"org/app:1.1",
|
||||||
|
"org/app:1",
|
||||||
|
"org/app:my",
|
||||||
|
"org/app:custom",
|
||||||
|
"org/app:tags",
|
||||||
|
"org/app:latest",
|
||||||
|
"ghcr.io/user/app:1.1.1",
|
||||||
|
"ghcr.io/user/app:1.1",
|
||||||
|
"ghcr.io/user/app:1",
|
||||||
|
"ghcr.io/user/app:my",
|
||||||
|
"ghcr.io/user/app:custom",
|
||||||
|
"ghcr.io/user/app:tags",
|
||||||
|
"ghcr.io/user/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.1.1",
|
||||||
|
"org.opencontainers.image.created": "2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision": "90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses": "MIT"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'json06',
|
||||||
|
'event_tag_v1.1.1.env',
|
||||||
|
{
|
||||||
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=raw,my`,
|
||||||
|
`type=raw,custom`,
|
||||||
|
`type=raw,tags`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
"tags": [
|
||||||
|
"org/app:my",
|
||||||
|
"org/app:custom",
|
||||||
|
"org/app:tags",
|
||||||
|
"ghcr.io/user/app:my",
|
||||||
|
"ghcr.io/user/app:custom",
|
||||||
|
"ghcr.io/user/app:tags"
|
||||||
|
],
|
||||||
|
"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": "my",
|
||||||
|
"org.opencontainers.image.created": "2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision": "90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses": "MIT"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'json07',
|
||||||
|
'event_tag_v1.1.1.env',
|
||||||
|
{
|
||||||
|
images: ['org/app'],
|
||||||
|
labels: [
|
||||||
|
"foo",
|
||||||
|
"maintainer=CrazyMax",
|
||||||
|
"org.opencontainers.image.title=MyCustom=Title",
|
||||||
|
"org.opencontainers.image.description=Another description",
|
||||||
|
"org.opencontainers.image.vendor=MyCompany",
|
||||||
|
],
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
"tags": [
|
||||||
|
"org/app:v1.1.1",
|
||||||
|
"org/app:latest"
|
||||||
|
],
|
||||||
|
"labels": {
|
||||||
|
"maintainer": "CrazyMax",
|
||||||
|
"org.opencontainers.image.title": "MyCustom=Title",
|
||||||
|
"org.opencontainers.image.description": "Another description",
|
||||||
|
"org.opencontainers.image.url": "https://github.com/octocat/Hello-World",
|
||||||
|
"org.opencontainers.image.source": "https://github.com/octocat/Hello-World",
|
||||||
|
"org.opencontainers.image.vendor": "MyCompany",
|
||||||
|
"org.opencontainers.image.version": "v1.1.1",
|
||||||
|
"org.opencontainers.image.created": "2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision": "90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses": "MIT"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
])('given %p with %p event', async (name: string, envFile: string, inputs: Inputs, exJSON: {}) => {
|
||||||
|
process.env = dotenv.parse(fs.readFileSync(path.join(__dirname, 'fixtures', envFile)));
|
||||||
|
const context = github.context();
|
||||||
|
console.log(process.env, context);
|
||||||
|
|
||||||
|
const repo = await github.repo(process.env.GITHUB_TOKEN || '');
|
||||||
|
const meta = new Meta({...getInputs(), ...inputs}, context, repo);
|
||||||
|
|
||||||
|
const jsonOutput = meta.getJSON();
|
||||||
|
console.log('json', jsonOutput);
|
||||||
|
expect(jsonOutput).toEqual(exJSON);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('bake', () => {
|
describe('bake', () => {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
test.each([
|
test.each([
|
||||||
|
3
codecov.yml
Normal file
3
codecov.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
comment: false
|
||||||
|
github_checks:
|
||||||
|
annotations: false
|
12344
dist/index.js
generated
vendored
12344
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
27
package.json
27
package.json
@@ -29,23 +29,24 @@
|
|||||||
],
|
],
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.7",
|
"@actions/core": "^1.5.0",
|
||||||
"@actions/github": "^4.0.0",
|
"@actions/github": "^5.0.0",
|
||||||
"csv-parse": "^4.15.4",
|
"@renovate/pep440": "^1.0.0",
|
||||||
|
"csv-parse": "^4.16.0",
|
||||||
"handlebars": "^4.7.7",
|
"handlebars": "^4.7.7",
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"semver": "^7.3.5"
|
"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,22 +1,33 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
import csvparse from 'csv-parse/lib/sync';
|
||||||
|
|
||||||
export interface Flavor {
|
export interface Flavor {
|
||||||
latest: string;
|
latest: string;
|
||||||
prefix: string;
|
prefix: string;
|
||||||
|
prefixLatest: boolean;
|
||||||
suffix: string;
|
suffix: string;
|
||||||
|
suffixLatest: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Transform(inputs: string[]): Flavor {
|
export function Transform(inputs: string[]): Flavor {
|
||||||
const flavor: Flavor = {
|
const flavor: Flavor = {
|
||||||
latest: 'auto',
|
latest: 'auto',
|
||||||
prefix: '',
|
prefix: '',
|
||||||
suffix: ''
|
prefixLatest: false,
|
||||||
|
suffix: '',
|
||||||
|
suffixLatest: false
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const input of inputs) {
|
for (const input of inputs) {
|
||||||
const parts = input.split('=', 2);
|
const fields = csvparse(input, {
|
||||||
|
relaxColumnCount: true,
|
||||||
|
skipLinesWithEmptyValues: true
|
||||||
|
})[0];
|
||||||
|
let onlatestfor = '';
|
||||||
|
for (const field of fields) {
|
||||||
|
const parts = field.toString().split('=', 2);
|
||||||
if (parts.length == 1) {
|
if (parts.length == 1) {
|
||||||
throw new Error(`Invalid entry: ${input}`);
|
throw new Error(`Invalid flavor entry: ${input}`);
|
||||||
}
|
}
|
||||||
switch (parts[0]) {
|
switch (parts[0]) {
|
||||||
case 'latest': {
|
case 'latest': {
|
||||||
@@ -28,14 +39,33 @@ export function Transform(inputs: string[]): Flavor {
|
|||||||
}
|
}
|
||||||
case 'prefix': {
|
case 'prefix': {
|
||||||
flavor.prefix = parts[1];
|
flavor.prefix = parts[1];
|
||||||
|
onlatestfor = 'prefix';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'suffix': {
|
case 'suffix': {
|
||||||
flavor.suffix = parts[1];
|
flavor.suffix = parts[1];
|
||||||
|
onlatestfor = 'suffix';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'onlatest': {
|
||||||
|
if (!['true', 'false'].includes(parts[1])) {
|
||||||
|
throw new Error(`Invalid value for onlatest attribute: ${parts[1]}`);
|
||||||
|
}
|
||||||
|
switch (onlatestfor) {
|
||||||
|
case 'prefix': {
|
||||||
|
flavor.prefixLatest = /true/i.test(parts[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'suffix': {
|
||||||
|
flavor.suffixLatest = /true/i.test(parts[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(`Unknown entry: ${input}`);
|
throw new Error(`Unknown flavor entry: ${input}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,7 +73,9 @@ export function Transform(inputs: string[]): Flavor {
|
|||||||
core.startGroup(`Processing flavor input`);
|
core.startGroup(`Processing flavor input`);
|
||||||
core.info(`latest=${flavor.latest}`);
|
core.info(`latest=${flavor.latest}`);
|
||||||
core.info(`prefix=${flavor.prefix}`);
|
core.info(`prefix=${flavor.prefix}`);
|
||||||
|
core.info(`prefixLatest=${flavor.prefixLatest}`);
|
||||||
core.info(`suffix=${flavor.suffix}`);
|
core.info(`suffix=${flavor.suffix}`);
|
||||||
|
core.info(`suffixLatest=${flavor.suffixLatest}`);
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
|
|
||||||
return flavor;
|
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;
|
|
||||||
}
|
}
|
||||||
|
10
src/main.ts
10
src/main.ts
@@ -4,7 +4,6 @@ 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 {
|
||||||
@@ -14,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}`);
|
||||||
@@ -60,6 +59,13 @@ async function run() {
|
|||||||
core.endGroup();
|
core.endGroup();
|
||||||
setOutput('labels', labels.join(inputs.sepLabels));
|
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
|
// Bake definition file
|
||||||
const bakeFile: string = meta.getBakeFile();
|
const bakeFile: string = meta.getBakeFile();
|
||||||
core.startGroup(`Bake definition file`);
|
core.startGroup(`Bake definition file`);
|
||||||
|
98
src/meta.ts
98
src/meta.ts
@@ -2,13 +2,14 @@ import * as handlebars from 'handlebars';
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
import * as pep440 from '@renovate/pep440';
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
import {Inputs, tmpDir} from './context';
|
import {Inputs, tmpDir} from './context';
|
||||||
|
import {ReposGetResponseData} from './github';
|
||||||
import * as tcl from './tag';
|
import * as tcl from './tag';
|
||||||
import * as fcl from './flavor';
|
import * as fcl from './flavor';
|
||||||
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';
|
|
||||||
|
|
||||||
export interface Version {
|
export interface Version {
|
||||||
main: string | undefined;
|
main: string | undefined;
|
||||||
@@ -27,6 +28,12 @@ export class Meta {
|
|||||||
private readonly date: Date;
|
private readonly date: Date;
|
||||||
|
|
||||||
constructor(inputs: Inputs, context: Context, repo: ReposGetResponseData) {
|
constructor(inputs: Inputs, context: Context, repo: ReposGetResponseData) {
|
||||||
|
// Needs to override Git reference with pr ref instead of upstream branch ref
|
||||||
|
// for pull_request_target event
|
||||||
|
if (/pull_request_target/.test(context.eventName)) {
|
||||||
|
context.ref = `refs/pull/${context.payload.number}/merge`;
|
||||||
|
}
|
||||||
|
|
||||||
this.inputs = inputs;
|
this.inputs = inputs;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.repo = repo;
|
this.repo = repo;
|
||||||
@@ -56,6 +63,10 @@ export class Meta {
|
|||||||
version = this.procSemver(version, tag);
|
version = this.procSemver(version, tag);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case tcl.Type.Pep440: {
|
||||||
|
version = this.procPep440(version, tag);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case tcl.Type.Match: {
|
case tcl.Type.Match: {
|
||||||
version = this.procMatch(version, tag);
|
version = this.procMatch(version, tag);
|
||||||
break;
|
break;
|
||||||
@@ -141,6 +152,53 @@ export class Meta {
|
|||||||
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? latest : this.flavor.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 {
|
private procMatch(version: Version, tag: tcl.Tag): Version {
|
||||||
if (!/^refs\/tags\//.test(this.context.ref) && tag.attrs['value'].length == 0) {
|
if (!/^refs\/tags\//.test(this.context.ref) && tag.attrs['value'].length == 0) {
|
||||||
return version;
|
return version;
|
||||||
@@ -153,7 +211,6 @@ export class Meta {
|
|||||||
vraw = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
vraw = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
||||||
}
|
}
|
||||||
|
|
||||||
let latest: boolean = false;
|
|
||||||
let tmatch;
|
let tmatch;
|
||||||
const isRegEx = tag.attrs['pattern'].match(/^\/(.+)\/(.*)$/);
|
const isRegEx = tag.attrs['pattern'].match(/^\/(.+)\/(.*)$/);
|
||||||
if (isRegEx) {
|
if (isRegEx) {
|
||||||
@@ -194,6 +251,7 @@ export class Meta {
|
|||||||
if (!/^refs\/pull\//.test(this.context.ref)) {
|
if (!/^refs\/pull\//.test(this.context.ref)) {
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
const vraw = this.setValue(this.context.ref.replace(/^refs\/pull\//g, '').replace(/\/merge$/g, ''), tag);
|
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');
|
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
||||||
}
|
}
|
||||||
@@ -207,11 +265,11 @@ export class Meta {
|
|||||||
if (tag.attrs['branch'].length == 0) {
|
if (tag.attrs['branch'].length == 0) {
|
||||||
tag.attrs['branch'] = this.repo.default_branch;
|
tag.attrs['branch'] = this.repo.default_branch;
|
||||||
}
|
}
|
||||||
if (tag.attrs['branch'] === val) {
|
if (tag.attrs['branch'] != val) {
|
||||||
val = 'edge';
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
const vraw = this.setValue(val, tag);
|
const vraw = this.setValue('edge', tag);
|
||||||
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,6 +323,7 @@ export class Meta {
|
|||||||
|
|
||||||
private setGlobalExp(val): string {
|
private setGlobalExp(val): string {
|
||||||
const ctx = this.context;
|
const ctx = this.context;
|
||||||
|
const currentDate = this.date;
|
||||||
return handlebars.compile(val)({
|
return handlebars.compile(val)({
|
||||||
branch: function () {
|
branch: function () {
|
||||||
if (!/^refs\/heads\//.test(ctx.ref)) {
|
if (!/^refs\/heads\//.test(ctx.ref)) {
|
||||||
@@ -280,6 +339,9 @@ export class Meta {
|
|||||||
},
|
},
|
||||||
sha: function () {
|
sha: function () {
|
||||||
return ctx.sha.substr(0, 7);
|
return ctx.sha.substr(0, 7);
|
||||||
|
},
|
||||||
|
date: function (format) {
|
||||||
|
return moment(currentDate).utc().format(format);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -297,7 +359,7 @@ export class Meta {
|
|||||||
tags.push(`${imageLc}:${partial}`);
|
tags.push(`${imageLc}:${partial}`);
|
||||||
}
|
}
|
||||||
if (this.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 : ''}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tags;
|
return tags;
|
||||||
@@ -318,16 +380,21 @@ export class Meta {
|
|||||||
return labels;
|
return labels;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getBakeFile(): string {
|
public getJSON(): {} {
|
||||||
let jsonLabels = {};
|
return {
|
||||||
for (let label of this.getLabels()) {
|
tags: this.getTags(),
|
||||||
|
labels: this.getLabels().reduce((res, label) => {
|
||||||
const matches = label.match(/([^=]*)=(.*)/);
|
const matches = label.match(/([^=]*)=(.*)/);
|
||||||
if (!matches) {
|
if (!matches) {
|
||||||
continue;
|
return res;
|
||||||
}
|
}
|
||||||
jsonLabels[matches[1]] = matches[2];
|
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);
|
const bakeFile = path.join(tmpDir(), 'docker-metadata-action-bake.json').split(path.sep).join(path.posix.sep);
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
bakeFile,
|
bakeFile,
|
||||||
@@ -336,7 +403,14 @@ export class Meta {
|
|||||||
target: {
|
target: {
|
||||||
[this.inputs.bakeTarget]: {
|
[this.inputs.bakeTarget]: {
|
||||||
tags: this.getTags(),
|
tags: this.getTags(),
|
||||||
labels: jsonLabels,
|
labels: this.getLabels().reduce((res, label) => {
|
||||||
|
const matches = label.match(/([^=]*)=(.*)/);
|
||||||
|
if (!matches) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
res[matches[1]] = matches[2];
|
||||||
|
return res;
|
||||||
|
}, {}),
|
||||||
args: {
|
args: {
|
||||||
DOCKER_META_IMAGES: this.inputs.images.join(','),
|
DOCKER_META_IMAGES: this.inputs.images.join(','),
|
||||||
DOCKER_META_VERSION: this.version.main
|
DOCKER_META_VERSION: this.version.main
|
||||||
|
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;
|
||||||
|
}
|
@@ -4,6 +4,7 @@ import * as core from '@actions/core';
|
|||||||
export enum Type {
|
export enum Type {
|
||||||
Schedule = 'schedule',
|
Schedule = 'schedule',
|
||||||
Semver = 'semver',
|
Semver = 'semver',
|
||||||
|
Pep440 = 'pep440',
|
||||||
Match = 'match',
|
Match = 'match',
|
||||||
Edge = 'edge',
|
Edge = 'edge',
|
||||||
Ref = 'ref',
|
Ref = 'ref',
|
||||||
@@ -42,6 +43,7 @@ export class Tag {
|
|||||||
export const DefaultPriorities: Record<Type, string> = {
|
export const DefaultPriorities: Record<Type, string> = {
|
||||||
[Type.Schedule]: '1000',
|
[Type.Schedule]: '1000',
|
||||||
[Type.Semver]: '900',
|
[Type.Semver]: '900',
|
||||||
|
[Type.Pep440]: '900',
|
||||||
[Type.Match]: '800',
|
[Type.Match]: '800',
|
||||||
[Type.Edge]: '700',
|
[Type.Edge]: '700',
|
||||||
[Type.Ref]: '600',
|
[Type.Ref]: '600',
|
||||||
@@ -100,7 +102,7 @@ export function Parse(s: string): Tag {
|
|||||||
switch (key) {
|
switch (key) {
|
||||||
case 'type': {
|
case 'type': {
|
||||||
if (!Object.values(Type).includes(value)) {
|
if (!Object.values(Type).includes(value)) {
|
||||||
throw new Error(`Unknown type attribute: ${value}`);
|
throw new Error(`Unknown tag type attribute: ${value}`);
|
||||||
}
|
}
|
||||||
tag.type = value;
|
tag.type = value;
|
||||||
break;
|
break;
|
||||||
@@ -124,7 +126,8 @@ export function Parse(s: string): Tag {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Type.Semver: {
|
case Type.Semver:
|
||||||
|
case Type.Pep440: {
|
||||||
if (!tag.attrs.hasOwnProperty('pattern')) {
|
if (!tag.attrs.hasOwnProperty('pattern')) {
|
||||||
throw new Error(`Missing pattern attribute for ${s}`);
|
throw new Error(`Missing pattern attribute for ${s}`);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user