[go: up one dir, main page]

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.

Top comments (0)