jackfirth / create-resyntax-pull-request

A GitHub Action that runs Resyntax and creates a pull request with its suggestions
Apache License 2.0
0 stars 0 forks source link

The PR base should be configurable #4

Closed benknoble closed 4 days ago

benknoble commented 4 days ago

https://github.com/jackfirth/create-resyntax-pull-request/blob/99a358fd264010f7fc21b6b002829f0703ac230d/action.yml#L77

The action hardcodes master, while some repos use other mainline branch names.

This causes an error at the PR step:

PR request error ``` RequestError [HttpError]: Validation Failed: {"resource":"PullRequest","field":"base","code":"invalid"} at /home/runner/work/_actions/actions/github-script/v7.0.1/dist/index.js:9537:21 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async eval (eval at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v7.0.1/dist/index.js:35424:16), :12:1) at async main (/home/runner/work/_actions/actions/github-script/v7.0.1/dist/index.js:35522:20) { status: 422, response: { url: 'https://api.github.com/repos/benknoble/frosthaven-manager/pulls', status: 422, headers: { 'access-control-allow-origin': '*', 'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset', 'content-length': '201', 'content-security-policy': "default-src 'none'", 'content-type': 'application/json; charset=utf-8', date: 'Mon, 14 Oct 2024 21:49:31 GMT', 'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin', server: 'github.com', 'strict-transport-security': 'max-age=31536000; includeSubdomains; preload', vary: 'Accept-Encoding, Accept, X-Requested-With', 'x-accepted-github-permissions': 'pull_requests=write', 'x-content-type-options': 'nosniff', 'x-frame-options': 'deny', 'x-github-api-version-selected': '2022-11-28', 'x-github-media-type': 'github.v3; format=json', 'x-github-request-id': '1900:2F18A4:1C72C7A:3686A1A:670D91EB', 'x-ratelimit-limit': '5000', 'x-ratelimit-remaining': '4998', 'x-ratelimit-reset': '1728945778', 'x-ratelimit-resource': 'core', 'x-ratelimit-used': '2', 'x-xss-protection': '0' }, data: { message: 'Validation Failed', errors: [Array], documentation_url: 'https://docs.github.com/rest/pulls/pulls#create-a-pull-request', status: '422' } }, request: { method: 'POST', url: 'https://api.github.com/repos/benknoble/frosthaven-manager/pulls', headers: { accept: 'application/vnd.github.v3+json', 'user-agent': 'actions/github-script octokit-core.js/5.0.1 Node.js/20.13.1 (linux; x64)', authorization: 'token [REDACTED]', 'content-type': 'application/json; charset=utf-8' }, body: '{"title":"Automated Resyntax fixes","head":"autofix-2-1","base":"master","body":"This is an automated change generated by Resyntax.\\n\\n#### Pass 1\\n\\nApplied 1 fix to [`gui/round-prompts.rkt`](../blob/HEAD/gui/round-prompts.rkt)\\n\\n * Line 15, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n\\nApplied 2 fixes to [`gui/stacked-tables.rkt`](../blob/HEAD/gui/stacked-tables.rkt)\\n\\n * Line 16, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n * Line 74, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n\\nApplied 1 fix to [`gui/mixins.rkt`](../blob/HEAD/gui/mixins.rkt)\\n\\n * Line 11, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n\\nApplied 2 fixes to [`gui/helpers.rkt`](../blob/HEAD/gui/helpers.rkt)\\n\\n * Line 8, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n * Line 12, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n\\nApplied 2 fixes to [`gui/rich-text-display.rkt`](../blob/HEAD/gui/rich-text-display.rkt)\\n\\n * Line 23, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n * Line 49, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n\\nApplied 1 fix to [`manager/db.rkt`](../blob/HEAD/manager/db.rkt)\\n\\n * Line 8, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n\\nApplied 1 fix to [`testfiles/data.rkt`](../blob/HEAD/testfiles/data.rkt)\\n\\n * Line 11, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n\\nApplied 1 fix to [`gui/monster-modifier.rkt`](../blob/HEAD/gui/monster-modifier.rkt)\\n\\n * Line 23, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n\\nApplied 1 fix to [`manager/transition.rkt`](../blob/HEAD/manager/transition.rkt)\\n\\n * Line 9, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n\\nApplied 1 fix to [`gui/level-info.rkt`](../blob/HEAD/gui/level-info.rkt)\\n\\n * Line 13, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n\\nApplied 1 fix to [`gui/static-table.rkt`](../blob/HEAD/gui/static-table.rkt)\\n\\n * Line 25, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n\\nApplied 1 fix to [`manager/loot.rkt`](../blob/HEAD/manager/loot.rkt)\\n\\n * Line 16, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n\\nApplied 1 fix to [`manager/round-prompts.rkt`](../blob/HEAD/manager/round-prompts.rkt)\\n\\n * Line 13, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n\\nApplied 1 fix to [`manager/ability-decks.rkt`](../blob/HEAD/manager/ability-decks.rkt)\\n\\n * Line 16, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n\\nApplied 2 fixes to [`pp/bestiary.rkt`](../blob/HEAD/pp/bestiary.rkt)\\n\\n * Line 7, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n * Line 35, `single-clause-match-to-match-define`: This `match` expression can be simplified using `match-define`.\\n\\nApplied 1 fix to [`manager/modifier-decks.rkt`](../blob/HEAD/manager/modifier-decks.rkt)\\n\\n * Line 18, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n\\nApplied 2 fixes to [`gui/player-info.rkt`](../blob/HEAD/gui/player-info.rkt)\\n\\n * Line 17, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n * Line 236, `map-to-for`: This `map` operation can be replaced with a `for/list` loop.\\n\\nApplied 1 fix to [`manager/elements.rkt`](../blob/HEAD/manager/elements.rkt)\\n\\n * Line 12, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n\\nApplied 1 fix to [`scribblings/common.rkt`](../blob/HEAD/scribblings/common.rkt)\\n\\n * Line 14, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n\\nApplied 2 fixes to [`manager/state.rkt`](../blob/HEAD/manager/state.rkt)\\n\\n * Line 89, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.\\n * Line 423, `if-let-to-cond`: `cond` with internal definitions is preferred over `if` with `let`, to reduce nesting\\n\\n## Summary\\n\\nFixed 26 issues in 20 files.\\n\\n * Fixed 23 occurrences of `tidy-require`\\n * Fixed 1 occurrence of `single-clause-match-to-match-define`\\n * Fixed 1 occurrence of `map-to-for`\\n * Fixed 1 occurrence of `if-let-to-cond`\\n\\n","maintainer_can_modify":true}', request: { agent: [Agent], fetch: [Function: proxyFetch], hook: [Function: bound bound register] } } } Error: Unhandled error: HttpError: Validation Failed: {"resource":"PullRequest","field":"base","code":"invalid"} ```
jackfirth commented 4 days ago

I've done you one better: as of v0.4.2, the action now infers the repository's default branch automatically from the workflow context. So you shouldn't need to configure anything and it should hopefully just work.