8
8
jobs :
9
9
build :
10
10
runs-on : ubuntu-latest
11
+ permissions :
12
+ contents : write # Required to create and push branch
13
+ id-token : write # Required for OIDC token federation
11
14
steps :
15
+ - uses : DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
16
+ id : octo-sts
17
+ with :
18
+ scope : DataDog/dd-trace-java
19
+ policy : self.update-jmxfetch-submodule.create-pr
20
+
12
21
- name : Checkout repository
13
22
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
14
23
15
24
- name : Update Submodule
16
25
run : |
17
26
git submodule update --remote -- dd-java-agent/agent-jmxfetch/integrations-core
18
- - name : Download ghcommit CLI
19
- run : |
20
- curl https://github.com/planetscale/ghcommit/releases/download/v0.1.48/ghcommit_linux_amd64 -o /usr/local/bin/ghcommit -L
21
- chmod +x /usr/local/bin/ghcommit
22
27
- name : Pick a branch name
23
28
id : define-branch
24
29
run : echo "branch=ci/update-jmxfetch-submodule-$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
@@ -28,12 +33,21 @@ jobs:
28
33
git push -u origin ${{ steps.define-branch.outputs.branch }} --force
29
34
- name : Commit and push changes
30
35
env :
31
- GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN }}
36
+ GITHUB_TOKEN : ${{ steps.octo-sts.outputs.token }}
32
37
run : |
33
- ghcommit --repository ${{ github.repository }} --branch ${{ steps.define-branch.outputs.branch }} --add dd-java-agent/agent-jmxfetch/integrations-core --message "Update agent-jmxfetch submodule"
38
+ git config user.name "github-actions[bot]"
39
+ 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 }}
45
+ git add dd-java-agent/agent-jmxfetch/integrations-core
46
+ git commit -m "Update agent-jmxfetch submodule"
47
+ git push origin ${{ steps.define-branch.outputs.branch }}
34
48
- name : Create pull request
35
49
env :
36
- GH_TOKEN : ${{ github .token }}
50
+ GH_TOKEN : ${{ steps.octo-sts.outputs .token }}
37
51
run : |
38
52
gh pr create --title "Update agent-jmxfetch submodule" \
39
53
--base master \
0 commit comments