Skip to content

Commit 1ae8609

Browse files
naimurhasanclaude
authored andcommitted
fix: auto-update dependency lock files in sync workflow
After cherry-picking custom commits onto upstream, the workflow now runs `./gradlew alldependencies --write-locks` before pushing to prevent lock file conflicts from failing the build. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 677d3d1 commit 1ae8609

1 file changed

Lines changed: 37 additions & 2 deletions

File tree

.github/workflows/sync_upstream.yml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,43 @@ jobs:
104104
exit 1
105105
fi
106106
107-
# Force push updated main
108-
git push origin main --force
109107
echo "updated=true" >> $GITHUB_OUTPUT
110108
109+
- name: Set up JDK 21
110+
if: steps.sync.outputs.updated == 'true'
111+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
112+
with:
113+
distribution: "temurin"
114+
java-version: "21"
115+
116+
- name: Setup Gradle
117+
if: steps.sync.outputs.updated == 'true'
118+
uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2
119+
with:
120+
cache-disabled: true
121+
122+
- name: Mock google-services.json for lock file resolution
123+
if: steps.sync.outputs.updated == 'true'
124+
run: |
125+
cp .github/mock-google-services.json app/google-services.json
126+
cp .github/mock-google-services.json wear/google-services.json
127+
cp .github/mock-google-services.json automotive/google-services.json
128+
129+
- name: Update dependency lock files
130+
if: steps.sync.outputs.updated == 'true'
131+
run: |
132+
./gradlew alldependencies --write-locks
133+
if [ -n "$(git diff --name-only)" ]; then
134+
echo "Lock files updated, committing changes..."
135+
git add '*.lockfile'
136+
git commit -m "fix: update dependency lock files after upstream sync"
137+
else
138+
echo "Lock files are already up-to-date."
139+
fi
140+
141+
- name: Push to origin
142+
if: steps.sync.outputs.updated == 'true'
143+
run: |
144+
git push origin main --force
145+
111146
# Build is automatically triggered by the force-push to main via onPush.yml's push event

0 commit comments

Comments
 (0)