Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit 5d3b98b

Browse files
authored
Make autointegrate action idempotent (#34)
This allows us to trigger it on other events (e.g. a cron) to update for new LLVM commits without constantly clobbering the auto-integrate branch. Also switches to a personal access token (for a bot) so that there aren't issues pushing workflow files (which I ran into while testing) and so that the action can trigger webhooks for other automation (e.g. builds). I'm experiencing some intermittent failures that look like actions/checkout#363, but those were happening before this change as well. Tested: Ran on my fork: https://github.com/GMNGeoffrey/llvm-bazel/runs/1201208655 Second run: https://github.com/GMNGeoffrey/llvm-bazel/runs/1201226878
1 parent 038ddc6 commit 5d3b98b

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.github/workflows/auto_integrate.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,26 @@ jobs:
2727
fetch-depth: 0
2828
submodules: true
2929
ref: ${{ env.MERGING_BRANCH }}
30+
token: ${{ secrets.WRITE_ACCESS_TOKEN }}
3031
- name: Fetching integration branch
3132
run: |
3233
git fetch --no-tags --prune origin "${INTEGRATION_BRANCH?}:${INTEGRATION_BRANCH?}"
3334
- name: Setting git config
3435
run: |
35-
git config --local user.email "llvm-bazel-github-actions-bot@google.com"
36+
git config --local user.email "llvm-bazel-github-bot@google.com"
3637
git config --local user.name "Auto Integrate Action"
3738
- name: Merging in changes
3839
run: |
39-
./scripts/clobber_merge.sh "${INTEGRATION_BRANCH?}" "${MERGING_BRANCH?}"
40+
if ! git merge-base --is-ancestor "${MERGING_BRANCH?}" "${INTEGRATION_BRANCH?}"; then
41+
./scripts/clobber_merge.sh "${INTEGRATION_BRANCH?}" "${MERGING_BRANCH?}"
42+
else
43+
echo "${INTEGRATION_BRANCH?} already branches from ${MERGING_BRANCH?}"
44+
fi
45+
git checkout "${INTEGRATION_BRANCH?}"
4046
git submodule update
4147
- name: Running auto integration
4248
run: ./scripts/auto_integrate.sh
4349
- name: Pushing changes
4450
run: |
45-
git push origin "${INTEGRATION_BRANCH?}" --force --tags
51+
git push origin "${INTEGRATION_BRANCH?}"
52+
git push origin --force --tags

scripts/traverse_llvm_revs.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ SUBMODULE_DIR="third_party/llvm-project"
1717

1818
pushd "${SUBMODULE_DIR?}"
1919
START="$(git rev-parse HEAD)"
20+
# For help debugging https://github.com/actions/checkout/issues/363
21+
git remote -v
2022
git checkout "${BRANCH?}"
2123
git pull --ff-only origin "${BRANCH?}"
2224
git checkout "${START?}"

0 commit comments

Comments
 (0)