Skip to content

Commit

Permalink
Clarify setting HEAD SHA for GH Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Barlow committed Aug 25, 2021
1 parent e9b61d2 commit f402c5c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Binary file added docs/source/assets/checks-result.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions docs/source/ci-cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ jobs:
## GitHub Actions
### Displaying schema check results on GitHub pull requests
If you use GitHub Actions to automatically run [schema checks](https://www.apollographql.com/docs/studio/schema-checks/) on every pull request ([as shown below](#full-example)), you can install the [Apollo Studio GitHub app](https://github.com/marketplace/apollo-studio) to provide links to the results of those checks alongside your other pull request checks:
<img class="screenshot" src="./assets/checks-result.jpg" width="550"/>
For these entries to display correctly, you need to make sure Rover executes against the pull request's `HEAD` commit, as opposed to the _merge_ commit that GitHub adds. You can do this by setting the `APOLLO_VCS_COMMIT` environment variable in your action's configuration:

```yaml
env:
APOLLO_VCS_COMMIT: ${{ github.event.pull_request.head.sha }}
```

### Linux/MacOS jobs using the `curl` installer

Normally, when installing, Rover adds the path of its executable to your `$PATH`. Github Actions, however, doesn't use the `$PATH` variable between `step`s, so if you were to just install Rover and try to run it in the next step, you'd get a `command not found: rover` error.
Expand Down Expand Up @@ -89,6 +102,7 @@ jobs:
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsenv
env:
APOLLO_KEY: ${{ secrets.APOLLO_KEY }}
APOLLO_VCS_COMMIT: ${{ github.event.pull_request.head.sha }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down

0 comments on commit f402c5c

Please sign in to comment.