sinedied / publish-devto

:postbox: GitHub Action to publish markdown files on dev.to platform, with assets hosted on GitHub.
MIT License
38 stars 8 forks source link

Git commit attempted even when no changes are present in the working tree #18

Closed pabloromeo closed 2 years ago

pabloromeo commented 2 years ago

In the event of updating content for a draft that has already been previously created and uplodaed by this action, the git commit action fails, since there are no local changes to commit.

For example: image

I'm guessing prior to issuing the commit it should check if the working tree is clean and not run it.

ksingh7 commented 2 years ago

+1 @pabloromeo i am too facing the same issue.

@sinedied Even though the posting/updating job is successful, the GHA fails with this error message. This is a great tool would be nice if you can help in fixing this ( i don't know how to fix, otherwise if have send you thee PR)

image

sinedied commented 2 years ago

Thanks for reporting this, I'll have a look. I'll have to catch this specific use case to avoid throwing an error

pabloromeo commented 2 years ago

Hey! Since I didn't know if you were still maintaining this, I forked and fixed it here, in this commit: https://github.com/cloudx-labs/publish-devto/commit/0235a3f1238c369904ac72026bddbe6a071ef0a2

I solved it by evaluating the result of git status prior to the commit, to doing it when the workdir is clean.

In that repo I also added support for dry-run in the github action, and added output parameters so other actions can do stuff with the summary of actions taken. For example, in my usage, I'm using an output summary of a dry-run which I post as a comment in the PR, to inform of the changes that would be published.

sinedied commented 2 years ago

@pabloromeo That's great! Could you submit a PR with your change? I'll gladly merge it 🙂

pabloromeo commented 2 years ago

Sure thing, here you go: https://github.com/sinedied/publish-devto/pull/20

sinedied commented 2 years ago

@pabloromeo The GitHub Action is updated (still under v2 tag), and I also updated the template repo to include your changes and ideas with PR reviews: https://github.com/sinedied/devto-github-template/blob/main/.github/workflows/publish.yml 🙂