Skip to content

Commit 1bef455

Browse files
committed
Update jmxfetch workflow
1 parent 184ac68 commit 1bef455

2 files changed

Lines changed: 25 additions & 11 deletions

File tree

.github/workflows/update-docker-build-image.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ jobs:
8181
run: |
8282
git commit --message "feat(ci): Update Docker build image" .gitlab-ci.yml
8383
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
84+
env:
85+
GITHUB_TOKEN: ${{ steps.octo-sts.outputs.token }}
8486
- name: Push changes
8587
uses: Asana/push-signed-commits@d615ca88d8e1a946734c24970d1e7a6c56f34897
8688
if: ${{ steps.create-commit.outputs.commit != '' }}

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

Lines changed: 23 additions & 11 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
@@ -20,7 +20,6 @@ jobs:
2020

2121
- name: Checkout repository
2222
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
23-
2423
- name: Update Submodule
2524
run: |
2625
git submodule update --remote -- dd-java-agent/agent-jmxfetch/integrations-core
@@ -34,6 +33,12 @@ jobs:
3433
else
3534
echo "commit_changes=true" >> "$GITHUB_OUTPUT"
3635
fi
36+
- name: Configure git
37+
if: steps.check-changes.outputs.commit_changes == 'true'
38+
id: configure-git
39+
run: |
40+
git config user.name "github-actions[bot]"
41+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
3742
- name: Pick a branch name
3843
if: steps.check-changes.outputs.commit_changes == 'true'
3944
id: define-branch
@@ -43,20 +48,25 @@ jobs:
4348
run: |
4449
git checkout -b ${{ steps.define-branch.outputs.branch }}
4550
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'
4851
env:
4952
GITHUB_TOKEN: ${{ steps.octo-sts.outputs.token }}
53+
- name: Commit changes
54+
if: steps.check-changes.outputs.commit_changes == 'true'
55+
id: create-commit
5056
run: |
51-
git config user.name "github-actions[bot]"
52-
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 }}
57+
git commit --message "feat(ci): Update agent-jmxfetch submodule" dd-java-agent/agent-jmxfetch/integrations-core
58+
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
59+
env:
60+
GITHUB_TOKEN: ${{ steps.octo-sts.outputs.token }}
61+
- name: Push changes
62+
uses: Asana/push-signed-commits@d615ca88d8e1a946734c24970d1e7a6c56f34897
63+
if: ${{ steps.create-commit.outputs.commit != '' }}
64+
with:
65+
github-token: ${{ steps.octo-sts.outputs.token }}
66+
local_branch_name: ${{ steps.define-branch.outputs.branch }}
67+
remote_branch_name: ${{ steps.define-branch.outputs.branch }}
5668
- name: Create pull request
5769
if: steps.check-changes.outputs.commit_changes == 'true'
58-
env:
59-
GH_TOKEN: ${{ steps.octo-sts.outputs.token }}
6070
run: |
6171
gh pr create --title "Update agent-jmxfetch submodule" \
6272
--base master \
@@ -65,3 +75,5 @@ jobs:
6575
--label "type: enhancement" \
6676
--label "tag: no release notes" \
6777
--body "This PR updates the agent-jmxfetch submodule."
78+
env:
79+
GITHUB_TOKEN: ${{ steps.octo-sts.outputs.token }}

0 commit comments

Comments
 (0)