Skip to content

Commit

Permalink
Allow all tags (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuritz authored Mar 26, 2021
1 parent a280fa3 commit 805b0b8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async function run() {
const ghToken = core.getInput('ghToken');
const chStoryUrl = core.getInput('chStoryUrl');
const { ref } = github.context;
const tagRegex = /(?<refs>refs)\/(?<tags>tags)\/(?<tag>v\d{2}\.\d+\.\d+)/;
const tagRegex = /(?<refs>refs)\/(?<tags>tags)\/(?<tag>.*)/;
const validTag = ref.match(tagRegex);

if (!ghToken) {
Expand All @@ -109,7 +109,7 @@ async function run() {
core.setSecret('ghToken');

if (!validTag || !validTag.groups.tag) {
return core.setFailed('Tag must follow format rules: v##.##.##');
return core.setFailed('Ref must be a tag');
}

const {
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function run() {
const ghToken = core.getInput('ghToken');
const chStoryUrl = core.getInput('chStoryUrl');
const { ref } = github.context;
const tagRegex = /(?<refs>refs)\/(?<tags>tags)\/(?<tag>v\d{2}\.\d+\.\d+)/;
const tagRegex = /(?<refs>refs)\/(?<tags>tags)\/(?<tag>.*)/;
const validTag = ref.match(tagRegex);

if (!ghToken) {
Expand All @@ -93,7 +93,7 @@ export async function run() {
core.setSecret('ghToken');

if (!validTag || !validTag.groups.tag) {
return core.setFailed('Tag must follow format rules: v##.##.##');
return core.setFailed('Ref must be a tag');
}

const {
Expand Down
6 changes: 2 additions & 4 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('Release', () => {
});

test("should exit if tag isn't properly formatted", async () => {
github.context.ref = 'refs/tags/testing';
github.context.ref = 'refs/heads/v20.0.1';
inputs = {
createChangelog: 'true',
chStoryUrl,
Expand All @@ -101,9 +101,7 @@ describe('Release', () => {

await run();

expect(core.setFailed).toHaveBeenCalledWith(
'Tag must follow format rules: v##.##.##'
);
expect(core.setFailed).toHaveBeenCalledWith('Ref must be a tag');
});

describe('on createChangelog: true', () => {
Expand Down

0 comments on commit 805b0b8

Please sign in to comment.