Skip to content

chore: migrate security checks to run on a cron #6477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions .github/workflows/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@ permissions:
security-events: write

on:
push:
branches: ["main"]

pull_request:
branches: ["main"]

workflow_dispatch:

schedule:
# Run every week at 10:24 on Thursday.
- cron: "24 10 * * 4"
# Run every 6 hours Monday-Friday!
- cron: "0 0,6,12,18 * * 1-5"

# Cancel in-progress runs for pull requests when developers push
# additional changes
Expand Down Expand Up @@ -59,6 +53,17 @@ jobs:
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

- name: Send Slack notification on failure
if: ${{ failure() }}
run: |
msg="❌ CodeQL Failed\n\nhttps://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
curl \
-qfsSL \
-X POST \
-H "Content-Type: application/json" \
--data "{\"content\": \"$msg\"}" \
"${{ secrets.SLACK_SECURITY_FAILURE_WEBHOOK_URL }}"

trivy:
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-8-cores' || 'ubuntu-latest' }}
steps:
Expand Down Expand Up @@ -135,3 +140,14 @@ jobs:
name: trivy
path: trivy-results.sarif
retention-days: 7

- name: Send Slack notification on failure
if: ${{ failure() }}
run: |
msg="❌ CodeQL Failed\n\nhttps://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
curl \
-qfsSL \
-X POST \
-H "Content-Type: application/json" \
--data "{\"content\": \"$msg\"}" \
"${{ secrets.SLACK_SECURITY_FAILURE_WEBHOOK_URL }}"