Closed wlhutchison closed 2 years ago
Currently my-workflow.yml
is not set up correctly for our use-case. It worked great for allowing us to take a high-level look at workflows, but if we want to use our custom actions there are some changes that we have to make to it.
Edit the my-workflow.yml
to have the following contents:
name: JS Actions
on: [push]
jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
I'll respond in this pull request once you make these changes.
@wlhutchison you're doing great so far π! You've had to do a lot of workflow set up so we can begin writing custom actions. We have just one more thing to add to our my-workflow.yml
file before we get to the action side of things.
Before we make our final workflow change let's do a quick recap about what we've done.
Action | Key Takeaways |
---|---|
Created my-workflow.yml inside of .github/workflows directory |
GitHub repositories look in the .github/workflows folder for workflow files. |
Used a templated workflow | GitHub provides many templates for workflow files. This is a great spot to look when setting up a new workflow. If you can't find what you are looking for, you can always click the setup a workflow yourself button for a minimal starter template |
Workflow environment | You learned, from a high level, how a repository uses a workflow file to run commands or actions based on triggers. You also learned that where these commands or actions execute is something that can be specified |
Workflow syntax | You were briefly introduced to the workflow YAML syntax. |
If that seems like a lot of things just to get started... well, it is! GitHub Actions is a robust platform designed to automate a wide range of tasks for your repositories.
If you'd like to see more examples of workflows and actions then check out these Learning Lab courses all about GitHub Actions:
Edit the my-workflow.yml
to contain the following:
name: JS Actions
on: [push]
jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: hello-action
uses: ./.github/actions/hello-world
I'll respond when I notice you've made these changes
Our workflow has finished π
Our workflow has finished so let's take a look at the results now that we have learned a little bit about workflows while we waited.
In the left-hand panel of this screen you can see that this workflow, named
CI
was triggeredon: push
and ran the job titledbuild
.The right-hand panel shows real-time logging of the steps executed by the
build
job. There are currently 5 steps defined for this job:π€This is interesting, in the
my-workflow.yml
file we defined 3 steps, not 5, so what happened?GitHub Actions will always add the
Set up job
andComplete job
steps to each job in a workflow. These steps are what configure the virtual environment before running your steps and shut it down properly before moving onto the next job in your workflow.If you recall, we had 1 step that used an action and 2 steps that ran commands, can you identify which step used the action?
Answer to above question
If you said `actions/checkout@v1` you'd be correct π!If you want to see this for yourself head over to your [Actions tab]() and examine the workflow named
CI