|
| 1 | +# The name of the job is what will display on the GitHub repository in the Actions tab. |
| 2 | +name: First Workflow |
| 3 | + |
| 4 | +# The 'on' section tells GitHub under what conditions we want to run this workflow. |
| 5 | +# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows |
| 6 | +# Common scenarios include: |
| 7 | +# workflow-dispatch (manual execution) |
| 8 | +# issues |
| 9 | +# push |
| 10 | +# pull_request |
| 11 | +# schedule |
| 12 | +on: |
| 13 | + workflow_dispatch: |
| 14 | + issues: |
| 15 | + types: [opened] |
| 16 | + |
| 17 | +# This section covers the work to perform. |
| 18 | +# We include one or more jobs in this section. |
| 19 | +jobs: |
| 20 | + # Each individual job will include details like execution order, |
| 21 | + # pre-requisite jobs, and execution platform. |
| 22 | + job1: |
| 23 | + # We can run jobs on GitHub hosted VM runners in Windows, Ubuntu, and Mac OS. |
| 24 | + # We can also run jobs on self-hosted hardware. |
| 25 | + runs-on: ubuntu-latest |
| 26 | + |
| 27 | + # Each job contains one or more steps. A step needs to have at least a name and a command. |
| 28 | + steps: |
| 29 | + - name: Step one |
| 30 | + # The 'run' command executes a shell or command script. Because this is Ubuntu, the |
| 31 | + # default run command will be /bin/bash |
| 32 | + run: echo "Log from step one" |
| 33 | + # This section does not appear in the solution file but demonstrates how to set |
| 34 | + # custom variables that will be available in the run script. |
| 35 | + env: |
| 36 | + VARIABLE_NAME: value |
| 37 | + - name: Step two |
| 38 | + run: echo "Log from step two" |
| 39 | + |
| 40 | + job2: |
| 41 | + # Job 2 will only run after job 1 completes. |
| 42 | + # Removing this 'needs' section would make the jobs run simultaneously. |
| 43 | + needs: job1 |
| 44 | + runs-on: ubuntu-latest |
| 45 | + |
| 46 | + steps: |
| 47 | + - name: Cowsays |
| 48 | + # The 'uses' command executes a remote GitHub action. |
| 49 | + # A command like mscoutermarsh/cowsays-action means you can |
| 50 | + # find this code at https://github.com/mscoutermarsh/cowsays-action |
| 51 | + uses: mscoutermarsh/cowsays-action@master |
| 52 | + # The 'with' block includes parameters that the workflow will pass |
| 53 | + # to this action. Parameters are all in key-value format. |
| 54 | + with: |
| 55 | + text: "Ready for prod--ship it!" |
| 56 | + color: "magenta" |
0 commit comments