How to use this in a composite action?

Abierto
#322 4 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
25/100
Tipo de issue
Documentación
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
bash, github-actions, javascript
Área
ci-cd

Línea de trabajo

No repository files or tests are named. Start with the linked composite-action documentation and the github-script v6 usage, then determine whether the shown JavaScript and Bash workflow is supported; done means documenting the supported approach or the limitation clearly.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

question

I’m looking to create a composite action, and the task that I’m working on would be easiest to implement by doing some work in JavaScript and some other work in a Bash script. Can I use this action (github-script) to achieve this?

I added this to my action:

uses: "actions/github-script@v6"
with:
  script: |
    const script = require("./dist/index.js")
    script({core})

But then I got this error when I ran it:

Error: Cannot find module '/home/runner/work/v2-core/v2-core/dist/index.js'
Require stack:
- /home/runner/work/_actions/actions/github-script/v6/dist/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.apply (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:13400:27)
    at eval (eval at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:13356:16), <anonymous>:3:16)
    at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:13357:12)
    at main (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:13452:26)
    at Module.858 (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:13429:1)
    at __webpack_require__ (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:[24](https://github.com/sablierhq/v2-core/actions/runs/3861794209/jobs/6583130559#step:3:26):[31](https://github.com/sablierhq/v2-core/actions/runs/3861794209/jobs/6583130559#step:3:33)) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/runner/work/_actions/actions/github-script/v6/dist/index.js'
  ]
}

What am I doing wrong?

Side note - why not enable discussions in this repository?

Lenguaje dominante
TypeScript
Estrellas
5k
Forks
586
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de actions/github-script

Todos los issues de actions/github-script

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.