Skip to content

Commit 950010a

Browse files
Update ci badge on pr only (#11)
Co-authored-by: openhands <openhands@all-hands.dev>
1 parent 984b051 commit 950010a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

.github/workflows/tests.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Run tests
22
on:
33
push:
44
branches: ["**"]
5+
pull_request:
6+
branches: ["**"]
57

68
permissions:
79
contents: write
@@ -64,7 +66,7 @@ jobs:
6466
docs/assets/coverage.svg
6567
if-no-files-found: ignore
6668
- name: Parse coverage percent
67-
if: always()
69+
if: ${{ always() && github.event_name == 'pull_request' }}
6870
id: parsecov
6971
run: |
7072
python - << 'PY'
@@ -83,7 +85,7 @@ jobs:
8385
PY
8486
8587
- name: Determine badge color
86-
if: always()
88+
if: ${{ always() && github.event_name == 'pull_request' }}
8789
id: color
8890
run: |
8991
PCT=$(cat coverage_percent.txt || echo 0)
@@ -96,11 +98,11 @@ jobs:
9698
echo "pct=$PCT" >> $GITHUB_OUTPUT
9799
98100
- name: Ensure docs/assets directory
99-
if: always()
101+
if: ${{ always() && github.event_name == 'pull_request' }}
100102
run: mkdir -p docs/assets
101103

102104
- name: Generate coverage badge
103-
if: always()
105+
if: ${{ always() && github.event_name == 'pull_request' }}
104106
uses: emibcn/badge-action@v2.0.2
105107
with:
106108
label: coverage
@@ -115,8 +117,8 @@ jobs:
115117
name: coverage-badge
116118
path: docs/assets/coverage.svg
117119

118-
- name: Commit coverage badge (push builds)
119-
if: ${{ always() && github.event_name == 'push' }}
120+
- name: Commit coverage badge (push builds on non-main branches)
121+
if: ${{ always() && github.event_name == 'push' && github.ref != 'refs/heads/main' }}
120122
uses: EndBug/add-and-commit@v9
121123
with:
122124
add: "docs/assets/coverage.svg"

0 commit comments

Comments
 (0)