Skip to content

Commit fa2342b

Browse files
committed
Update jmxfetch submodule workflow
1 parent 88dbb80 commit fa2342b

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

.github/workflows/update-jmxfetch-submodule.yaml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,37 @@ jobs:
2424
- name: Update Submodule
2525
run: |
2626
git submodule update --remote -- dd-java-agent/agent-jmxfetch/integrations-core
27+
- name: Check if changes should be committed
28+
id: check-changes
29+
run: |
30+
if [[ -z "$(git status -s)" ]]; then
31+
echo "No changes to commit, exiting."
32+
echo "commit_changes=false" >> "$GITHUB_OUTPUT"
33+
exit 0
34+
else
35+
echo "commit_changes=true" >> "$GITHUB_OUTPUT"
36+
fi
2737
- name: Pick a branch name
38+
if: steps.check-changes.outputs.commit_changes == 'true'
2839
id: define-branch
2940
run: echo "branch=ci/update-jmxfetch-submodule-$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
3041
- name: Create branch
42+
if: steps.check-changes.outputs.commit_changes == 'true'
3143
run: |
3244
git checkout -b ${{ steps.define-branch.outputs.branch }}
3345
git push -u origin ${{ steps.define-branch.outputs.branch }} --force
3446
- name: Commit and push changes
47+
if: steps.check-changes.outputs.commit_changes == 'true'
3548
env:
3649
GITHUB_TOKEN: ${{ steps.octo-sts.outputs.token }}
3750
run: |
3851
git config user.name "github-actions[bot]"
3952
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
40-
if [[ -z "$(git status -s)" ]]; then
41-
echo "No changes to commit, exiting."
42-
exit 0;
43-
fi
44-
git checkout -b ${{ steps.define-branch.outputs.branch }}
4553
git add dd-java-agent/agent-jmxfetch/integrations-core
4654
git commit -m "Update agent-jmxfetch submodule"
4755
git push origin ${{ steps.define-branch.outputs.branch }}
4856
- name: Create pull request
57+
if: steps.check-changes.outputs.commit_changes == 'true'
4958
env:
5059
GH_TOKEN: ${{ steps.octo-sts.outputs.token }}
5160
run: |

0 commit comments

Comments
 (0)