Skip to content

Commit 92d945b

Browse files
authored
Merge pull request #32 from edburns/edburns/dd-2855288-add-smoke-test-to-build-and-test
On branch edburns/dd-2855288-add-smoke-test-to-build-and-test Make it so the branch protection rules are respected regarding pushing the badge update to `main`
2 parents 65c3f29 + 1d78942 commit 92d945b

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

.github/workflows/build-test.yml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ on:
1919
merge_group:
2020

2121
permissions:
22-
contents: write
23-
checks: write
22+
contents: read
2423

2524
jobs:
2625

@@ -34,6 +33,10 @@ jobs:
3433
name: "Java SDK Tests"
3534
needs: smoke-test
3635
if: ${{ always() && needs.smoke-test.result != 'failure' }}
36+
permissions:
37+
contents: write
38+
checks: write
39+
pull-requests: write
3740

3841
runs-on: ubuntu-latest
3942
defaults:
@@ -94,19 +97,20 @@ jobs:
9497
target/surefire-reports/
9598
retention-days: 1
9699

97-
- name: Generate and commit JaCoCo badge
100+
- name: Generate JaCoCo badge
98101
if: success() && github.ref == 'refs/heads/main'
99-
run: |
100-
.github/scripts/generate-coverage-badge.sh
101-
102-
# Commit if changed
103-
if [[ $(git status --porcelain .github/badges/) ]]; then
104-
git config --global user.name 'github-actions[bot]'
105-
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
106-
git add .github/badges/
107-
git commit -m "Update JaCoCo coverage badge"
108-
git push
109-
fi
102+
run: .github/scripts/generate-coverage-badge.sh
103+
104+
- name: Create PR for JaCoCo badge update
105+
if: success() && github.ref == 'refs/heads/main'
106+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7
107+
with:
108+
commit-message: "Update JaCoCo coverage badge"
109+
title: "Update JaCoCo coverage badge"
110+
body: "Automated JaCoCo coverage badge update from CI."
111+
branch: auto/update-jacoco-badge
112+
add-paths: .github/badges/
113+
delete-branch: true
110114

111115
- name: Generate Test Report Summary
112116
if: always()

0 commit comments

Comments
 (0)