-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: Initial setup and logic #1
base: main
Are you sure you want to change the base?
Conversation
let cachedOctokit: InstanceType<typeof GitHub>; | ||
|
||
const run = async () => { | ||
const pullRequestTitle = github.context?.payload?.pull_request?.title; |
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.
Be sure to document what events this action can be triggered by. I assume pull_request
and pull_request_target
will provide the same PR title, but if it's triggered by push
then we'll have to figure out what PRs are connected to that branch. PR and PR target would be the safest in v1 I think.
it('it adds feature label', async () => { | ||
const addLabels = sandbox.stub(api, 'addLabels').resolves(undefined) | ||
const removeLabel = sandbox.stub(api, 'removeLabel').resolves(undefined) | ||
sandbox.stub(process.env, 'GITHUB_EVENT_PATH').value('./test/fixtures/feature.json') | ||
await api.main() | ||
sandbox.assert.calledWith(removeLabel, 'feature', sandbox.match.any) | ||
sandbox.assert.calledWith(removeLabel, 'fix', sandbox.match.any) | ||
sandbox.assert.calledWith(removeLabel, 'breaking', sandbox.match.any) | ||
sandbox.assert.calledWith(removeLabel, 'ignore-for-release', sandbox.match.any) | ||
sandbox.assert.calledWith(addLabels, ['feature'], sandbox.match.any) | ||
}) |
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.
We're testing that the "feature" labels is both removed and added. Shouldn't we test that the "feature" label is NOT tampered with?
Co-authored-by: Sindre Bøyum <[email protected]>
No description provided.