-
Notifications
You must be signed in to change notification settings - Fork 77
Create go.yml #1782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Create go.yml #1782
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||||||||||||||
| # This workflow will build a golang project | ||||||||||||||||||
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | ||||||||||||||||||
|
|
||||||||||||||||||
| name: Go | ||||||||||||||||||
|
|
||||||||||||||||||
| on: | ||||||||||||||||||
| push: | ||||||||||||||||||
| branches: [ "main" ] | ||||||||||||||||||
| pull_request: | ||||||||||||||||||
| branches: [ "main" ] | ||||||||||||||||||
|
|
||||||||||||||||||
| jobs: | ||||||||||||||||||
|
|
||||||||||||||||||
| build: | ||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||
| steps: | ||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||
|
|
||||||||||||||||||
| - name: Set up Go | ||||||||||||||||||
| uses: actions/setup-go@v4 | ||||||||||||||||||
| with: | ||||||||||||||||||
| go-version: '1.20' | ||||||||||||||||||
|
Comment on lines
+19
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
grep -n 'actions/setup-go@' .github/workflows/go.yml
grep -nE '^(go|toolchain) ' go.modRepository: devfile/api Length of output: 194 🌐 Web query:
💡 Result: The error message from Citations:
Upgrade 🧰 Tools🪛 actionlint (1.7.12)[error] 20-20: the runner of "actions/setup-go@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue (action) 🤖 Prompt for AI AgentsSource: Linters/SAST tools 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n## go.mod\n'
if [ -f go.mod ]; then
cat -n go.mod | sed -n '1,40p'
else
echo 'go.mod not found'
fi
printf '\n## .github/workflows/go.yml\n'
if [ -f .github/workflows/go.yml ]; then
cat -n .github/workflows/go.yml | sed -n '1,120p'
else
echo '.github/workflows/go.yml not found'
fiRepository: devfile/api Length of output: 2666 Use the Go version declared by the module. Proposed fix uses: actions/setup-go@v4
with:
- go-version: '1.20'
+ go-version-file: go.mod📝 Committable suggestion
Suggested change
🧰 Tools🪛 actionlint (1.7.12)[error] 20-20: the runner of "actions/setup-go@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue (action) 🤖 Prompt for AI Agents |
||||||||||||||||||
|
|
||||||||||||||||||
| - name: Build | ||||||||||||||||||
| run: go build -v ./... | ||||||||||||||||||
|
|
||||||||||||||||||
| - name: Test | ||||||||||||||||||
| run: go test -v ./... | ||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| go get -u golang.org/x/tools | ||
| go mod tidy | ||
| go mod vendor | ||
|
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Define an actual workflow or rename this file to a script. These lines are only a scalar YAML value; they do not define 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Prevent checkout credentials from reaching repository code.
actions/checkoutpersists the token by default. Since the following steps execute repository-controlled Go code, disable credential persistence and explicitly limit the workflow token to read-only contents access. (github.com)Proposed hardening
📝 Committable suggestion
🧰 Tools
🪛 zizmor (1.26.1)
[warning] 17-17: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
🤖 Prompt for AI Agents
Source: Linters/SAST tools