Skip to content

Random shuffle of lists #7032

Random shuffle of lists

Random shuffle of lists #7032

## %CopyrightBegin%
##
## SPDX-License-Identifier: Apache-2.0
##
## Copyright Ericsson AB 2024-2025. All Rights Reserved.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
## %CopyrightEnd%
## Runs the Google OSV-scanner utility to detect known vulnerabilities.
## The scan is run on each PR/push and also periodically on each maintained branch
name: Open Source Vulnerabilities Scanner
on:
pull_request:
workflow_dispatch:
schedule:
- cron: 0 1 * * *
permissions:
contents: read
jobs:
schedule-scan:
runs-on: ubuntu-latest
if: github.event_name == 'schedule' && github.repository == 'erlang/otp'
# if: github.event_name != 'workflow_dispatch' # used for testing
outputs:
versions: ${{ steps.get-versions.outputs.versions }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/[email protected]
- id: get-versions
name: Fetch latest 3 OTP versions
run: |
echo "versions=$(.github/scripts/get-supported-branches.sh)" >> "$GITHUB_OUTPUT"
run-scheduled-scan:
# Fan out and create requests to run OSV on multiple branches.
# It always succeed: either it sends requests to branches that
# can run 'scan-pr' (if the repo/branch contains this file) or
# skips sending the request.
needs: schedule-scan
runs-on: ubuntu-latest
strategy:
matrix:
type: ${{ fromJson(needs.schedule-scan.outputs.versions) }}
fail-fast: false
permissions:
actions: read
steps:
# this call to a workflow_dispatch ref=master is important because
# using ref={{matrix.type}} would trigger the workflow
# reusable-vendor-vulnerability-scanner.yml in that ref/branch. since
# there is no such files in maint-25, maint-26, etc, the result would
# ignore the vulnerability scanning for those branches.
#
- name: Trigger Vulnerability Scanning
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }} # in testing cases, this is your fork, e.g., kikofernandez/otp
run: |
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/actions/workflows/reusable-vendor-vulnerability-scanner.yml/dispatches \
-f 'ref=master' -f "inputs[checkout]=true" -f "inputs[version]=${{ matrix.type }}" -f "inputs[fail_if_cve]=true"