Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • In your repo, create a directory called .github/workflows/, and inside there, create an arbitrary named yml file for your workflow. For example, .github/workflows/example-workflow.yml, with code like:

    Code Block
    name: learnthis-is-githubthe-actions
    runworkflow-name:  ${{ github.actor }} is learning GitHub Actions # Pick a name you like.
    on: [push]
    jobs:
      checkthis-is-bats-version:
        runs-on: ubuntu-latestthe-job-name:      steps:     # Pick -a uses: actions/checkout@v4
    name you like.
         runs- useson: actions/setupself-node@v3hosted
            withsteps:
              node-version: '14'- uses: actions/checkout@v4
          - run: echo npm"hello install -g bats
          - run: bats -v
    
    Notice
    world"
    
  • For details on formatting this file, see Understanding GitHub Actions: Understanding the workflow file. For your convenience, highlights are provided here:

  • Notice the jobs field contains a hash, or dictionary, of jobs. You may create more than one job, which will perform multiple actions on multiple runners.

  • If you need have different branches trigger different runners on different machines, see an example at: https://github.com/Tufts-Technology-Services/dbaadmin-scripts/tree/develop/.github/workflows

  • runs-on specifies which runner you wish your job to run on.

  • uses: actions/checkout@v4 This will checkout your repository in the working directory where the job runs. It is generally recommended to keep this line as-is, unless you have a reason to change it.

  • run: lines specify actual commands that will run on the runner. You may specify more than one.