mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-21 15:31:41 -04:00
* chore: Set permissions for GitHub actions 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: neilnaveen <[email protected]> * Update permissions for newly added actions * Remove deleted actions Co-authored-by: neilnaveen <[email protected]>
54 lines
1.1 KiB
YAML
54 lines
1.1 KiB
YAML
#
|
|
# This GitHub action runs basic linting checks for Packer.
|
|
#
|
|
|
|
name: "Go Validate"
|
|
|
|
on: [ workflow_dispatch, push ]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
check-mod-tidy:
|
|
runs-on: ubuntu-latest
|
|
name: Go Mod Tidy
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: '1.17'
|
|
- run: go mod tidy
|
|
check-lint:
|
|
runs-on: ubuntu-latest
|
|
name: Lint
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: '1.17'
|
|
- run: echo "$GITHUB_SHA"
|
|
- run: git fetch --all
|
|
- run: echo $(git merge-base origin/main $GITHUB_SHA)
|
|
- run: make ci-lint
|
|
check-fmt:
|
|
runs-on: ubuntu-latest
|
|
name: Fmt check
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: '1.17'
|
|
- run: make fmt-check
|
|
check-generate:
|
|
runs-on: ubuntu-latest
|
|
name: Generate check
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: '1.17'
|
|
- run: make generate-check
|