Skip to content

Commit

Permalink
Update README.md step 4
Browse files Browse the repository at this point in the history
  • Loading branch information
highschool-coder authored Dec 15, 2024
1 parent fa11c55 commit 69fdfc7
Showing 1 changed file with 15 additions and 62 deletions.
77 changes: 15 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,25 @@
<header>

<!--
<<< Author notes: Course header >>>
Include a 1280×640 image, course title in sentence case, and a concise description in emphasis.
In your repository settings: enable template repository, add your 1280×640 social image, auto delete head branches.
Add your open source license, GitHub uses MIT license.
-->

# Test with Actions

_Create workflows that enable you to use Continuous Integration (CI) for your projects._

</header>

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

## Step 3: Upload test reports

_The workflow has finished running! :sparkles:_

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.

To upload artifacts to the artifact storage, we can use an action built by GitHub: [`actions/upload-artifact`](https://github.com/actions/upload-artifact).
## Step 4: Add branch protections

### :keyboard: Activity: Upload test reports

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:

```yml
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- 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
- uses: actions/upload-artifact@v4
with:
name: remark-lint-report
path: remark-lint-report.json
```
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>

<!--
<<< Author notes: Footer >>>
Add a link to get support, GitHub status page, code of conduct, license link.
-->
_Great job uploading test reports! :partying_face:_

---
Take a look at the merge box, you'll notice you can merge this even though the review process hasn't been met.

Get help: [Post in our discussion board](https://github.com/orgs/skills/discussions/categories/test-with-actions) &bull; [Review the GitHub status page](https://www.githubstatus.com/)
Protected branches ensure that collaborators on your repository cannot make irrevocable changes to branches. Enabling protected branches also allows you to enable other optional checks and requirements, like required status checks and required reviews.

&copy; 2023 GitHub &bull; [Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/code_of_conduct.md) &bull; [MIT License](https://gh.io/mit)
### :keyboard: Activity: Add branch protections

</footer>
1. Go to **Branches** settings. You can navigate to that page manually by selecting the right-most tab in the top of the repository called **Settings** and then clicking **Branches**.
1. Click **Add classic branch protection rule** under "Branch protection rules".
1. Type `main` in **Branch name pattern**.
1. Check **Require a pull request before merging**.
1. Uncheck **Require approvals**.
1. Check **Require status checks to pass before merging**.
1. Check all build and test jobs that you'd like to see in the newly visible gray box.
1. Click **Create**.
1. _Once you turn on branch protection, Actions can no longer push directly to the `main` branch. Wait about 20 seconds and then go to the `ci` branch. [GitHub Actions](https://docs.github.com/actions) will automatically update to the next step on the `ci` branch. You'll need to follow instructions on this branch._

0 comments on commit 69fdfc7

Please sign in to comment.