Skip to content

Commit

Permalink
Add a new output applied which shows the label added (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
WalshyDev authored Jan 25, 2021
1 parent 0230f30 commit 499910c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ inputs:
token:
description: 'GitHub Token for the user to perform label additions. Use `secrets.GITHUB_TOKEN` for the actions bot'
required: true
outputs:
applied:
description: The label applied to the Pull Request. If no label was applied this will be null.
runs:
using: 'node12'
main: 'index.js'
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ async function run() {

const branch = data.data.head.ref;

let labelApplied = null;
for (let prefix of labels) {
let tmp = prefix;
if (!prefix.endsWith('/'))
Expand All @@ -35,8 +36,12 @@ async function run() {
const label = process.env['INPUT_' + tmp.toUpperCase()];
console.log(`Adding ${label} to #${prNumber}`);
await addLabels(client, prNumber, [label]);
labelApplied = label;
break;
}
}

core.setOutput('applied', labelApplied);
} catch (error) {
console.error(error);
core.setFailed(error.message);
Expand Down

0 comments on commit 499910c

Please sign in to comment.