Skip to content

Commit

Permalink
fix(zap_scan): Label issues correctly (#204)
Browse files Browse the repository at this point in the history
* fix(zap_scan): check out ref associated with run

* fix(zap_scan): use actions/github-script for labeling issues
  • Loading branch information
jeremyckahn committed Nov 10, 2023
1 parent a3c7e93 commit 5317d6f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/label_security_issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Label Security Report

on:
issues:
types:
- opened

jobs:
label-security-report:
runs-on: ubuntu-latest

steps:
- name: Check if issue title starts with "Security Report -"
id: check_title
run: echo "::set-output name=startsWithSecurityReport::$(echo ${{ github.event.issue.title }} | grep -q '^Security Report -' && echo true || echo false)"

- name: Add labels
if: steps.check_title.outputs.startsWithSecurityReport == 'true'
uses: actions/github-script@v6
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["security", "reports"]
})
11 changes: 0 additions & 11 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ jobs:
- name: Checkout Repo for .zap/rules.tsv
uses: actions/checkout@v4
with:
ref: main

- name: ZAP Full Scan
# https://github.com/zaproxy/action-full-scan
Expand All @@ -34,12 +32,3 @@ jobs:
rules_file_name: '.zap/rules.tsv'
issue_title: 'Security Report - ${{ steps.set-now.outputs.NOW }}'
artifact_name: 'zap_scan_${{ steps.set-now.outputs.NOW }}'

- name: Add Security Label to Security Report - ${{ steps.set-now.outputs.NOW }}
# https://github.com/actions-ecosystem/action-add-labels
uses: actions-ecosystem/action-add-labels@v1
if: ${{ startsWith('Security Report - ${{ steps.set-now.outputs.NOW }}', '/add-labels')}}
with:
labels: |
security
reports

0 comments on commit 5317d6f

Please sign in to comment.