Skip to content

Commit

Permalink
feat: Add outputs of the labels added and removed (#71)
Browse files Browse the repository at this point in the history
* feat: Add outputs of the labels added and removed

* chore: Regenerate action
  • Loading branch information
phated committed May 26, 2023
1 parent 083c480 commit 6ae80f5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ inputs:
description: 'The number of the issue/PR to label'
required: false
default: ${{ github.event.issue.number || github.event.pull_request.number }}

outputs:
labels-added:
description: 'The labels that were added by the action, as a stringified array.'
labels-removed:
description: 'The labels that were removed by the action, as a stringified array.'

runs:
using: 'node16'
main: 'lib/index.js'
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getInput, setFailed, debug } from "@actions/core";
import { getInput, setFailed, debug, setOutput } from "@actions/core";
import { context, getOctokit } from "@actions/github";
import { load as loadYaml } from "js-yaml";

Expand Down Expand Up @@ -119,6 +119,14 @@ async function run() {
if (rejected.length) {
throw new AggregateError(rejected)
}

if (toAdd.length) {
setOutput("labels-added", toAdd);
}

if (toRemove.length) {
setOutput("labels-removed", toRemove);
}
}

function getIssueOrPRBody() {
Expand Down

0 comments on commit 6ae80f5

Please sign in to comment.