You will only be required to change code in the folder .github/workflows
for the first few tasks.
File: .github/workflows/task_1_broken.yml
- The workflow is broken. Fix it.
When it is working you should see a green checkmark in the GitHub Actions status beside the action Task 1 - Fix the broken workflow
Look at the error message in the GitHub Actions log to discover what is wrong. Often GitHub Actions will indicate syntax errors in the workflow file.
File: .github/workflows/task_2_optimize.yml
-
Copy the contents of your finished task 1 workflow file into this file.
-
Change the name to
Task 2 - Optimizing the workflow
We won't be updating the workflow to be more performant as in terms of cost, but in terms of visibility.
The workflow will exit at the earliest failure, so it will not run all steps, hiding some errors.
We want there to be three jobs, Lint
, Test
and Build
.
This way, if there are any errors in each of the steps, it will be quick to discover what went wrong.
File: .github/workflows/task_3_quote_of_the_day.yml
-
Create a new workflow file named
task_3_quote_of_the_day.yml
-
This workflow should trigger on the event
workflow_dispatch
, read more here. -
Setup a new job that uses these steps to output a Chuck Norris Joke.
- name: Fetch quote
uses: fjogeleit/http-request-action@v1
id: getQuoteResponse
with:
url: 'https://api.chucknorris.io/jokes/random'
method: 'GET'
- name: Show Response
id: quote
run: |
echo "::set-output name=QUOTE::${{ fromJson(steps.getQuoteResponse.outputs.response).value }}"
- Use this action to perform a http
POST
request tohttps://chuck.alexc.no/api/quote
. The body should be as follows
{ "quote": "<the quote here>", "accessCode": "<ask Alex for the code>" }
The accessCode is secret, and should be treated as such! See this link for information on how to create a secret and this link on how to use a secret in your workflow.
The quote can be fetched from the step with id: quote
, look here for more info.
- View the glorious results here.
We won't be updating the workflow to be more performant as in terms of cost, but in terms of visibility.
The workflow will exit at the earliest failure, so it will not run all steps, hiding some errors.
We want there to be three jobs, Lint
, Test
and Build
.
This way, if there are any errors in each of the steps, it will be quick to discover what went wrong.
File: .github/workflows/task_4_composite_action.yml
- Create a new workflow file named
task_4_composite_action.yml
- Create a composite action locally, following these instructions
- The action should take an input
accessCode
and perform the same steps as the previous task with this input. - Edit the workflow
task_4_composite_action.yml
so that it uses your new action!
Task 5 - Create your own workflow that listens to the issue comment event
Use the marketplace to find actions that help you respond to comments. Try to make it react with an emoji, or respond to the comment with a message.
You can dispatch your own repository events in GitHub Actions. These can be useful to trigger other workflows who are listening to the same event.
Use this repository as inspiration to get started. https://github.com/peter-evans/slash-command-dispatch