Skip to content

Commit

Permalink
Change default for creating artifacts on drafts to false
Browse files Browse the repository at this point in the history
  • Loading branch information
lerebear committed Mar 4, 2024
1 parent 319d409 commit 65df5bf
Show file tree
Hide file tree
Showing 10 changed files with 417 additions and 7 deletions.
25 changes: 23 additions & 2 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ describe('action', () => {
)
})

it('skips creating a score artifact by default', async () => {
it('skips creating a score artifact when that feature is not enabled', async () => {
// Mock the @actions/github context.
Object.defineProperty(github, 'context', {
value: pullRequestEventContext()
Expand All @@ -219,7 +219,28 @@ describe('action', () => {

expect(runMock).toHaveReturned()
expect(setFailedMock).not.toHaveBeenCalled()
expect(infoMock).toHaveBeenCalledWith('Skipping score artifact creation')
expect(infoMock).toHaveBeenCalledWith(
'Skipping score artifact creation because it has not been enabled'
)
})

it('skips creating a score artifact on draft pull requests by default', async () => {
// Mock the @actions/github context.
Object.defineProperty(github, 'context', {
value: pullRequestEventContext({ draft: true })
})

loadConfigurationMock.mockImplementation(() => ({
archiving: { persistScoreArtifact: true }
}))

await main.run()

expect(runMock).toHaveReturned()
expect(setFailedMock).not.toHaveBeenCalled()
expect(infoMock).toHaveBeenCalledWith(
'Skipping score artifact creation on a draft pull request'
)
})

it('runs the workflow sucessfully when optIns configuration is present and the pull request author is in it', async () => {
Expand Down
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions dist/config/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ The result of that command (changes to the [`dist`](./dist) directory and other

## Regenerating the Typescript interface for the configuration schema

Follow the same [procedure](https://github.com/lerebear/sizeup-core#regenerating-the-typescript-interface-for-the-configuration-schema) outlined for this process in the `sizeup-core` repository.
The [configuration JSON schema](../src/config/schema.json) acts as the source of truth for the configuration file format that this workflow accepts: each change to configuration should begin with a change to that schema. Once that change has been made, we should regenerate the corresponding [`Configuration`](../src/configuration.ts) interface in Typescript using the `generate:config` script:

```sh
npm run generate:config
```
Loading

0 comments on commit 65df5bf

Please sign in to comment.