Commit 40b4c942 authored by tom's avatar tom

fix labeling step and pretiffy logs

parent d7741dcb
...@@ -98,8 +98,7 @@ jobs: ...@@ -98,8 +98,7 @@ jobs:
script: | script: |
if (!process.env.LABEL_ID) { if (!process.env.LABEL_ID) {
core.info(`Label doesn not exist. No need to fetch issues.`); core.info(`Label doesn not exist. No need to fetch issues.`);
core.setOutput('result', false); return false;
return;
} }
const { data } = await github.request('GET /repos/{owner}/{repo}/issues', { const { data } = await github.request('GET /repos/{owner}/{repo}/issues', {
...@@ -111,9 +110,9 @@ jobs: ...@@ -111,9 +110,9 @@ jobs:
if (data.length > 0) { if (data.length > 0) {
core.info(`Found ${ data.length } closed issues with label ${ process.env.LABEL_NAME }. No further action required.`); core.info(`Found ${ data.length } closed issues with label ${ process.env.LABEL_NAME }. No further action required.`);
core.setOutput('result', false);
// core.setOutput('result', data.length > 0);
core.notice('Issues already labeled.') core.notice('Issues already labeled.')
return false;
// return data.length > 0;
} }
- name: Looking for commits between two releases - name: Looking for commits between two releases
...@@ -133,8 +132,7 @@ jobs: ...@@ -133,8 +132,7 @@ jobs:
if (commitsInRelease.length === 0) { if (commitsInRelease.length === 0) {
core.notice(`No commits found between ${ process.env.PREVIOUS_TAG } and ${ process.env.LATEST_TAG }`); core.notice(`No commits found between ${ process.env.PREVIOUS_TAG } and ${ process.env.LATEST_TAG }`);
core.setOutput('result', ''); return [];
return;
} }
const commits = commitsInRelease.map(({ sha }) => sha); const commits = commitsInRelease.map(({ sha }) => sha);
...@@ -157,20 +155,21 @@ jobs: ...@@ -157,20 +155,21 @@ jobs:
script: | script: |
const commits = JSON.parse(process.env.COMMITS); const commits = JSON.parse(process.env.COMMITS);
core.info(commits);
if (commits.length === 0) { if (commits.length === 0) {
core.setOutput('result', ''); return [];
return;
} }
const map = {}; const map = {};
core.startGroup(`Looking for linked issues:`);
for (const sha of commits) { for (const sha of commits) {
const result = await getLinkedIssuesForCommitPR(sha); const result = await getLinkedIssuesForCommitPR(sha);
result.forEach((issue) => { result.forEach((issue) => {
map[issue] = issue; map[issue] = issue;
}); });
} }
core.endGroup();
const issues = Object.values(map); const issues = Object.values(map);
if (issues.length > 0) { if (issues.length > 0) {
...@@ -230,7 +229,7 @@ jobs: ...@@ -230,7 +229,7 @@ jobs:
.map(({ closingIssuesReferences: { nodes: issues } }) => issues.map(({ number }) => number)) .map(({ closingIssuesReferences: { nodes: issues } }) => issues.map(({ number }) => number))
.flat(); .flat();
core.info(`Found following issues: ${ issues.join(', ') }`); core.info(`Found following issues: ${ issues.join(', ') || '-' }\n`);
return issues; return issues;
} }
...@@ -241,14 +240,14 @@ jobs: ...@@ -241,14 +240,14 @@ jobs:
if: ${{ !steps.has_labeled_issues.outputs.result }} if: ${{ !steps.has_labeled_issues.outputs.result }}
env: env:
LABEL_NAME: ${{ steps.tags.outputs.latest }} LABEL_NAME: ${{ steps.tags.outputs.latest }}
LABEL_COLOR: ${{ github.event.inputs.label_color }}
with: with:
script: | script: |
const color = ${{ github.event.inputs.label_color }}
const result = await github.request('POST /repos/{owner}/{repo}/labels', { const result = await github.request('POST /repos/{owner}/{repo}/labels', {
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
name: process.env.LABEL_NAME, name: process.env.LABEL_NAME,
color, color: process.env.LABEL_COLOR,
description: `Release ${ process.env.LABEL_NAME }`, description: `Release ${ process.env.LABEL_NAME }`,
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment