-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Action to check that features of GHAS are enabled (dependabot, secrets scanning, code scanning)
- Loading branch information
1 parent
f8d5508
commit d94b3d8
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: "Check Security Features" | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check Dependabot | ||
id: check_dependabot | ||
run: | | ||
echo "Checking if Dependabot is enabled..." | ||
DEPENDABOT=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/dependabot/alerts) | ||
if [[ "$DEPENDABOT" == *"Not Found"* ]]; then | ||
echo "Dependabot is not enabled" | ||
exit 1 | ||
else | ||
echo "Dependabot is enabled" | ||
fi | ||
- name: Check Code Scanning | ||
id: check_code_scanning | ||
run: | | ||
echo "Checking if Code Scanning is enabled..." | ||
CODE_SCANNING=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/code-scanning/alerts) | ||
if [[ "$CODE_SCANNING" == *"Not Found"* ]]; then | ||
echo "Code Scanning is not enabled" | ||
exit 1 | ||
else | ||
echo "Code Scanning is enabled" | ||
fi | ||
- name: Check Secrets Scanning | ||
id: check_secrets_scanning | ||
run: | | ||
echo "Checking if Secrets Scanning is enabled..." | ||
SECRETS_SCANNING=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/actions/secrets) | ||
if [[ "$SECRETS_SCANNING" == *"Not Found"* ]]; then | ||
echo "Secrets Scanning is not enabled" | ||
exit 1 | ||
else | ||
echo "Secrets Scanning is enabled" | ||
fi | ||
- name: Summary | ||
run: echo "All checks passed. All required GitHub Advanced Security features are enabled." |