Skip to content

Commit 1ab67d9

Browse files
authored
Merge pull request #1976 from cloudfoundry/simplify_spring_sleuth_action
Simplify spring-sleuth GitHub action
2 parents 876959a + e79c24b commit 1ab67d9

1 file changed

Lines changed: 14 additions & 24 deletions

File tree

.github/workflows/build-spring-sleuth-jar.yml

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,10 @@ on:
1616

1717
jobs:
1818
build:
19-
if: github.actor != 'github-actions[bot]'
2019
runs-on: ubuntu-latest
21-
permissions:
22-
contents: write
2320
steps:
2421
- name: Checkout repository
2522
uses: actions/checkout@v6
26-
with:
27-
token: ${{ secrets.GIT_BOT_TOKEN || github.token }}
2823

2924
- name: Set up Java
3025
uses: actions/setup-java@v4
@@ -34,26 +29,21 @@ jobs:
3429
cache: maven
3530

3631
- name: Build jar with Maven
32+
id: build_jar
33+
continue-on-error: true
3734
working-directory: assets/spring-sleuth
38-
run: mvn package
39-
40-
- name: Commit rebuilt jar to PR branch
41-
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && env.GIT_BOT_TOKEN != '' && env.GIT_BOT_NAME != '' && env.GIT_BOT_EMAIL != ''
42-
env:
43-
GIT_BOT_TOKEN: ${{ secrets.GIT_BOT_TOKEN }}
44-
GIT_BOT_NAME: ${{ secrets.GIT_BOT_NAME }}
45-
GIT_BOT_EMAIL: ${{ secrets.GIT_BOT_EMAIL }}
4635
run: |
47-
git config user.name "${GIT_BOT_NAME}"
48-
git config user.email "${GIT_BOT_EMAIL}"
49-
git remote set-url origin "https://x-access-token:${GIT_BOT_TOKEN}@github.com/${{ github.repository }}.git"
50-
51-
git add assets/spring-sleuth/target/spring-sleuth-0.0.1.jar
52-
if git diff --cached --quiet; then
53-
echo "No jar changes to commit"
54-
exit 0
55-
fi
36+
mvn package
5637
57-
git commit -m "Build spring-sleuth-0.0.1.jar with 'mvn package'"
58-
git push origin "HEAD:${{ github.head_ref }}"
38+
- name: Report successful package build
39+
if: steps.build_jar.outcome == 'success'
40+
run: |
41+
echo "mvn package succeeded."
42+
echo "Please rebuild and push assets/spring-sleuth/target/spring-sleuth-0.0.1.jar manually in a new PR."
5943
44+
- name: Report failed package build
45+
if: steps.build_jar.outcome == 'failure'
46+
run: |
47+
echo "mvn package failed."
48+
echo "The automatic update requires further code changes before the jar can be rebuilt. Check previous build jar step for details."
49+
exit 1

0 commit comments

Comments
 (0)