Skip to content

Commit

Permalink
Check ghas features (#21)
Browse files Browse the repository at this point in the history
* Action to check that features of GHAS are enabled (dependabot, secrets scanning, code scanning)
  • Loading branch information
austimkelly authored Jan 11, 2024
1 parent f8d5508 commit d94b3d8
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/check-ghas-features.yml
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."

0 comments on commit d94b3d8

Please sign in to comment.