Skip to content

Commit 0099aeb

Browse files
committed
Improve error handling in API responses
Enhance the error handling mechanism in API responses to provide clearer messages and improve debugging capabilities.
1 parent 2ab3a12 commit 0099aeb

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

docs/checks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2887,7 +2887,7 @@ test.yaml:8:15: incorrect color "gray-white" at branding.icon in metadata of "My
28872887
|
28882888
8 | - uses: ./.github/actions/my-invalid-action
28892889
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2890-
test.yaml:8:15: invalid runner name "node16" at runs.using in "My action" action defined at "/Users/rhysd/.go/src/github.com/rhysd/actionlint/.github/actions/my-invalid-action". valid runners are "composite", "docker", and "node20". see https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs [action]
2890+
test.yaml:8:15: invalid runner name "node16" at runs.using in "My action" action defined at "/Users/rhysd/.go/src/github.com/rhysd/actionlint/.github/actions/my-invalid-action". valid runners are "composite", "docker", "node20", and "node24". see https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs [action]
28912891
|
28922892
8 | - uses: ./.github/actions/my-invalid-action
28932893
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

rule_action.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,10 @@ func (rule *RuleAction) checkLocalActionRuns(meta *ActionMetadata, pos *Pos) {
484484
rule.checkLocalDockerActionRuns(r, meta.Dir(), meta.Name, pos)
485485
case "composite":
486486
rule.checkLocalCompositeActionRuns(r, meta.Dir(), meta.Name, pos)
487-
case "node20":
487+
case "node20", "node24":
488488
rule.checkLocalJavaScriptActionRuns(r, meta.Dir(), meta.Name, pos)
489489
default:
490-
rule.Errorf(pos, `invalid runner name %q at runs.using in %q action defined at %q. valid runners are "composite", "docker", and "node20". see https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs`, r.Using, meta.Name, meta.Dir())
490+
rule.Errorf(pos, `invalid runner name %q at runs.using in %q action defined at %q. valid runners are "composite", "docker", "node20", and "node24". see https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs`, r.Using, meta.Name, meta.Dir())
491491

492492
// Probably invalid version of Node.js runner. Assume it is JavaScript action to find as many errors as possible
493493
if strings.HasPrefix(r.Using, "node") {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/test\.yaml:8:15: description is required in metadata of "My action" action at ".+(\\\\|/)my-invalid-action(\\\\|/)action\.yml" \[action\]/
22
/test\.yaml:8:15: incorrect icon name "dog" at branding\.icon in metadata of "My action" action at ".+(\\\\|/)my-invalid-action(\\\\|/)action\.yml"\. see the official document to know the exhaustive list of supported icons: https://.+ \[action\]/
33
/test\.yaml:8:15: incorrect color "gray-white" at branding\.icon in metadata of "My action" action at ".+(\\\\|/)my-invalid-action(\\\\|/)action\.yml"\. see the official document to know the exhaustive list of supported colors: https://.+ \[action\]/
4-
/test\.yaml:8:15: invalid runner name \"node14\" at runs\.using in \"My action\" action defined at \".+(\\\\|/)actions(\\\\|/)my-invalid-action\"\. valid runners are \"composite\", \"docker\", and \"node20\"\. see https://.+ \[action\]/
4+
/test\.yaml:8:15: invalid runner name \"node14\" at runs\.using in \"My action\" action defined at \".+(\\\\|/)actions(\\\\|/)my-invalid-action\"\. valid runners are \"composite\", \"docker\", \"node20\", and \"node24\"\. see https://.+ \[action\]/
55
/test\.yaml:8:15: file "this-file-does-not-exist\.js" does not exist in ".+(\\\\|/)my-invalid-action"\. it is specified at "main" key in "runs" section in "My action" action \[action\]/
66
/test\.yaml:8:15: "env" is not allowed in "runs" section because "My action" is a JavaScript action\. the action is defined at ".+(\\\\|/)my-invalid-action" \[action\]/

testdata/format/test.sarif

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"tool": {
77
"driver": {
88
"name": "GitHub Actions lint",
9-
"version": "",
9+
"version": "(devel)",
1010
"informationUri": "https://github.com/rhysd/actionlint",
1111
"rules": [
1212
{
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/workflows/test\.yaml:7:15: invalid runner name "node16" at runs\.using in "Old Node\.js" action defined at ".+old_node"\. valid runners are "composite", "docker", and "node20"\. see https://.+ \[action\]/
1+
/workflows/test\.yaml:7:15: invalid runner name "node16" at runs\.using in "Old Node\.js" action defined at ".+old_node"\. valid runners are "composite", "docker", "node20", and "node24"\. see https://.+ \[action\]/
22
/workflows/test\.yaml:8:15: "runs\.using" is missing in local action "Missing runner name" defined at ".+missing_runs" \[action\]/
33
/workflows/test\.yaml:9:15: "runs\.using" is missing in local action "No using" defined at ".+missing_using" \[action\]/
4-
/workflows/test\.yaml:10:15: invalid runner name "what-is-this-runner" at runs\.using in "Unknown runner name" action defined at ".+unknown_runner"\. valid runners are "composite", "docker", and "node20"\. see https://.+ \[action\]/
5-
/workflows/test\.yaml:11:15: invalid runner name "nodenext" at runs\.using in "Invalid node version" action defined at ".+invalid_node_version"\. valid runners are "composite", "docker", and "node20"\. see https://.+ \[action\]/
6-
/workflows/test\.yaml:12:15: invalid runner name "node12" at runs\.using in "Node\.js v12 runner" action defined at ".+node12"\. valid runners are "composite", "docker", and "node20"\. see https://.+ \[action\]/
4+
/workflows/test\.yaml:10:15: invalid runner name "what-is-this-runner" at runs\.using in "Unknown runner name" action defined at ".+unknown_runner"\. valid runners are "composite", "docker", "node20", and "node24"\. see https://.+ \[action\]/
5+
/workflows/test\.yaml:11:15: invalid runner name "nodenext" at runs\.using in "Invalid node version" action defined at ".+invalid_node_version"\. valid runners are "composite", "docker", "node20", and "node24"\. see https://.+ \[action\]/
6+
/workflows/test\.yaml:12:15: invalid runner name "node12" at runs\.using in "Node\.js v12 runner" action defined at ".+node12"\. valid runners are "composite", "docker", "node20", and "node24"\. see https://.+ \[action\]/

0 commit comments

Comments
 (0)