Skip to content

Commit

Permalink
action.yml: add assignees when there is none
Browse files Browse the repository at this point in the history
  • Loading branch information
thypon committed Jul 19, 2023
1 parent 39c48ca commit 4d20c7e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ runs:
- id: assignees-after
if: ${{ steps.reviewdog-enabled-pr.outputs.result == 'true' }}
uses: actions/github-script@v6
env:
ASSIGNEES: ${{ inputs.assignees }}
with:
script: |
var query = `query($owner:String!, $name:String!, $prnumber:Int!) {
Expand Down Expand Up @@ -341,13 +343,17 @@ runs:
).flat())]
console.log("assignees: %o", assignees);
return assignees.join('\n');
if (assignees.length > 0) {
return assignees.join(' ');
} else {
return process.env.ASSIGNEES.split(/\s+/).filter((str) => str !== '').join(' ');
}
- id: assignee-removed-label
if: ${{ steps.reviewdog-enabled-pr.outputs.result == 'true' }}
uses: actions/github-script@v6
env:
ASSIGNEES: ${{ steps.assignees-after.outputs.result && fromJson(steps.assignees-after.outputs.result) }}
ASSIGNEES: ${{ fromJson(steps.assignees-after.outputs.result) }}
with:
script: |
const { ASSIGNEES } = process.env;
Expand Down Expand Up @@ -458,7 +464,7 @@ runs:
with:
slack_token: ${{ inputs.slack_token }}
message: |
[semgrep] @${{ github.actor }} action failed, plz take a look. /cc ${{steps.assignees.outputs.result}} ${{ fromJson(steps.reviewdog-fail-log-head.outputs.result) }}
[semgrep] @${{ github.actor }} action failed, plz take a look. /cc ${{fromJson(steps.assignees-after.outputs.result)}} ${{ fromJson(steps.reviewdog-fail-log-head.outputs.result) }}
channel: secops-hotspots
color: red
verbose: true
Expand All @@ -467,7 +473,7 @@ runs:
with:
slack_token: ${{ inputs.slack_token }}
message: |
[semgrep] @${{ github.actor }} pushed commits. /cc ${{steps.assignees.outputs.result}}
[semgrep] @${{ github.actor }} pushed commits. /cc ${{fromJson(steps.assignees-after.outputs.result)}}
channel: secops-hotspots
color: green
verbose: true
Expand Down

0 comments on commit 4d20c7e

Please sign in to comment.