-
Notifications
You must be signed in to change notification settings - Fork 2.1k
58 lines (51 loc) · 1.86 KB
/
dependabot-sync-bazel.yml
File metadata and controls
58 lines (51 loc) · 1.86 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
name: dependabot-sync-bazel
on:
pull_request_target:
types: [opened, synchronize, reopened]
branches: ["master"]
paths:
- "pom.xml"
jobs:
sync-bazel-dependencies:
if: >-
github.event.pull_request.user.login == 'dependabot[bot]' &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
env:
BAZELISK_SKIP_VERSION_CHECK: "1"
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Java 17
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
distribution: temurin
java-version: 17
- name: Install Bazelisk
run: |
mkdir -p "$HOME/.local/bin"
curl -fsSL \
https://github.com/bazelbuild/bazelisk/releases/download/v1.24.1/bazelisk-linux-amd64 \
-o "$HOME/.local/bin/bazel"
chmod +x "$HOME/.local/bin/bazel"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Sync Bazel dependency files
run: |
python3 scripts/sync_bazel_dependencies.py
REPIN=1 bazel run @maven//:pin
- name: Commit regenerated Bazel files
shell: bash
run: |
if git diff --quiet -- MODULE.bazel maven_install.json; then
echo "No Bazel dependency file changes detected."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add MODULE.bazel maven_install.json
git commit -m "Sync Bazel dependencies for Dependabot update"
git push origin "HEAD:${{ github.event.pull_request.head.ref }}"