Skip to content
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 as a GitHub Action #238

Closed
pbrisbin opened this issue Jul 16, 2024 · 0 comments · Fixed by #235
Closed

Use as a GitHub Action #238

pbrisbin opened this issue Jul 16, 2024 · 0 comments · Fixed by #235

Comments

@pbrisbin
Copy link
Member

I've often been asked why Restyled isn't "just" a GitHub Action. The actual reason is that GitHub Actions did not exist at the time I created Restyled. It also is already usable as a GitHub Action: the core restyling functionality is a standalone CLI and corresponding Docker image. Motivated users could install the CLI or pull the image and run it as a GitHub Action. It will restyle the files of the local checkout, after which they could do what they want, be it push those changes or open a sibling PR, just as Restyled does today.

That said, it's harder than it should be and non-obvious how to do so. I would like to see the CLI extended to cater to this use-case, I'd like our own distribution processes more amenable to it (i.e. ship binary-attached Releases instead of, or in addition to, the Docker images), and I'd like a nice actions/setup and actions/run to exist to encapsulate as much as possible.

I think it would be relatively easy to make the standard "restyle a PR and open a sibling" functionality look like:

jobs:
  - uses: actions/checkout@v4
  - uses: restyled-io/actions/setup@v1
  - uses: restyled-io/actions/run@v1
  - uses: peter-evans/create-pull-request@v6
    with:
      branch: ${{ steps.restyler.outputs.restyled-branch-name }}
      base: ${{ github.event.pull_request.head.ref }}
      title: ${{ steps.restyler.outputs.restyled-pr-title }}
      body: ${{ steps.restyler.outputs.restyled-pr-body }}
      delete-branch: true

I think leaving the create-pull-request step to the outside is what we should do for now, because it minimizes what we have to change to make this possible and start suggesting it to users, while maximizing flexibility. If/when we decide that GHA is the only way to run Restyled, and we remove all the implementation surrounding the hosted version, we can take a look at what's left before deciding on other trade-offs of ergonomics-vs-complexity.

@pbrisbin pbrisbin linked a pull request Jul 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant