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.

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more