Skip to content

Merge main to nightly-testing #673

Merge main to nightly-testing

Merge main to nightly-testing #673

# This job merges every commit to `main` into `nightly-testing`, resolving merge conflicts in favor of `nightly-testing`.
# It is a slight variant of the `nightly_merge_master.yml` job from Mathlib.
name: Merge main to nightly-testing
on:
schedule:
- cron: '30 */3 * * *' # At minute 30 past every 3rd hour.
workflow_dispatch:
jobs:
merge-to-nightly-testing:
if: github.repository == 'leanprover/cslib'
runs-on: ubuntu-latest
steps:
- name: Generate app token
id: app-token
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
with:
app-id: ${{ secrets.MATHLIB_NIGHTLY_TESTING_APP_ID }}
private-key: ${{ secrets.MATHLIB_NIGHTLY_TESTING_PRIVATE_KEY }}
# The create-github-app-token README states that this token is masked and will not be logged accidentally.
- name: Checkout nightly-testing
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: leanprover/cslib
ref: nightly-testing
path: nightly-testing
token: ${{ steps.app-token.outputs.token }}
fetch-depth: 0
- name: Configure Lean
uses: leanprover/lean-action@f807b338d95de7813c5c50d018f1c23c9b93b4ec # 2025-04-24
with:
auto-config: false
use-github-cache: false
use-mathlib-cache: false
lake-package-directory: "nightly-testing" # We will run `lake update` here later.
- name: Configure Git User
run: |
cd nightly-testing
git config user.name "mathlib-nightly-testing[bot]"
git config user.email "mathlib-nightly-testing[bot]@users.noreply.github.com"
- name: Merge main to nightly-testing favoring nightly-testing changes
run: |
cd nightly-testing
# We use a separate remote here,
# in case Cslib later wants to move its nightly-testing infrastructure to a fork.
git remote add upstream https://github.com/leanprover/cslib.git
git fetch upstream main
# Merge main into nightly-testing, resolving conflicts in favor of nightly-testing
# If the merge goes badly, we proceed anyway via '|| true'.
# CI will report failures on the 'nightly-testing' branch direct to Zulip.
git merge upstream/main --strategy-option ours --no-commit --allow-unrelated-histories || true
# We aggressively run `lake update`, to avoid having to do this by hand.
# At present Cslib pins its dependency on Mathlib, so this should be a noop.
# If Mathlib were to be unpinned, and changes in Mathlib break Cslib,
# this will likely show up on nightly-testing first.
lake update
git add .
# If there's nothing to do (because there are no new commits from main),
# that's okay, hence the '|| true'.
git commit -m "Merge main into nightly-testing" || true
# Push
git push origin nightly-testing