timkrase / phpunit-coverage-badge

Github Action to create a static test coverage badge from PHPUnit reports and automatically commit and push it to the repository.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CI Skip by default

MikeDevresse opened this issue · comments

Commiting that the badge is changing is triggering github actions to run again. I don't know if you can configure that in your github action but maybe adding documentation may do the job. I found that if you add the following line and you add [ci skip] in your commit then it might skip the github action.

jobs:
  build:
    runs-on: ubuntu-latest
    if: "!contains(github.event.head_commit.message, '[ci skip]')"

Another options would be to host the badge on a specific branch or not in our repo, on a website for exemple. It kinda mess with legit commits

Commiting that the badge is changing is triggering github actions to run again. I don't know if you can configure that in your github action but maybe adding documentation may do the job. I found that if you add the following line and you add [ci skip] in your commit then it might skip the github action.

jobs:
  build:
    runs-on: ubuntu-latest
    if: "!contains(github.event.head_commit.message, '[ci skip]')"

I'll have a look at this later. As far as I know, default behavior for GitHub Actions should be not to trigger the action again when pushing out of an action. Thanks for the suggested workaround, I'll check out if there's anything else I can do and otherwise would add it to the documentation if that's okay for you.

Another options would be to host the badge on a specific branch or not in our repo, on a website for exemple. It kinda mess with legit commits

I played around with the different branch idea too because I was annoyed by the bloated commit history. This solution has the problem though that it does not allow to link the badge from the readme as easily. Right now, if you link the badge just by the filename and relative to the repository you'll always get the right badge in the readme of every branch. If the badge is on a separate branch you'd have to adjust the readme for every branch to point to the right badge.

I'm also against hosting the badge on a separate website because that would create a dependency outside of GitHub, which I'd like to avoid.

As a first step I'll remove that the clover file is also committed to keep the commit history cleaner.

Another option would be to only run the action on the main/master so a new badge is only generated when merging another branch.

You may also be able to squash your commit with the github action’s triggering one

I'm currently not really working on this anymore (and the options are limited anyway) so a better solution is out of sight. Therefore, I added your example as a possible workaround to the readme, thanks!