mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-13 11:34:54 +00:00
Add an explicit top-level permissions block to the GitHub Actions workflows that were relying on the default token permissions. Each workflow now defaults to contents: read, with additional scopes granted only where a job needs them: * nightly-trivy-scan keeps security-events: write at the job level to upload SARIF results, plus contents: read for checkout. * stale-issues gets issues: write and pull-requests: write for the actions/stale action to label and close stale items. Setting least-privilege permissions reduces the blast radius if a workflow or one of its dependencies is compromised, and satisfies the CLOMonitor token_permissions check. Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>
37 lines
830 B
YAML
37 lines
830 B
YAML
name: Pull Request CI Check
|
|
on: [pull_request]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
get-go-version:
|
|
uses: ./.github/workflows/get-go-version.yaml
|
|
with:
|
|
ref: ${{ github.event.pull_request.base.ref }}
|
|
|
|
build:
|
|
name: Run CI
|
|
needs: get-go-version
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
steps:
|
|
- name: Check out the code
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Set up Go version
|
|
uses: actions/setup-go@v7
|
|
with:
|
|
go-version: ${{ needs.get-go-version.outputs.version }}
|
|
|
|
- name: Make ci
|
|
run: make ci
|
|
- name: Upload test coverage
|
|
uses: codecov/codecov-action@v7
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: coverage.out
|
|
verbose: true
|
|
fail_ci_if_error: true
|