Skip to content

Commit eaac544

Browse files
committed
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
modified: .github/workflows/build-test.yml Fixes #31 Signed-off-by: Ed Burns <edburns@microsoft.com>
1 parent 0842fe0 commit eaac544

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

.github/workflows/build-test.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ on:
2121
permissions:
2222
contents: write
2323
checks: write
24+
pull-requests: write
2425

2526
jobs:
2627

@@ -94,19 +95,20 @@ jobs:
9495
target/surefire-reports/
9596
retention-days: 1
9697

97-
- name: Generate and commit JaCoCo badge
98+
- name: Generate JaCoCo badge
9899
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
100+
run: .github/scripts/generate-coverage-badge.sh
101+
102+
- name: Create PR for JaCoCo badge update
103+
if: success() && github.ref == 'refs/heads/main'
104+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7
105+
with:
106+
commit-message: "Update JaCoCo coverage badge"
107+
title: "Update JaCoCo coverage badge"
108+
body: "Automated JaCoCo coverage badge update from CI."
109+
branch: auto/update-jacoco-badge
110+
add-paths: .github/badges/
111+
delete-branch: true
110112

111113
- name: Generate Test Report Summary
112114
if: always()

0 commit comments

Comments
 (0)