Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/go.yml
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
Comment on lines +12 to +17

Copy link
Copy Markdown

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/checkout persists 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
+permissions:
+  contents: read
+
 jobs:
   build:
@@
-    - uses: actions/checkout@v4
+    - uses: actions/checkout@v4
+      with:
+        persist-credentials: false
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
🧰 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
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/go.yml around lines 12 - 17, Harden the build job’s
actions/checkout step by disabling persisted credentials and configure the
workflow permissions so the GITHUB_TOKEN has only read-only contents access.
Apply these changes to the checkout configuration and job/workflow permissions
without altering the remaining build steps.

Source: Linters/SAST tools


- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
Comment on lines +19 to +22

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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.mod

Repository: devfile/api

Length of output: 194


🌐 Web query:

actions/setup-go v4 supported runtime GitHub Actions actionlint runtime too old v6 go.mod documentation

💡 Result:

The error message from actionlint stating that the "runner of actions/setup-go@v4 action is too old" indicates that the specific version of the action you are using relies on a Node.js runtime (typically Node 16 or Node 20) that is being deprecated or is no longer compatible with the updated environment requirements of GitHub-hosted runners [1][2][3]. To resolve this, you should update to the latest major version of the action, which is currently v6 [4][5]. The newer versions of actions/setup-go have been upgraded to support current Node.js runtimes (e.g., Node 24) [4]. Recommended Actions: 1. Update your workflow YAML files to use actions/setup-go@v6 [4][2]. 2. If you are unable to update the action version immediately, actionlint allows you to suppress this specific warning using its configuration file [6][7]. You can add the following to your .github/actionlint.yml (or .yaml) to ignore the runner version check for your workflows [6][7]: paths:.github/workflows//*.yml: ignore: - 'the runner of ".+" action is too old to run on GitHub Actions' Note that while suppressing the warning allows actionlint to pass, it does not fix the underlying runtime compatibility issue, which may still cause your CI jobs to fail on newer GitHub-hosted runner images [2][3]. Upgrading to v6 is the standard and recommended solution [1][2].

Citations:


Upgrade actions/setup-go and source the Go version from go.mod. actions/setup-go@v4 uses an unsupported runtime; switch to @v6, and replace the hardcoded 1.20 with go-version-file: go.mod (this repo declares Go 1.24).

🧰 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
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/go.yml around lines 19 - 22, Update the “Set up Go”
workflow step to use actions/setup-go@v6 instead of `@v4`, and replace the
hardcoded go-version value with go-version-file pointing to go.mod so the
workflow uses the repository’s declared Go version.

Source: 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'
fi

Repository: devfile/api

Length of output: 2666


Use the Go version declared by the module. go.mod requires Go 1.24, but this workflow installs 1.20, so go build and go test will fail. Switch to go-version-file: go.mod to keep CI aligned.

Proposed fix
       uses: actions/setup-go@v4
       with:
-        go-version: '1.20'
+        go-version-file: go.mod
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
🧰 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
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/go.yml around lines 19 - 22, Update the “Set up Go”
workflow step to use the Go version declared by go.mod via go-version-file,
replacing the hard-coded go-version value so CI builds and tests run with the
module’s required version.


- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
3 changes: 3 additions & 0 deletions go.yml
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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 name, on, jobs, or a run step. GitHub Actions will not execute them as dependency-normalization commands. Move them into a workflow run: | block, or rename this to an executable shell script and invoke it from the workflow.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@go.yml` around lines 1 - 3, The go.yml content is not a valid GitHub Actions
workflow and will not execute the dependency commands. Convert it into a
workflow defining the required name, trigger, and jobs/run step with the
commands in a multiline run block, or rename it to an executable shell script
and invoke that script from an actual workflow.