@@ -12,78 +12,19 @@ jobs:
1212 contents : write # Required to create new branch
1313 id-token : write # Required for OIDC token federation
1414 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-gradle-dependencies.create-pr
20-
2115 - name : Checkout repository
2216 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
2317 with :
2418 submodules : " recursive"
25- - name : Download ghcommit CLI
26- run : |
27- curl https://github.com/planetscale/ghcommit/releases/download/v0.1.48/ghcommit_linux_amd64 -o /usr/local/bin/ghcommit -L
28- chmod +x /usr/local/bin/ghcommit
29- - name : Pick a branch name
30- run : echo "BRANCH_NAME=ci/update-gradle-dependencies-$(date +'%Y%m%d')" >> $GITHUB_ENV
31- - name : Create branch
32- run : |
33- git checkout -b $BRANCH_NAME
34- git push -u origin $BRANCH_NAME --force
3519 - name : Update Gradle dependencies
3620 env :
3721 AKKA_REPO_TOKEN : ${{ secrets.AKKA_REPO_TOKEN }}
3822 run : |
23+ echo "REPO TOKEN LENGTH ${#AKKA_REPO_TOKEN}"
3924 GRADLE_OPTS="-DakkaRepositoryToken=$AKKA_REPO_TOKEN -Dorg.gradle.jvmargs='-Xmx3G -Xms2G'" \
4025 JAVA_HOME=$JAVA_HOME_8_X64 \
4126 JAVA_8_HOME=$JAVA_HOME_8_X64 \
4227 JAVA_11_HOME=$JAVA_HOME_11_X64 \
4328 JAVA_17_HOME=$JAVA_HOME_17_X64 \
4429 JAVA_21_HOME=$JAVA_HOME_21_X64 \
4530 ./gradlew resolveAndLockAll --write-locks --parallel --stacktrace --no-daemon --max-workers=4
46- - name : Commit changes
47- env :
48- GITHUB_TOKEN : ${{ steps.octo-sts.outputs.token }}
49- run : |
50- GH_ADD_ARGS=""
51- COUNT=0
52- BRANCH_HEAD=$(git rev-parse HEAD)
53- for lockfile in $(git status --porcelain=v1 -- ':(glob)**/gradle.lockfile' | awk '{ print $NF }'); do
54- echo "Found lockfile: $lockfile"
55- GH_ADD_ARGS="$GH_ADD_ARGS --add $lockfile"
56- COUNT=$((COUNT+1))
57- if [ $COUNT -eq 10 ]; then
58- echo "Creating a commit to $BRANCH_NAME@$BRANCH_HEAD with $GH_ADD_ARGS"
59- OUTPUT=$(ghcommit --repository ${{ github.repository }} --branch $BRANCH_NAME --sha $BRANCH_HEAD $GH_ADD_ARGS --message "chore: Update Gradle dependencies" 2>&1)
60- echo $OUTPUT
61- if [[ $OUTPUT != *"Success. New commit"* ]]; then
62- exit 1
63- fi
64- BRANCH_HEAD=${OUTPUT##*/}
65- echo "ghcommit output: $OUTPUT"
66- GH_ADD_ARGS=""
67- COUNT=0
68- fi
69- done
70- # Check at uncommited files
71- echo "Checking uncommited files"
72- git status
73- # Create a PR from the created branch
74- if [ $COUNT -gt 0 ]; then
75- echo "Creating a commit to $BRANCH_NAME@$BRANCH_HEAD with $GH_ADD_ARGS"
76- ghcommit --repository ${{ github.repository }} --branch $BRANCH_NAME --sha $BRANCH_HEAD $GH_ADD_ARGS --message "chore: Update Gradle dependencies"
77- fi
78- - name : Create pull request
79- env :
80- GH_TOKEN : ${{ steps.octo-sts.outputs.token }}
81- run : |
82- # use echo to set a multiline body for the PR
83- echo -e "This PR updates the Gradle dependencies. ⚠️ Don't forget to squash commits before merging. ⚠️\n\n- [ ] Update PR title if a code change is needed to support one of those new dependencies" | \
84- gh pr create --title "Update Gradle dependencies" \
85- --base master \
86- --head $BRANCH_NAME \
87- --label "tag: dependencies" \
88- --label "tag: no release notes" \
89- --body-file -
0 commit comments