Skip to content

Commit 096b9b0

Browse files
committed
updated dist file for 11580b6
1 parent 11580b6 commit 096b9b0

File tree

4 files changed

+63
-63
lines changed

4 files changed

+63
-63
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
node-version:
7575
- 12
7676
steps:
77-
- uses: phish108/autotag-action@1.1.28
77+
- uses: phish108/autotag-action@1.1.29
7878
with:
7979
github-token: ${{ secrets.GITHUB_TOKEN}}
8080
```
@@ -107,7 +107,7 @@ jobs:
107107
- run: npm test
108108
env:
109109
CI: "true"
110-
- uses: phish108/autotag-action@1.1.28
110+
- uses: phish108/autotag-action@1.1.29
111111
with:
112112
github-token: ${{ secrets.GITHUB_TOKEN}}
113113
with-v: "true"
@@ -201,7 +201,7 @@ jobs:
201201
git config --local user.email "action@github.com"
202202
git config --local user.name "GitHub Action"
203203
204-
- uses: phish108/autotag-action@1.1.28
204+
- uses: phish108/autotag-action@1.1.29
205205
id: tagger
206206
env:
207207
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -218,7 +218,7 @@ jobs:
218218
with:
219219
github_token: ${{ secrets.GITHUB_TOKEN }}
220220
221-
- uses: phish108/autotag-action@1.1.28
221+
- uses: phish108/autotag-action@1.1.29
222222
env:
223223
github-token: ${{ secrets.GITHUB_TOKEN }}
224224
branch: master

dist/index.js

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async function getLatestTag(octokit, boolAll = true) {
3939
// strip all non version tags
4040
const allVTags = data
4141
.filter(tag => semver.clean(tag.name) !== null);
42-
42+
4343
allVTags
4444
.sort((a, b) => semver.compare(semver.clean(a.name), semver.clean(b.name)));
4545

@@ -48,8 +48,8 @@ async function getLatestTag(octokit, boolAll = true) {
4848
}
4949

5050
// filter prereleases
51-
// console.log("filter only main releases");
52-
51+
// core.info("filter only main releases");
52+
5353
const filtered = allVTags.filter((b) => semver.prerelease(b.name) === null);
5454
const result = filtered.pop();
5555

@@ -63,14 +63,14 @@ async function loadBranch(octokit, branch) {
6363
ref: `heads/${branch}`
6464
});
6565

66-
// console.log(`branch data: ${ JSON.stringify(result.data, undefined, 2) } `);
66+
// core.info(`branch data: ${ JSON.stringify(result.data, undefined, 2) } `);
6767
return result.data.shift();
6868
}
6969

7070
async function checkMessages(octokit, branchHeadSha, tagSha, issueTags) {
7171
const sha = branchHeadSha;
7272

73-
// console.log(`load commits since ${sha}`);
73+
// core.info(`load commits since ${sha}`);
7474

7575
let releaseBump = "none";
7676

@@ -93,52 +93,52 @@ async function checkMessages(octokit, branchHeadSha, tagSha, issueTags) {
9393
const matcher = new RegExp(/fix(?:es)? #(\d+)\b/);
9494

9595
for (const commit of result.data) {
96-
// console.log(commit.message);
96+
// core.info(commit.message);
9797
const message = commit.commit.message;
9898

9999
if (commit.sha === tagSha) {
100100
break;
101101
}
102-
// console.log(`commit is : "${JSON.stringify(commit.commit, undefined, 2)}"`);
103-
// console.log(`message is : "${message}" on ${commit.commit.committer.date} (${commit.sha})`);
102+
// core.info(`commit is : "${JSON.stringify(commit.commit, undefined, 2)}"`);
103+
// core.info(`message is : "${message}" on ${commit.commit.committer.date} (${commit.sha})`);
104104

105105
if (wip.test(message)) {
106-
// console.log("found wip message, skip");
106+
// core.info("found wip message, skip");
107107
continue;
108108
}
109109

110110
if (major.test(message)) {
111-
// console.log("found major tag, stop");
111+
// core.info("found major tag, stop");
112112
return "major";
113113
}
114-
114+
115115
if (minor.test(message)) {
116-
// console.log("found minor tag");
116+
// core.info("found minor tag");
117117

118118
releaseBump = "minor";
119119
continue;
120120
}
121121

122122
if (releaseBump !== "minor" && patch.test(message)) {
123-
// console.log("found patch tag");
123+
// core.info("found patch tag");
124124
releaseBump = "patch";
125125
continue;
126126
}
127127

128128
if (releaseBump !== "minor" && fix.test(message)) {
129-
// console.log("found a fix message, check issue for enhancements");
129+
// core.info("found a fix message, check issue for enhancements");
130130

131131
const id = matcher.exec(message);
132132

133133
if (id && Number(id[1]) > 0) {
134134
const issue_number = Number(id[1]);
135135

136-
console.log(`check issue ${issue_number} for minor labels`);
136+
core.info(`check issue ${issue_number} for minor labels`);
137137

138138
const { data } = await octokit.issues.get({
139139
owner,
140140
repo,
141-
issue_number
141+
issue_number
142142
});
143143

144144
if (data) {
@@ -147,7 +147,7 @@ async function checkMessages(octokit, branchHeadSha, tagSha, issueTags) {
147147
for (const label of data.labels) {
148148

149149
if (issueTags.indexOf(label.name) >= 0) {
150-
console.log("found enhancement issue");
150+
core.info("found enhancement issue");
151151
releaseBump = "minor";
152152
break;
153153
}
@@ -157,7 +157,7 @@ async function checkMessages(octokit, branchHeadSha, tagSha, issueTags) {
157157

158158
// continue;
159159
}
160-
// console.log("no info message");
160+
// core.info("no info message");
161161
}
162162

163163
return releaseBump;
@@ -175,54 +175,54 @@ function isReleaseBranch(branchName, branchList) {
175175
}
176176

177177
async function action() {
178-
console.log(`run for ${ owner } / ${ repo }`);
178+
core.info(`run for ${ owner } / ${ repo }`);
179+
180+
// core.info(`payload ${JSON.stringify(github.context.payload.repository, undefined, 2)}`);
179181

180-
// console.log(`payload ${JSON.stringify(github.context.payload.repository, undefined, 2)}`);
181-
182182
// prepare octokit
183-
const token = core.getInput('github-token');
183+
const token = core.getInput("github-token");
184184
const octokit = new github.getOctokit(token);
185-
185+
186186
// load inputs
187187
// const customTag = core.getInput('custom-tag');
188-
const dryRun = core.getInput('dry-run').toLowerCase();
189-
const level = core.getInput('bump');
190-
const forceBranch = core.getInput('branch');
191-
const releaseBranch = core.getInput('release-branch');
192-
const withV = core.getInput('with-v').toLowerCase() === "false" ? "" : "v";
193-
const customTag = core.getInput('tag');
194-
const issueLabels = core.getInput('issue-labels');
188+
const dryRun = core.getInput("dry-run").toLowerCase();
189+
const level = core.getInput("bump");
190+
const forceBranch = core.getInput("branch");
191+
const releaseBranch = core.getInput("release-branch");
192+
const withV = core.getInput("with-v").toLowerCase() === "false" ? "" : "v";
193+
const customTag = core.getInput("tag");
194+
const issueLabels = core.getInput("issue-labels");
195195

196196
let branchInfo, nextVersion;
197197

198198
if (forceBranch) {
199-
console.log(`check forced branch ${forceBranch}`);
199+
core.info(`check forced branch ${forceBranch}`);
200200

201201
branchInfo = await loadBranch(octokit, forceBranch);
202202

203203
if (!branchInfo) {
204-
throw new Error("unknown branch provided");
204+
throw new Error("unknown branch provided");
205205
}
206-
207-
console.log("branch confirmed, continue");
206+
207+
core.info("branch confirmed, continue");
208208
}
209209

210210
if (!branchInfo) {
211211
const activeBranch = github.context.ref.replace(/refs\/heads\//, "");
212212

213-
console.log(`load the history of activity-branch ${ activeBranch } from context ref ${ github.context.ref }`);
213+
core.info(`load the history of activity-branch ${ activeBranch } from context ref ${ github.context.ref }`);
214214
branchInfo = await loadBranch(octokit, activeBranch);
215215

216216
if (!branchInfo) {
217217
throw new Error(`failed to load branch ${ activeBranch }`);
218218
}
219219
}
220-
220+
221221
// the sha for tagging
222222
const sha = branchInfo.object.sha;
223223
const branchName = branchInfo.ref.split("/").pop();
224224

225-
console.log(`active branch name is ${ branchName }`);
225+
core.info(`active branch name is ${ branchName }`);
226226

227227
if (customTag){
228228
if (checkTag(octokit, customTag)) {
@@ -233,13 +233,13 @@ async function action() {
233233
}
234234
else {
235235

236-
console.log(`maching refs: ${ sha }`);
236+
core.info(`maching refs: ${ sha }`);
237237

238238
const latestTag = await getLatestTag(octokit);
239239
const latestMainTag = await getLatestTag(octokit, false);
240240

241-
console.log(`the previous tag of the repository ${ JSON.stringify(latestTag, undefined, 2) }`);
242-
console.log(`the previous main tag of the repository ${ JSON.stringify(latestMainTag, undefined, 2) }`);
241+
core.info(`the previous tag of the repository ${ JSON.stringify(latestTag, undefined, 2) }`);
242+
core.info(`the previous main tag of the repository ${ JSON.stringify(latestMainTag, undefined, 2) }`);
243243

244244
const versionTag = latestTag ? latestTag.name : "0.0.0";
245245

@@ -249,62 +249,62 @@ async function action() {
249249
throw new Error("no new commits, avoid tagging");
250250
}
251251

252-
console.log(`The repo tags: ${ JSON.stringify(latestTag, undefined, 2) }`);
252+
core.info(`The repo tags: ${ JSON.stringify(latestTag, undefined, 2) }`);
253253

254254
const version = semver.clean(versionTag);
255255

256256
nextVersion = semver.inc(
257-
version,
258-
"prerelease",
257+
version,
258+
"prerelease",
259259
branchName
260260
);
261261

262-
console.log(`default to prerelease version ${ nextVersion }`);
262+
core.info(`default to prerelease version ${ nextVersion }`);
263263

264264
let issLabs = ["enhancement"];
265265

266266
if (issueLabels) {
267-
const xlabels = issueLabels.split(',').map(lab => lab.trim());
267+
const xlabels = issueLabels.split(",").map(lab => lab.trim());
268268

269269
if (xlabels.length) {
270270
issLabs = xlabels;
271271
}
272272
}
273273

274274
// check if commits and issues point to a diffent release
275-
console.log("commits in branch");
275+
core.info("commits in branch");
276276
const msgLevel = await checkMessages(octokit, branchInfo.object.sha, latestMainTag.commit.sha, issLabs);
277-
// console.log(`commit messages suggest ${msgLevel} upgrade`);
278-
277+
// core.info(`commit messages suggest ${msgLevel} upgrade`);
278+
279279
if (isReleaseBranch(branchName, releaseBranch)) {
280-
console.log(`${ branchName } is a release branch`);
280+
core.info(`${ branchName } is a release branch`);
281281

282282
if (msgLevel === "none") {
283283
nextVersion = semver.inc(version, level);
284284
}
285285
else {
286-
console.log(`commit messages force bump level to ${msgLevel}`);
286+
core.info(`commit messages force bump level to ${msgLevel}`);
287287
nextVersion = semver.inc(version, msgLevel);
288288
}
289289
}
290290

291-
console.log( `bump tag ${ nextVersion }` );
291+
core.info( `bump tag ${ nextVersion }` );
292292

293293
core.setOutput("new-tag", nextVersion);
294294
}
295295

296296
if (dryRun === "true") {
297-
console.log("dry run, don't perform tagging");
298-
return
297+
core.info("dry run, don't perform tagging");
298+
return;
299299
}
300300

301301
const newTag = `${ withV }${ nextVersion }`;
302302

303-
console.log(`really add tag ${ customTag ? customTag : newTag }`);
303+
core.info(`really add tag ${ customTag ? customTag : newTag }`);
304304

305305
const ref = `refs/tags/${ customTag ? customTag : newTag }`;
306306

307-
const result = await octokit.git.createRef({
307+
await octokit.git.createRef({
308308
owner,
309309
repo,
310310
ref,
@@ -313,8 +313,8 @@ async function action() {
313313
}
314314

315315
action()
316-
.then(() => console.log("success"))
317-
.catch(error => core.setFailed(error.message))
316+
.then(() => core.info("success"))
317+
.catch(error => core.setFailed(error.message));
318318

319319

320320
/***/ }),

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "autotag",
3-
"version": "1.1.28",
3+
"version": "1.1.29",
44
"description": "",
55
"main": "dist/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)