0

Learning Github workflow and actions, what is the best and fastest or best way to test the yaml.

I find myself testing by editing a workflow in the browser, and then commit, then in another tab click my way into the action and down to the job.

I understand that you need the containers in the workflow, but I was thinking if there is an easier way to test the "yaml language". Like in the following I was learning how to "echo" an environment variable.

Is this the way or is there a smarter way maybe using VSCode with some docker container for debugging and learning to call functions etc?

name: TestWF

on:
  workflow_dispatch:
    inputs:
      logLevel:
        description: 'Log level'     
        required: true
        default: 'warning'
      tags:
        description: 'Test scenario tags'  
   
jobs:
  hello:
    runs-on: ubuntu-latest
    steps:
    - name: Hello, World in GitHub Actions
      run: echo $GITHUB_REF
Chris G.
  • 23,930
  • 48
  • 177
  • 302
  • 2
    Related: https://stackoverflow.com/questions/59241249/how-to-run-github-actions-workflows-locally – riQQ Jan 19 '21 at 21:48
  • 1
    The docs-yaml extension for VSCode will at least check syntactic and shematic validity – cuzi Jan 20 '21 at 11:01

1 Answers1

1

As answered already act is the recommended solution. However, sometimes this is not the only solution and your best bet could be debugging it using SSH with tools like: debug-via-ssh or debugging-with-tmate

vsr
  • 1,025
  • 9
  • 17