Skip to content

Commit

Permalink
action.yml: move away from actions for addLabel
Browse files Browse the repository at this point in the history
  • Loading branch information
thypon committed May 8, 2024
1 parent b96f2f6 commit baedf05
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
16 changes: 10 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,20 @@ runs:
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: return true
- uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
if: ${{ steps.unverified-commits.outputs.result == '"UNVERIFIED-CHANGED"' }}
with:
github_token: ${{ inputs.github_token }}
labels: unverified-commits
- uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3
script: |
const actionPath = '${{ github.action_path }}'
const {default: addLabel} = await import(`${actionPath}/src/steps/addLabel.js`)
return await addLabel({context, github, 'unverified-commits'})
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
if: ${{ (steps.reviewdog-enabled-pr.outputs.result == 'true' && steps.should-trigger.outputs.result == 'true') }}
with:
github_token: ${{ inputs.github_token }}
labels: needs-security-review
script: |
const actionPath = '${{ github.action_path }}'
const {default: addLabel} = await import(`${actionPath}/src/steps/addLabel.js`)
return await addLabel({context, github, 'needs-security-review'})
- uses: actions-ecosystem/action-add-assignees@a5b84af721c4a621eb9c7a4a95ec20a90d0b88e9 # v1.0.1
if: ${{ steps.reviewdog-enabled-pr.outputs.result == 'true' && steps.should-trigger.outputs.result == 'true' }}
with:
Expand Down
12 changes: 12 additions & 0 deletions src/steps/addLabel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default async function addLabel ({
github,
context,
label
}) {
return github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: [label]
})
}

0 comments on commit baedf05

Please sign in to comment.