Skip to content

Commit

Permalink
Update to 3 in STEP and README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Dec 10, 2023
1 parent 498d23f commit 2689569
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/steps/-step.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2
3
50 changes: 27 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,48 @@ _Create workflows that enable you to use Continuous Integration (CI) for your pr
</header>

<!--
<<< Author notes: Step 2 >>>
<<< Author notes: Step 3 >>>
Start this step by acknowledging the previous step.
Define terms and link to docs.github.com.
-->

## Step 2: Fix the test
## Step 3: Upload test reports

_Great job adding the templated workflow! :tada:_
_The workflow has finished running! :sparkles:_

Adding that file to this branch is enough for GitHub Actions to begin running CI on your repository.
So what do we do when we need the work product of one job in another? We can use the built-in [artifact storage](https://docs.github.com/actions/advanced-guides/storing-workflow-data-as-artifacts) to save artifacts created from one job to be used in another job within the same workflow.

When a GitHub Actions workflow is running, you should see some checks in progress, like the screenshot below.
To upload artifacts to the artifact storage, we can use an action built by GitHub: [`actions/upload-artifacts`](https://github.com/actions/upload-artifact).

<img alt="checks in progress in a merge box" src=https://user-images.githubusercontent.com/16547949/66080348-ecc5f580-e533-11e9-909e-c213b08790eb.png width=400 />
### :keyboard: Activity: Upload test reports

You can follow along as GitHub Actions runs your job by going to the **Actions** tab or by clicking "Details" in the merge box below.
1. Edit your workflow file.
1. Update the `Run markdown lint` step in your `build` job to use `vfile-reporter-json` and output the results to `remark-lint-report.json`.
1. Add a step to your `build` job that uses the `upload-artifact` action. This step should upload the `remark-lint-report.json` file generated by the updated `Run markdown lint` step.
1. Your new `build` should look like this:

When the tests finish, you'll see a red X :x: or a green check mark :heavy_check_mark: in the merge box. At that point, you can access the logs for the build job and its associated steps.
```yml
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

_By looking at the logs, can you identify which tests failed?_ To find it, go to one of the failed builds and scroll through the log. Look for a section that lists all the unit tests. We're looking for the name of the test with an "x".
- name: Run markdown lint
run: |
npm install remark-cli remark-preset-lint-consistent vfile-reporter-json
npx remark . --use remark-preset-lint-consistent --report vfile-reporter-json 2> remark-lint-report.json
<img alt="screenshot of a sample build log with the names of the tests blurred out" src=https://user-images.githubusercontent.com/16547949/65922013-e740a200-e3b1-11e9-8151-faf52c30201e.png width=400 />
- uses: actions/upload-artifact@v3
with:
name: remark-lint-report
path: remark-lint-report.json
```
If the checks don't appear or if the checks are stuck in progress, there's a few things you can do to try and trigger them:

- Refresh the page, it's possible the workflow ran and the page just hasn't been updated with that change.
- Try making a commit on this branch. Our workflow is triggered with a `push` event, and committing to this branch will result in a new `push`.
- Edit the workflow file on GitHub and ensure there are no red lines indicating a syntax problem.

### :keyboard: Activity: Fix the test

1. Update the code in the `ci` branch to get the test to pass. You need to look something like this:
```markdown
_underscore_
```
1. **Commit changes**.
1. Commit your change to this branch.
1. Wait about 20 seconds and then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/actions) will automatically update to the next step.
Like the upload action to send artifacts to the storage, you can use the download action to download these previously uploaded artifacts from the `build` job: [`actions/download-artifact`](https://github.com/actions/download-artifact). For brevity, we'll skip that step for this course.

<footer>

<!--
Expand Down

0 comments on commit 2689569

Please sign in to comment.