Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Command #4

Merged
merged 2 commits into from
Oct 2, 2020
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Set output
- name: Set version
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}

- name: Check output
run: echo ${{ steps.vars.outputs.tag }}
- name: Check version
run: echo "Version ${{ steps.vars.outputs.tag }}"

- name: Use Node.js 12
uses: actions/setup-node@v1
Expand Down
7 changes: 6 additions & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ func (h *Handler) Run(ctx context.Context, req *entity.CommandRequest) error {

argsString := ""

// Inject railway envs
for k, v := range *envs {
argsString += fmt.Sprintf("%s=%+v", k, v)
argsString += fmt.Sprintf("%s=%+v ", k, v)
}

for _, arg := range req.Args {
argsString += fmt.Sprintf("%s ", arg)
}

bashCommand := exec.Command("bash", "-c", argsString)
Expand Down
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ func init() {
Short: "Show all your projects",
RunE: contextualize(handler.List),
})
rootCmd.AddCommand(&cobra.Command{
Use: "run",
Short: "Run command inside the Railway environment",
RunE: contextualize(handler.Run),
})
}

func main() {
Expand Down