Skip to content

Commit

Permalink
action.cjs: degeneralize addLabel
Browse files Browse the repository at this point in the history
  • Loading branch information
thypon committed May 24, 2024
1 parent e9a241a commit bfda6f7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
16 changes: 12 additions & 4 deletions action.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,18 @@ module.exports = async ({ github, context, inputs, actionPath, core }) => {
const commentsBefore = await commentsNumber({ context, github })
await cleanupComments({ context, github })

const { default: addLabel } = await import(`${actionPath}/src/steps/addLabel.js`)

// unverified-commits steps
const { default: unverifiedCommits } = await import(`${actionPath}/src/steps/unverifiedCommits.js`)

// add unverified-commits label step
const unverifiedCommitsSteps = await unverifiedCommits({ context, github })
if (unverifiedCommitsSteps === '"UNVERIFIED-CHANGED"') {
await addLabel({ context, github, label: 'unverified-commits' })
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['unverified-commits']
})
}

// run-reviewdog-pr step
Expand Down Expand Up @@ -93,7 +96,12 @@ module.exports = async ({ github, context, inputs, actionPath, core }) => {

if (shouldTrigger) {
// add label step
await addLabel({ context, github, label: 'needs-security-review' })
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['needs-security-review']
})
// add assignees step
await github.rest.issues.addAssignees({
owner: context.repo.owner,
Expand Down
12 changes: 0 additions & 12 deletions src/steps/addLabel.js

This file was deleted.

0 comments on commit bfda6f7

Please sign in to comment.