diff --git a/.changeset/strange-bats-doubt.md b/.changeset/strange-bats-doubt.md new file mode 100644 index 000000000..1ed4b059f --- /dev/null +++ b/.changeset/strange-bats-doubt.md @@ -0,0 +1,9 @@ +--- +'skuba': minor +--- + +lint, format: Remove [logic](https://github.com/seek-oss/skuba/pull/1226/) which skips autofixing Renovate branches when there is no open pull request. + +Previously, this was put in place to prevent an issue where a Renovate branch can get stuck in the `Edited/Blocked` state without a pull request being raised. + +Skuba's default autofix commits are [now ignored by skuba's recommended renovate configuration](https://github.com/seek-oss/rynovate/pull/121). diff --git a/src/cli/lint/autofix.test.ts b/src/cli/lint/autofix.test.ts index 813b84f22..c667e0a84 100644 --- a/src/cli/lint/autofix.test.ts +++ b/src/cli/lint/autofix.test.ts @@ -1,6 +1,5 @@ import simpleGit from 'simple-git'; -import * as Buildkite from '../../api/buildkite'; import * as Git from '../../api/git'; import * as GitHub from '../../api/github'; import { runESLint } from '../adapter/eslint'; @@ -17,7 +16,6 @@ import { internalLint } from './internal'; jest.mock('simple-git'); jest.mock('../../api/git'); jest.mock('../../api/github'); -jest.mock('../../api/buildkite'); jest.mock('../adapter/eslint'); jest.mock('../adapter/prettier'); jest.mock('./internal'); @@ -125,23 +123,6 @@ describe('autofix', () => { expectNoAutofix(); }); - it('bails on a renovate branch when there is no open pull request', async () => { - jest.mocked(Git.currentBranch).mockResolvedValue('renovate-skuba-7.x'); - jest - .mocked(GitHub.getPullRequestNumber) - .mockRejectedValue( - new Error( - `Commit cdd1520 is not associated with an open GitHub pull request`, - ), - ); - - await expect(autofix(params)).resolves.toBeUndefined(); - - expect(Buildkite.annotate).toHaveBeenCalled(); - - expectNoAutofix(); - }); - it('suceeds on a renovate branch when there is an open pull request associated with the commit', async () => { jest.mocked(Git.currentBranch).mockResolvedValue('renovate-skuba-7.x'); jest.mocked(GitHub.getPullRequestNumber).mockResolvedValue(6); diff --git a/src/cli/lint/autofix.ts b/src/cli/lint/autofix.ts index f8187574e..791945b6f 100644 --- a/src/cli/lint/autofix.ts +++ b/src/cli/lint/autofix.ts @@ -2,7 +2,6 @@ import { inspect } from 'util'; import simpleGit from 'simple-git'; -import * as Buildkite from '../../api/buildkite'; import * as Git from '../../api/git'; import * as GitHub from '../../api/github'; import { isCiEnv } from '../../utils/env'; @@ -16,8 +15,6 @@ import { createDestinationFileReader } from '../configure/analysis/project'; import { internalLint } from './internal'; import type { Input } from './types'; -const RENOVATE_DEFAULT_PREFIX = 'renovate'; - const AUTOFIX_COMMIT_MESSAGE = 'Run `skuba format`'; export const AUTOFIX_IGNORE_FILES_BASE: Git.ChangedFile[] = [ @@ -66,21 +63,6 @@ const shouldPush = async ({ return false; } - if (currentBranch?.startsWith(RENOVATE_DEFAULT_PREFIX)) { - try { - await GitHub.getPullRequestNumber(); - } catch { - const warning = - 'An autofix is available, but it was not pushed because an open pull request for this Renovate branch could not be found. If a pull request has since been created, retry the lint step to push the fix.'; - log.warn(warning); - try { - await Buildkite.annotate(Buildkite.md.terminal(warning)); - } catch {} - - return false; - } - } - let headCommitMessage; try { headCommitMessage = await Git.getHeadCommitMessage({ dir });