-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use @actions/github to invoke GraphQL for GHES compatibility #16
Conversation
👋 I'm working on updating in-the-box actions for GHES. Note, I was able to test the changes successfully against dotcom but doesnt look like packages is enabled on my local GHES deployment. |
import {catchError, map, tap} from 'rxjs/operators' | ||
import {GraphQlQueryResponse} from '@octokit/graphql/dist-types/types' | ||
import {graphql} from './graphql' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To enable mocking, i switched to importing a local file instead. The problem is @actions/github
exports a class which introduces a challenge for mocking... solved by adding one more level of indirection :)
* @param {string} query GraphQL query. Example: `'query { viewer { login } }'`. | ||
* @param {object} parameters URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`. | ||
*/ | ||
export async function graphql( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrapper function to make it easy to mock. Otherwise hard to mock since GitHub
is an exported class.
b26a883
to
f4a606f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGMT. Packages is not in GHES yet which is why you were not able to test it. It will be very soon though
@trent-j thanks! Would you be able to merge and release? I dont have permission. With these changes, it should just work, once Packages is in GHES. |
I end-to-end tested the scenario where it discovers old packages and deletes. I believe that exercises all of the cases where GraphQL is invoked (get version + delete). |
Switched to
@actions/[email protected]
for GHES support when invoking GraphQL. It sets the correct baseUrl when running in a GHES environment. Related to PR actions/toolkit#449