Skip to content

Commit 7040b59

Browse files
authored
Replace forbidden chars derived from branch name (#29)
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
1 parent 3ae5afe commit 7040b59

5 files changed

Lines changed: 59 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 1.9.1 (2020/12/07)
4+
5+
* Replace forbidden chars derived from branch name (#30)
6+
* Bump semver from 7.3.2 to 7.3.4 (#26)
7+
38
## 1.9.0 (2020/12/04)
49

510
* Allow to add custom tags (#24)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
GITHUB_ACTION=crazy-maxghaction-dump-context
2+
GITHUB_ACTIONS=true
3+
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
4+
GITHUB_ACTOR=crazy-max
5+
GITHUB_API_URL=https://api.github.com
6+
GITHUB_BASE_REF=
7+
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_89a016e8-e5b7-4039-a67e-c8da08f87a0c
8+
GITHUB_EVENT_NAME=push
9+
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
10+
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
11+
GITHUB_HEAD_REF=
12+
GITHUB_JOB=event
13+
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_89a016e8-e5b7-4039-a67e-c8da08f87a0c
14+
GITHUB_REF="refs/heads/my/feature#1245"
15+
GITHUB_REPOSITORY=crazy-max/test-docker-action
16+
GITHUB_REPOSITORY_OWNER=crazy-max
17+
GITHUB_RETENTION_DAYS=90
18+
GITHUB_RUN_ID=325957516
19+
GITHUB_RUN_NUMBER=1
20+
GITHUB_SERVER_URL=https://github.com
21+
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
22+
GITHUB_WORKFLOW=event
23+
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action

__tests__/meta.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,35 @@ describe('push', () => {
376376
"org.opencontainers.image.licenses=MIT"
377377
]
378378
],
379+
[
380+
'event_push_invalidchars.env',
381+
{
382+
images: ['org/app', 'ghcr.io/user/app'],
383+
tagSha: true,
384+
tagEdge: true,
385+
} as Inputs,
386+
{
387+
main: 'my-feature-1245',
388+
partial: [],
389+
latest: false
390+
} as Version,
391+
[
392+
'org/app:my-feature-1245',
393+
'org/app:sha-90dd603',
394+
'ghcr.io/user/app:my-feature-1245',
395+
'ghcr.io/user/app:sha-90dd603'
396+
],
397+
[
398+
"org.opencontainers.image.title=Hello-World",
399+
"org.opencontainers.image.description=This your first repo!",
400+
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
401+
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
402+
"org.opencontainers.image.version=my-feature-1245",
403+
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
404+
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
405+
"org.opencontainers.image.licenses=MIT"
406+
]
407+
],
379408
])('given %p event ', tagsLabelsTest);
380409
});
381410

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/meta.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class Meta {
8383
version.latest = this.inputs.tagLatest;
8484
}
8585
} else if (/^refs\/heads\//.test(this.context.ref)) {
86-
version.main = this.context.ref.replace(/^refs\/heads\//g, '').replace(/\//g, '-');
86+
version.main = this.context.ref.replace(/^refs\/heads\//g, '').replace(/[^a-zA-Z0-9._-]+/g, '-');
8787
if (this.inputs.tagEdge && this.inputs.tagEdgeBranch === version.main) {
8888
version.main = 'edge';
8989
}

0 commit comments

Comments
 (0)