danpetitt / open-cover-badge-generator-action

GitHub Action to read an open cover xml file in the project folder and generate a badge to use in readme file
MIT License
5 stars 0 forks source link

Add flag to skip commits and pushes or be able to specify a dedicated branch for storing badges #2

Open fkhoda opened 3 years ago

fkhoda commented 3 years ago

Hi,

Is it possible to add a flag to this action so that we can disable commits and pushes to the current branch or better be able to use a different branch? The reason behind is protective branches. Our master branch has push restrictions and we don't want to lift off this just for pushing badges.

Thanks, Fadil

danpetitt commented 3 years ago

I have added a couple of new options; can you try them and see if they do what you wish - v1.0.10?

christianfredh commented 1 year ago

I created an empty branch gh-pages before this. And using this config:

    - name: OpenCover Badge Generator
      uses: danpetitt/open-cover-badge-generator-action@v1.0.10
      with:
        path-to-opencover-xml: ./tests/coverage.opencover.xml
        path-to-badges: ./
        minimum-coverage: 75
        commit-badges: true
        commit-branch-name: gh-pages
        repo-token: ${{ secrets.GITHUB_TOKEN }}

First, got this error: error: pathspec 'gh-pages' did not match any file(s) known to git

Due to git not knowing of the branch. Tried added a git fetch before the badge generation:

    - name: Git fetch
      run: git fetch

And this worked, the first time. Second time, got this error:

error: The following untracked working tree files would be overwritten by checkout:
    coverage-badge-branch.svg
    coverage-badge-line.svg
Please move or remove them before you switch branches.

So, it almost works, but not the whole way.