mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-09-05 18:40:59 +00:00
feat: support actions with 'using: node24' (#847)
It's worth noting for users: the runner does not actually invoke different versions of node depending on the `using` tag -- it just defers to the `node` command in the path regardless of the tagged value. This change allows `node24` to be provided without error, the same level of support as node12...node20. FYI: This allows the use of `github.com/actions/checkout@v5`, which was released today and is marked `using: node24`. Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/847 Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org> Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net> Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
This commit is contained in:
parent
e5603fe6d9
commit
e760d04aa6
5 changed files with 19 additions and 4 deletions
|
@ -21,7 +21,7 @@ func (a *ActionRunsUsing) UnmarshalYAML(unmarshal func(interface{}) error) error
|
|||
// Force input to lowercase for case insensitive comparison
|
||||
format := ActionRunsUsing(strings.ToLower(using))
|
||||
switch format {
|
||||
case ActionRunsUsingNode20, ActionRunsUsingNode16, ActionRunsUsingNode12, ActionRunsUsingDocker, ActionRunsUsingComposite, ActionRunsUsingGo, ActionRunsUsingSh:
|
||||
case ActionRunsUsingNode24, ActionRunsUsingNode20, ActionRunsUsingNode16, ActionRunsUsingNode12, ActionRunsUsingDocker, ActionRunsUsingComposite, ActionRunsUsingGo, ActionRunsUsingSh:
|
||||
*a = format
|
||||
default:
|
||||
return fmt.Errorf("The runs.using key in action.yml must be one of: %v, got %s", []string{
|
||||
|
@ -30,6 +30,7 @@ func (a *ActionRunsUsing) UnmarshalYAML(unmarshal func(interface{}) error) error
|
|||
ActionRunsUsingNode12,
|
||||
ActionRunsUsingNode16,
|
||||
ActionRunsUsingNode20,
|
||||
ActionRunsUsingNode24,
|
||||
ActionRunsUsingGo,
|
||||
ActionRunsUsingSh,
|
||||
}, format)
|
||||
|
@ -44,6 +45,8 @@ const (
|
|||
ActionRunsUsingNode16 = "node16"
|
||||
// ActionRunsUsingNode20 for running with node20
|
||||
ActionRunsUsingNode20 = "node20"
|
||||
// ActionRunsUsingNode24 for running with node24
|
||||
ActionRunsUsingNode24 = "node24"
|
||||
// ActionRunsUsingDocker for running with docker
|
||||
ActionRunsUsingDocker = "docker"
|
||||
// ActionRunsUsingComposite for running composite
|
||||
|
|
|
@ -182,7 +182,7 @@ func runActionImpl(step actionStep, actionDir string, remoteAction *remoteAction
|
|||
logger.Debugf("type=%v actionDir=%s actionPath=%s workdir=%s actionCacheDir=%s actionName=%s containerActionDir=%s", stepModel.Type(), actionDir, actionPath, rc.Config.Workdir, rc.ActionCacheDir(), actionName, containerActionDir)
|
||||
|
||||
switch action.Runs.Using {
|
||||
case model.ActionRunsUsingNode12, model.ActionRunsUsingNode16, model.ActionRunsUsingNode20:
|
||||
case model.ActionRunsUsingNode12, model.ActionRunsUsingNode16, model.ActionRunsUsingNode20, model.ActionRunsUsingNode24:
|
||||
if err := maybeCopyToActionDir(ctx, step, actionDir, actionPath, containerActionDir); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -237,6 +237,7 @@ func runActionImpl(step actionStep, actionDir string, remoteAction *remoteAction
|
|||
model.ActionRunsUsingNode12,
|
||||
model.ActionRunsUsingNode16,
|
||||
model.ActionRunsUsingNode20,
|
||||
model.ActionRunsUsingNode24,
|
||||
model.ActionRunsUsingComposite,
|
||||
model.ActionRunsUsingGo,
|
||||
model.ActionRunsUsingSh,
|
||||
|
@ -530,6 +531,7 @@ func hasPreStep(step actionStep) common.Conditional {
|
|||
((action.Runs.Using == model.ActionRunsUsingNode12 ||
|
||||
action.Runs.Using == model.ActionRunsUsingNode16 ||
|
||||
action.Runs.Using == model.ActionRunsUsingNode20 ||
|
||||
action.Runs.Using == model.ActionRunsUsingNode24 ||
|
||||
action.Runs.Using == model.ActionRunsUsingGo ||
|
||||
action.Runs.Using == model.ActionRunsUsingSh) &&
|
||||
action.Runs.Pre != "")
|
||||
|
@ -546,7 +548,7 @@ func runPreStep(step actionStep) common.Executor {
|
|||
action := step.getActionModel()
|
||||
|
||||
switch action.Runs.Using {
|
||||
case model.ActionRunsUsingNode12, model.ActionRunsUsingNode16, model.ActionRunsUsingNode20, model.ActionRunsUsingSh:
|
||||
case model.ActionRunsUsingNode12, model.ActionRunsUsingNode16, model.ActionRunsUsingNode20, model.ActionRunsUsingNode24, model.ActionRunsUsingSh:
|
||||
// defaults in pre steps were missing, however provided inputs are available
|
||||
populateEnvsFromInput(ctx, step.getEnv(), action, rc)
|
||||
// todo: refactor into step
|
||||
|
@ -672,6 +674,7 @@ func hasPostStep(step actionStep) common.Conditional {
|
|||
((action.Runs.Using == model.ActionRunsUsingNode12 ||
|
||||
action.Runs.Using == model.ActionRunsUsingNode16 ||
|
||||
action.Runs.Using == model.ActionRunsUsingNode20 ||
|
||||
action.Runs.Using == model.ActionRunsUsingNode24 ||
|
||||
action.Runs.Using == model.ActionRunsUsingGo ||
|
||||
action.Runs.Using == model.ActionRunsUsingSh) &&
|
||||
action.Runs.Post != "")
|
||||
|
@ -708,7 +711,7 @@ func runPostStep(step actionStep) common.Executor {
|
|||
_, containerActionDir := getContainerActionPaths(stepModel, actionLocation, rc)
|
||||
|
||||
switch action.Runs.Using {
|
||||
case model.ActionRunsUsingNode12, model.ActionRunsUsingNode16, model.ActionRunsUsingNode20:
|
||||
case model.ActionRunsUsingNode12, model.ActionRunsUsingNode16, model.ActionRunsUsingNode20, model.ActionRunsUsingNode24:
|
||||
|
||||
populateEnvsFromSavedState(step.getEnv(), step, rc)
|
||||
populateEnvsFromInput(ctx, step.getEnv(), step.getActionModel(), rc)
|
||||
|
|
5
act/runner/testdata/actions/node24/action.yml
vendored
Normal file
5
act/runner/testdata/actions/node24/action.yml
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
name: 'using node24 action'
|
||||
description: 'An action that has using:node24'
|
||||
runs:
|
||||
using: 'node24'
|
||||
main: 'index.js'
|
3
act/runner/testdata/actions/node24/index.js
vendored
Normal file
3
act/runner/testdata/actions/node24/index.js
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Note that the runner does not actually invoke different versions of node depending on the `using` tag, so this output
|
||||
// isn't checked/asserted to ensure that the right version is in-use. It might as well be an empty script.
|
||||
console.log('Current node.js version:', process.versions.node);
|
1
act/runner/testdata/local-action-js/push.yml
vendored
1
act/runner/testdata/local-action-js/push.yml
vendored
|
@ -10,3 +10,4 @@ jobs:
|
|||
- uses: ./actions/node20
|
||||
with:
|
||||
who-to-greet: 'Mona the Octocat'
|
||||
- uses: ./actions/node24
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue