-
Notifications
You must be signed in to change notification settings - Fork 8
ci: onboard codecov #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # Config can be validated before merging: curl -X POST --data-binary @.codecov.yaml https://codecov.io/validate | ||
| codecov: | ||
| max_report_age: "off" # see https://docs.codecov.io/docs/codecov-yaml#section-expired-reports | ||
|
|
||
| # See http://docs.codecov.io/docs/coverage-configuration | ||
| coverage: | ||
| precision: 2 # 2 = xx.xx%, 0 = xx% | ||
| round: down | ||
| # For example: 20...60 would result in any coverage less than 20% | ||
| # would have a red background. The color would gradually change to | ||
| # green approaching 60%. Any coverage over 60% would result in a | ||
| # solid green color. | ||
| range: "20...60" | ||
|
|
||
| # See https://docs.codecov.com/docs/commit-status | ||
| status: | ||
| # project will give us the diff in the total code coverage between a commit | ||
| # and its parent | ||
| project: | ||
| default: | ||
| # Allow the coverage to drop by 1%, and posting a success status. | ||
| threshold: 1% | ||
| # Patch gives just the coverage of the patch | ||
| patch: yes | ||
| # changes tells us if there are unexpected code coverage changes in other files | ||
| # which were not changed by the diff | ||
| changes: yes | ||
|
|
||
| # See http://docs.codecov.io/docs/ignoring-paths | ||
| ignore: | ||
| - "cmd/*" | ||
| - "test/*" | ||
|
|
||
| # See http://docs.codecov.io/docs/pull-request-comments-1 | ||
| comment: | ||
| layout: "header, diff, tree" | ||
| # default = posts once then update, posts new if delete | ||
| # once = post once then updates | ||
| # new = delete old, post new | ||
| # spammy = post new | ||
| behavior: "new" |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,30 @@ | ||||||||||||
| name: upload-coverage | ||||||||||||
| on: | ||||||||||||
| workflow_run: | ||||||||||||
| workflows: [ ci ] | ||||||||||||
| types: [ completed ] | ||||||||||||
|
|
||||||||||||
| jobs: | ||||||||||||
| upload-coverage: | ||||||||||||
| if: > | ||||||||||||
| github.event.workflow_run.conclusion == 'success' | ||||||||||||
|
Comment on lines
+9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
FILE=".github/workflows/upload-coverage.yml"
echo "== File =="
ls -l "$FILE"
echo
echo "== Lines 1-120 =="
nl -ba "$FILE" | sed -n '1,140p'Repository: codeready-toolchain/argocd-mcp-server Length of output: 258 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n "CODECOV_TOKEN|workflow_run|codecov-action|download-artifact" .github/workflows -S
echo
echo "== List workflow files =="
ls -1 .github/workflowsRepository: codeready-toolchain/argocd-mcp-server Length of output: 700 Add a trusted-repo guard (and SHA-pin actions) in
Suggested guard- if: >
- github.event.workflow_run.conclusion == 'success'
+ if: >
+ github.event.workflow_run.conclusion == 'success' &&
+ github.event.workflow_run.head_repository.full_name == github.repository📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||
| runs-on: ubuntu-24.04 | ||||||||||||
|
|
||||||||||||
| steps: | ||||||||||||
| - name: Download coverage artifact | ||||||||||||
| uses: actions/download-artifact@v8 | ||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
FILE=".github/workflows/upload-coverage.yml"
echo "== File: $FILE =="
nl -ba "$FILE" | sed -n '1,120p'
echo
echo "== All action uses in $FILE =="
rg -n "^\s*uses:" "$FILE" || trueRepository: codeready-toolchain/argocd-mcp-server Length of output: 192 🏁 Script executed: #!/bin/bash
set -euo pipefail
FILE=".github/workflows/upload-coverage.yml"
echo "== File: $FILE =="
awk '{printf "%5d\t%s\n", NR, $0}' "$FILE" | sed -n '1,140p'
echo
echo "== All action uses in $FILE =="
rg -n "^\s*uses:" "$FILE" || trueRepository: codeready-toolchain/argocd-mcp-server Length of output: 1420 🏁 Script executed: #!/bin/bash
set -euo pipefail
FILE=".github/workflows/upload-coverage.yml"
echo "== $FILE =="
awk '{printf "%5d\t%s\n", NR, $0}' "$FILE" | sed -n '1,140p'
echo
rg -n "^\s*uses:" "$FILE" || trueRepository: codeready-toolchain/toolchain-common Length of output: 1362 🏁 Script executed: #!/bin/bash
set -euo pipefail
FILE=".github/workflows/upload-coverage.yml"
echo "== $FILE =="
awk '{printf "%5d\t%s\n", NR, $0}' "$FILE" | sed -n '1,160p'
echo
rg -n "^\s*uses:" "$FILE" || trueRepository: codeready-toolchain/host-operator Length of output: 1363 Pin GitHub Actions to commit SHAs (supply-chain integrity) In Suggested fix pattern- uses: actions/download-artifact@v8
+ uses: actions/download-artifact@<full-length-commit-sha>
...
- uses: codecov/codecov-action@v6
+ uses: codecov/codecov-action@<full-length-commit-sha>🧰 Tools🪛 zizmor (1.25.2)[error] 15-15: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||||||||||||
| with: | ||||||||||||
| name: coverage | ||||||||||||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||
| run-id: ${{ github.event.workflow_run.id }} | ||||||||||||
|
|
||||||||||||
| - name: Upload to Codecov | ||||||||||||
| uses: codecov/codecov-action@v6 | ||||||||||||
| with: | ||||||||||||
| token: ${{ secrets.CODECOV_TOKEN }} | ||||||||||||
| # The 'files' attribute consists of 'coverage/coverage.txt'. | ||||||||||||
| # The 'coverage' directory is created upon the download of the coverage artifact from previous step (it creates a directory with the name of the artifact). | ||||||||||||
| files: coverage/coverage.txt | ||||||||||||
| flags: unittests # optional | ||||||||||||
| fail_ci_if_error: true | ||||||||||||
| verbose: true | ||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| tmp | ||
| build/_output/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: codeready-toolchain/argocd-mcp-server
Length of output: 124
🏁 Script executed:
Repository: codeready-toolchain/argocd-mcp-server
Length of output: 1453
Pin
actions/upload-artifactto a full commit SHA.The workflow uses
actions/upload-artifact@v7, and the movable tag weakens supply-chain guarantees.Suggested fix pattern
🧰 Tools
🪛 zizmor (1.25.2)
[error] 33-33: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🤖 Prompt for AI Agents