Update Snyk Workflow to target other branches (#20601)

Closes #20364

Co-authored-by: Stian Thorgersen <stianst@gmail.com>
This commit is contained in:
Bruno Oliveira da Silva 2023-06-01 04:03:09 -03:00 committed by GitHub
parent f3c393f53e
commit 9193e2e09e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 3 deletions

25
.github/workflows/schedule.yml vendored Normal file
View file

@ -0,0 +1,25 @@
name: Scheduled workflows
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
run-ci:
name: Run CI workflow
runs-on: ubuntu-latest
steps:
- name: Run Snyk with main branch
run: gh workflow run -R keycloak/keycloak snyk-analysis.yml -r main
if: github.event_name != 'schedule' || github.repository == 'keycloak/keycloak'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run Snyk with latest release branch
run: |
patch_release=$(gh api repos/keycloak/keycloak/branches | jq -r '.[].name' | sort -r | awk -F'/' '/[0-9.]+$/ {print $NF; exit}')
gh workflow run -R keycloak/keycloak snyk-analysis.yml -r "release/$patch_release"
if: github.event_name != 'schedule' || github.repository == 'keycloak/keycloak'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -1,8 +1,6 @@
name: Snyk
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
defaults: