mirror of
https://github.com/shirou/gopsutil.git
synced 2025-05-14 19:29:16 +08:00

Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much. - Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs [Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) Signed-off-by: nathannaveen <42319948+nathannaveen@users.noreply.github.com>
34 lines
883 B
YAML
34 lines
883 B
YAML
on: [push, pull_request]
|
|
name: Build Test
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build_test_v3:
|
|
strategy:
|
|
matrix:
|
|
go-version: [1.16.x, 1.17.x]
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- name: Install Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
- id: cache-paths
|
|
run: |
|
|
echo "::set-output name=cache::$(go env GOCACHE)"
|
|
echo "::set-output name=mod-cache::$(go env GOMODCACHE)"
|
|
- name: Cache go modules
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
${{ steps.cache-paths.outputs.cache }}
|
|
${{ steps.cache-paths.outputs.mod-cache }}
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: ${{ runner.os }}-go-
|
|
- name: Build Test v3
|
|
run: |
|
|
make build_test
|