Closed QuintinWillison closed 3 years ago
Observations from https://github.com/ably/repository-audit/pull/14 in respect of the environment variables that relate to analysis of 'pull request vs main':
Environment Variable | Value for Pull Request | Value for main |
---|---|---|
GITHUB_SHA |
f79a3b624475e47848eea92758d53b13a526bb4e |
37aa814eba9d238fc948ad0957839cb1e3c6869c |
GITHUB_REF |
refs/pull/14/merge |
refs/heads/main |
GITHUB_EVENT_NAME |
pull_request |
push |
GITHUB_BASE_REF |
main |
|
GITHUB_HEAD_REF |
explore-github-environment |
Observations from #14 in respect of the environment variables that can contribute to us dynamically generating the link to the commit that generated the report:
GITHUB_SERVER_URL
: https://github.com
GITHUB_REPOSITORY
: ably/repository-audit
So, the current hard-coded version:
`https://github.com/ably/repository-audit/commit/${sha}`
Can be replaced with:
`${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${sha}`
There should be no need to hardcode any GitHub URL components into this codebase - specifically, right now, I'm thinking of the repository hyperlinks and the upstream commit link in the downstream commit message.
Using
GITHUB_SERVER_URL
, the org we're querying andGITHUB_REPOSITORY
should be all that's needed.See: Learn GitHub Actions: Environment Variables