-
Notifications
You must be signed in to change notification settings - Fork 330
72 lines (68 loc) · 2.85 KB
/
update-jmxfetch-submodule.yaml
File metadata and controls
72 lines (68 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Update jmxfetch integrations submodule
on:
schedule:
- cron: '0 0 1 * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # Required for OIDC token federation
steps:
- uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
id: octo-sts
with:
scope: DataDog/dd-trace-java
policy: self.update-jmxfetch-submodule.create-pr
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
- name: Update Submodule
run: |
git submodule update --remote -- dd-java-agent/agent-jmxfetch/integrations-core
- name: Check if changes should be committed
id: check-changes
run: |
if [[ -z "$(git status -s)" ]]; then
echo "No changes to commit, exiting."
echo "commit_changes=false" >> "$GITHUB_OUTPUT"
exit 0
else
echo "commit_changes=true" >> "$GITHUB_OUTPUT"
fi
- name: Pick a branch name
if: steps.check-changes.outputs.commit_changes == 'true'
id: define-branch
run: echo "branch=ci/update-jmxfetch-submodule-$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
- name: Commit changes
if: steps.check-changes.outputs.commit_changes == 'true'
id: create-commit
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -m "feat(ci): Update agent-jmxfetch submodule" dd-java-agent/agent-jmxfetch/integrations-core
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Push changes
uses: DataDog/commit-headless@05d7b7ee023e2c7d01c47832d420c2503cd416f3 # action/v2.0.3
if: steps.check-changes.outputs.commit_changes == 'true'
with:
token: "${{ steps.octo-sts.outputs.token }}"
branch: "${{ steps.define-branch.outputs.branch }}"
# for scheduled runs, sha is the tip of the default branch
# for dispatched runs, sha is the tip of the branch it was dispatched on
head-sha: "${{ github.sha }}"
create-branch: true
command: push
commits: "${{ steps.create-commit.outputs.commit }}"
- name: Create pull request
if: steps.check-changes.outputs.commit_changes == 'true'
env:
GH_TOKEN: ${{ steps.octo-sts.outputs.token }}
run: |
gh pr create --title "Update agent-jmxfetch submodule" \
--base master \
--head ${{ steps.define-branch.outputs.branch }} \
--label "comp: tooling" \
--label "type: enhancement" \
--label "tag: no release notes" \
--body "This PR updates the agent-jmxfetch submodule."