Skip to content

Commit af57684

Browse files
committed
Update jmxfetch workflow
1 parent a56894b commit af57684

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

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

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
permissions:
12-
contents: write # Required to create and push branch
12+
contents: read
1313
id-token: write # Required for OIDC token federation
1414
steps:
1515
- uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
@@ -38,21 +38,25 @@ jobs:
3838
if: steps.check-changes.outputs.commit_changes == 'true'
3939
id: define-branch
4040
run: echo "branch=ci/update-jmxfetch-submodule-$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
41-
- name: Create branch
41+
- name: Commit changes
4242
if: steps.check-changes.outputs.commit_changes == 'true'
43-
run: |
44-
git checkout -b ${{ steps.define-branch.outputs.branch }}
45-
git push -u origin ${{ steps.define-branch.outputs.branch }} --force
46-
- name: Commit and push changes
47-
if: steps.check-changes.outputs.commit_changes == 'true'
48-
env:
49-
GITHUB_TOKEN: ${{ steps.octo-sts.outputs.token }}
43+
id: create-commit
5044
run: |
5145
git config user.name "github-actions[bot]"
5246
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
53-
git add dd-java-agent/agent-jmxfetch/integrations-core
54-
git commit -m "Update agent-jmxfetch submodule"
55-
git push origin ${{ steps.define-branch.outputs.branch }}
47+
git commit -m "feat(ci): Update agent-jmxfetch submodule" dd-java-agent/agent-jmxfetch/integrations-core
48+
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
49+
- name: Push changes
50+
uses: DataDog/commit-headless@1186485b788f57eedaaadb19919781698b4d262f # action/v1.0.0
51+
if: steps.check-changes.outputs.commit_changes == 'true'
52+
with:
53+
token: "${{ steps.octo-sts.outputs.token }}"
54+
branch: "${{ steps.define-branch.outputs.branch }}"
55+
# for scheduled runs, sha is the tip of the default branch
56+
# for dispatched runs, sha is the tip of the branch it was dispatched on
57+
branch-from: "${{ github.sha }}"
58+
command: push
59+
commits: "${{ steps.create-commit.outputs.commit }}"
5660
- name: Create pull request
5761
if: steps.check-changes.outputs.commit_changes == 'true'
5862
env:

0 commit comments

Comments
 (0)