Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 3 additions & 62 deletions .github/workflows/update-gradle-dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,78 +12,19 @@ jobs:
contents: write # Required to create new branch
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-gradle-dependencies.create-pr

- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
with:
submodules: "recursive"
- name: Download ghcommit CLI
run: |
curl https://github.com/planetscale/ghcommit/releases/download/v0.1.48/ghcommit_linux_amd64 -o /usr/local/bin/ghcommit -L
chmod +x /usr/local/bin/ghcommit
- name: Pick a branch name
run: echo "BRANCH_NAME=ci/update-gradle-dependencies-$(date +'%Y%m%d')" >> $GITHUB_ENV
- name: Create branch
run: |
git checkout -b $BRANCH_NAME
git push -u origin $BRANCH_NAME --force
- name: Update Gradle dependencies
env:
AKKA_REPO_TOKEN: ${{ secrets.AKKA_REPO_TOKEN }}
run: |
GRADLE_OPTS="-DakkaRepositoryToken=$AKKA_REPO_TOKEN -Dorg.gradle.jvmargs='-Xmx3G -Xms2G'" \
echo "REPO TOKEN LENGTH ${#AKKA_REPO_TOKEN}"
GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx3G -Xms2G'" \
JAVA_HOME=$JAVA_HOME_8_X64 \
JAVA_8_HOME=$JAVA_HOME_8_X64 \
JAVA_11_HOME=$JAVA_HOME_11_X64 \
JAVA_17_HOME=$JAVA_HOME_17_X64 \
JAVA_21_HOME=$JAVA_HOME_21_X64 \
./gradlew resolveAndLockAll --write-locks --parallel --stacktrace --no-daemon --max-workers=4
- name: Commit changes
env:
GITHUB_TOKEN: ${{ steps.octo-sts.outputs.token }}
run: |
GH_ADD_ARGS=""
COUNT=0
BRANCH_HEAD=$(git rev-parse HEAD)
for lockfile in $(git status --porcelain=v1 -- ':(glob)**/gradle.lockfile' | awk '{ print $NF }'); do
echo "Found lockfile: $lockfile"
GH_ADD_ARGS="$GH_ADD_ARGS --add $lockfile"
COUNT=$((COUNT+1))
if [ $COUNT -eq 10 ]; then
echo "Creating a commit to $BRANCH_NAME@$BRANCH_HEAD with $GH_ADD_ARGS"
OUTPUT=$(ghcommit --repository ${{ github.repository }} --branch $BRANCH_NAME --sha $BRANCH_HEAD $GH_ADD_ARGS --message "chore: Update Gradle dependencies" 2>&1)
echo $OUTPUT
if [[ $OUTPUT != *"Success. New commit"* ]]; then
exit 1
fi
BRANCH_HEAD=${OUTPUT##*/}
echo "ghcommit output: $OUTPUT"
GH_ADD_ARGS=""
COUNT=0
fi
done
# Check at uncommited files
echo "Checking uncommited files"
git status
# Create a PR from the created branch
if [ $COUNT -gt 0 ]; then
echo "Creating a commit to $BRANCH_NAME@$BRANCH_HEAD with $GH_ADD_ARGS"
ghcommit --repository ${{ github.repository }} --branch $BRANCH_NAME --sha $BRANCH_HEAD $GH_ADD_ARGS --message "chore: Update Gradle dependencies"
fi
- name: Create pull request
env:
GH_TOKEN: ${{ steps.octo-sts.outputs.token }}
run: |
# use echo to set a multiline body for the PR
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" | \
gh pr create --title "Update Gradle dependencies" \
--base master \
--head $BRANCH_NAME \
--label "tag: dependencies" \
--label "tag: no release notes" \
--body-file -
./gradlew :dd-java-agent:instrumentation:akka:akka-http:akka-http-10.0:resolveAndLockAll --write-locks --parallel --stacktrace --no-daemon --max-workers=4
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ repositories {
}
} else {
maven {
url = "https://repo.akka.io/maven"
url = "https://doesnotexist/maven"
}
}
}
Expand Down