Skip to content

Commit d77b8b1

Browse files
author
Stephen Barlow
committed
Clarify setting HEAD SHA for GH Actions
1 parent 3286550 commit d77b8b1

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

docs/source/assets/checks-result.jpg

131 KB
Loading

docs/source/ci-cd.md

+14
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ jobs:
5050
5151
## GitHub Actions
5252
53+
### Displaying schema check results on GitHub pull requests
54+
55+
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:
56+
57+
<img class="screenshot" src="./assets/checks-result.jpg" width="550"/>
58+
59+
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. To guarantee this, set the `APOLLO_VCS_COMMIT` environment variable in your action's configuration, like so:
60+
61+
```yaml
62+
env:
63+
APOLLO_VCS_COMMIT: ${{ github.event.pull_request.head.sha }}
64+
```
65+
5366
### Linux/MacOS jobs using the `curl` installer
5467

5568
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.
@@ -89,6 +102,7 @@ jobs:
89102
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsenv
90103
env:
91104
APOLLO_KEY: ${{ secrets.APOLLO_KEY }}
105+
APOLLO_VCS_COMMIT: ${{ github.event.pull_request.head.sha }}
92106
93107
# Steps represent a sequence of tasks that will be executed as part of the job
94108
steps:

0 commit comments

Comments
 (0)