Skip to content

Commit e4c9305

Browse files
authored
Add a check for Security Approved for contributions (#37329)
* Add a check for Security Approved for contributions
1 parent 9201864 commit e4c9305

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Security Label Check
2+
on:
3+
pull_request:
4+
types: [opened, edited, labeled, synchronize, unlabeled]
5+
jobs:
6+
security-check:
7+
runs-on: ubuntu-latest
8+
if: github.repository == 'demisto/content' && github.event.pull_request.head.repo.fork == true && contains(github.head_ref, 'xsoar-bot-contrib-ContributionTestPack') == false
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v3
12+
- name: Check if PR base branch starts with "contrib" and labels are correct
13+
id: security_check
14+
run: |
15+
BASE_BRANCH=$(jq --raw-output .pull_request.base.ref "$GITHUB_EVENT_PATH")
16+
LABELS=$(jq --raw-output '.pull_request.labels | map(.name) | join(",")' "$GITHUB_EVENT_PATH")
17+
if [[ "$LABELS" == *"Security Review"* ]]; then
18+
echo "Security Review label present. Checking if Security Approved label is added..."
19+
if [[ "$LABELS" != *"Security Approved"* ]]; then
20+
echo "Security Approved label is missing. The PR still requires a review from the security team."
21+
exit 1
22+
else
23+
echo "Security Approved label is present."
24+
fi
25+
else
26+
echo "Security Review label is not added. Security review is not required."
27+
fi

0 commit comments

Comments
 (0)