My aim is to create github workflow for publishing the plugin. Here I have to enter some command line arguments after executing some command. Can someone please tell me, whether there is a way to set the command line arguments in github action ?
Asked
Active
Viewed 1,583 times
0
-
If the below answer helped have you considered accepting it? – DᴀʀᴛʜVᴀᴅᴇʀ May 03 '22 at 19:59
1 Answers
2
If I understand you correctly - you're trying to build your GitHub Action and don't know how to pass arguments to it, correct? If so, you can use inputs
mechanism to pass arguments to your action. For example:
JavaScript Action
action.yml...
inputs:
version:
description: Plugin version
required: true
runs:
using: 'node12'
main: index.js
...
index.js
const core = require('@actions/core');
const version = core.getInput('version');
Docker Action
action.yml...
inputs:
version:
description: Plugin version
required: true
runs:
using: 'docker'
args:
- ${{ inputs.version }}
...
docker-entrypoint.sh
#!/bin/sh -l
echo $1 # your version
Usage:
workflow.yml...
steps:
name: Your action usage
uses: mysuperaction@master
with:
version: 1
...

fabasoad
- 1,613
- 18
- 20