Is there a way so that whenever a pull request is created on github, a new pull request is automatically created after running some npm command (ex. npm run beautify) so that I don't have to worry about the beautification process.
If any such thing can be done which automatically adds a commit to the current pull request which beautifies all the files, even that works fine.
I am ok with using any free third party softwares (Greenkeeper, travis or whatever)
You can use a git hook both on server and local or set up local filters (smudge/clean) to beautify your code before it even being committed to the repo.
Git hooks
Read the official docs for a full reference.
Smudge / clean
Read all about it and to set it up here:
https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes
It turns out that you can write your own filters for doing substitutions in files on commit/checkout.
These are called
clean
andsmudge
filters.In the
.gitattributes
file, you can set a filter for particular paths and then set up scripts that will process files just before they’re checked out (“smudge”, see Figure below) and just before they’re staged (“clean”, see Figure 8-3).These filters can be set to do all sorts of fun things.