Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Reference: Understanding GitHub Actions: Create an Example Workflow

  • 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:

    name: learn-github-actions
    run-name: ${{ github.actor }} is learning GitHub Actions
    on: [push]
    jobs:
      check-bats-version:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - uses: actions/setup-node@v3
            with:
              node-version: '14'
          - run: npm install -g bats
          - run: bats -v
    
  • Notice the jobs field contains a hash, or dictionary, of jobs. In this example, check-bats-version is an arbitrary job name. You may select whatever job name is appropriate for your repo. You may create more than one job, which will perform multiple actions on multiple runners.

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

    • For a list of github hosted runners in the cloud, see About GitHub-hosted runners

    • For a list of Tufts on-prem locally hosted runners, browse to your repository on GitHub, then click Settings > Actions > Runners. You may specify any combination of tags you wish. Your job will only run on runners that satisfy all the tags. For example, if you specify self-hosted then your job will run on any self-hosted runner. If you specify self-hosted, rhel-8 it will only run on those ones.

    • If you have special requirements and cannot run your job on a Tufts local runner on shared infrastructure (due to resource or security requirements) please contact it@tufts.edu and request ESCP to setup a private or custom runner.

  • No labels