DEV Community

Maksym Zavalniuk
Maksym Zavalniuk

Posted on

Format repo - GitHub Action to format your code with comfort

What I built

I made a GitHub action that automatically formats the Python and JavaScript code after each commit and pushes it to the repository.

Category Submission:

DIY Deployments

App Link

App is here.

Screenshots

Example of action pt.1
Example of action pt.2

Description

The action installs black _ and _prettier and uses them to format Python and JavaScript code. After using git commands, changes are pushed to the repository.

Link to Source Code

Code is here.

Permissive License

MIT License

Background (What made you decide to build this particular app? What inspired you?)

First, I wanted to make an action that would automatically push commits to GitLab and BitBucket, like a mirror. But there were difficulties with the API of these services. Then I decided to implement my old idea - an action that automatically formats the code. I tried to do it before with Docker and now with js, and it turned out to be much easier.

How I built it (How did you utilize GitHub Actions or GitHub Codespaces? Did you learn something new along the way? Pick up a new skill?)

I used the libraries from actions/toolkit to create my action. It's more comfortable than when I did it with Docker. I looked at all the libraries, and most of all: actions/core, actions/exec and actions/github.

Additional Resources/Info

To use it, you need to enable workflow read:write in the settings.

Image of Quadratic

AI, code, and data connections in a familiar spreadsheet UI

Simplify data analysis by connecting directly to your database or API, writing code, and using the latest LLMs.

Try Quadratic free

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay