From 39ce3c4972e7d0bdd4d6e68a5f561f388e26b15a Mon Sep 17 00:00:00 2001 From: Prudhvi Godithi Date: Wed, 11 Oct 2023 15:50:51 -0700 Subject: [PATCH] Add CVE Label Signed-off-by: Prudhvi Godithi --- .github/workflows/add-cve-label.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/add-cve-label.yml diff --git a/.github/workflows/add-cve-label.yml b/.github/workflows/add-cve-label.yml new file mode 100644 index 0000000000..2a82b588cf --- /dev/null +++ b/.github/workflows/add-cve-label.yml @@ -0,0 +1,29 @@ +name: Add CVE Label +on: + issues: + types: + - labeled + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +jobs: + add-comment: + if: github.event.label.name == "Mend: dependency security vulnerability" + runs-on: ubuntu-latest + steps: + - name: Get Issue Title + id: get_title + run: | + issue_title="${{ github.event.issue.title }}" + severity="$(echo $issue_title | sed -n 's/.*(\(.*\)).*/\1/p')" + echo "severity=$severity" >> $GITHUB_ENV + - name: Add CVE Label + uses: actions/github-script@v6 + with: + script: | + github.rest.issues.addLabels({ + issue_number: ${{ github.event.issue.number }}, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ${{ env.severity }} + })