gwatts / go-coverage-action Goto Github PK
View Code? Open in Web Editor NEWGitHub action for Go test coverage reports
License: MIT License
GitHub action for Go test coverage reports
License: MIT License
I'm currently trying to setup coverage in a project, and I have a problem with the github-actions
bot unable to push arbitrary notes:
new coverage raw data
new coverage data: {"go-coverage-action-fmt":1,"coverage_pct":61.19733924611973,"pkg_stats":{"github.com/autometrics-dev/autometrics-go/internal/autometrics":[95.23809523809523],"github.com/autometrics-dev/autometrics-go/internal/generate":[75.81227436823104],"github.com/autometrics-dev/autometrics-go/pkg/autometrics":[40],"github.com/autometrics-dev/autometrics-go/pkg/autometrics/prometheus":[0]},"skipped_count":0}
$ git fetch origin +refs/notes/gocoverage:refs/notes/gocoverage
fatal: couldn't find remote ref refs/notes/gocoverage
Warning: Failed to run git fetch origin +refs/notes/gocoverage:refs/notes/gocoverage
no existing gocoverage ref
$ git notes --ref=gocoverage add -f --file=- f407a54d98c74168aa4e88801c88bf20439ef3bc
$ git push origin refs/notes/gocoverage
remote: Permission to autometrics-dev/autometrics-go.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/autometrics-dev/autometrics-go/': The requested URL returned error: 403
Warning: Failed to run git push origin refs/notes/gocoverage
Error: Error: Command failed with exit code 128: git push origin refs/notes/gocoverage
remote: Permission to autometrics-dev/autometrics-go.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/autometrics-dev/autometrics-go/': The requested URL returned error: 403
I'm assuming that some of the errors happen because:
main
, andmain
(as it's a protected branch)What's the exact permissions I need to setup if I want to make that work? I really just used the minimal example:
name: "Go Coverage"
on:
pull_request:
push:
branches:
- main
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 10
- uses: gwatts/go-coverage-action@v1
id: coverage
with:
cover-pkg: ./...
I was experimenting with this action to include it in my workflows. As I was testing with the pull_request
event, I realised that the git notes
that the action is adding ( by the way, kudos on using git notes
for storing coverage reports. It is a cool and neat use of the feature 👏 🎉 ), is being added to merge commits and not to the last commit in the pull request.
I tried to checkout github.head_ref
in actions/checkout
in a vain attempt to see if that would make a difference, but it did not.
Upon inspecting the code further, I noticed that the note was being added to github.context.sha
Line 68 in 810cf84
GITHUB_REF
branch.
This means that there would never be priorCoverage unless there is a companion action run on:push
event as well which will push coverage reports on the actual commits on the branch.
Can we instead, push the note to the last commit in the pull request so that the notes are always available?
I am not sure whether the context payload
Line 75 in 810cf84
would have something like pl.pull_request.head.sha
; but if it does, can we target that please? That way, we would not have to have another action that targets on:push
events as well in order for the on:pull_request
workflows work reliably.
Currently all tests are running ./...
Line 171 in cf5795f
Let's add ability to exclude some paths or pass test packages directly $(go list ./... | grep -v /vendor/)
I have a module using go-coverage-action and tests for which generally take longer than 10m, is there anyway I can configure go test timeouts with this plugin ?
I have a module using go-coverage-action and tests for which generally take longer than 10m, is there anyway I can configure go test timeouts with this plugin ?
GitHub actions has deprecated NodeJSS v16. Running the action in version 1.3.0 emits this message:
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: gwatts/[email protected]. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
Many actions we use have released this type of change as a new major release.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.