Skip to content
Merged
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
25 changes: 14 additions & 11 deletions .github/workflows/repo-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,22 @@ on:
- cron: "0 0 * * *"
workflow_dispatch:

# The sync authenticates with a GitHub App installation token, so the job needs
# nothing from `secrets.GITHUB_TOKEN`.
permissions: {}

jobs:
repo-sync:
name: Sync upstream changes
uses: argumentcomputer/ci-workflows/.github/workflows/repo-sync.yml@main
with:
repository: digama0/lean4lean
# This fork's default branch is `dev`; `master` is kept as a plain mirror
# of upstream, so both sides of the sync share the branch name.
branch: master
secrets:
TOKEN_APP_ID: ${{ secrets.TOKEN_APP_ID }}
TOKEN_APP_PRIVATE_KEY: ${{ secrets.TOKEN_APP_PRIVATE_KEY }}
runs-on: ubuntu-latest
# `contents` for the sync itself, `issues` for the manual-sync issue the
# action opens when `GITHUB_TOKEN` cannot push, e.g. an upstream change
# under `.github/workflows/`
permissions:
contents: write
issues: write
steps:
- uses: argumentcomputer/ci-workflows/.github/actions/repo-sync@main
with:
repository: digama0/lean4lean
# This fork's default branch is `dev`; `master` is kept as a plain mirror
# of upstream, so both sides of the sync share the branch name.
branch: master
48 changes: 23 additions & 25 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Update Lean toolchain and pinned deps

on:
schedule:
# Daily at 00:00 UTC
- cron: "0 0 * * *"
- cron: "0 12 * * *"
timezone: America/New_York
workflow_dispatch:

permissions:
Expand All @@ -23,33 +23,31 @@ jobs:
with:
ref: dev

# Mint a token from the GitHub App so the opened PR triggers CI; pushes
# made with GITHUB_TOKEN do not. Same App as repo-sync.yml.
- uses: actions/create-github-app-token@v3
id: app-token
# `update_lean4_nix` below runs `nix flake update`
- uses: cachix/install-nix-action@v31
with:
client-id: ${{ secrets.TOKEN_APP_ID }}
private-key: ${{ secrets.TOKEN_APP_PRIVATE_KEY }}
github_access_token: ${{ github.token }}

# `dev` carries the fork's bump_mode/release_channel support; `main` only
# mirrors upstream, which silently ignores these inputs. `pinned-tags`
# suits this package: batteries is pinned to a Lean version tag rather
# than tracking a branch, so its `rev` moves with the toolchain; a
# dependency pinned to a commit hash is reported and left alone. A PR is
# opened on an update/lean-{release} branch whether or not the build
# passes, so an incompatible release shows up as a failing PR to review --
# expected here, where a toolchain bump can break the kernel internals
# this package mirrors.
# `dev` carries the fork's bump_mode/release_channel support and the
# lean4-nix gating; `main` only mirrors upstream, which silently ignores
# these inputs. `pinned-tags` suits this package: batteries is pinned to
# a Lean version tag rather than tracking a branch, so its `rev` moves
# with the toolchain; a dependency pinned to a commit hash is reported
# and left alone. A PR is opened on an update/lean-{release} branch
# whether or not the build passes, so an incompatible release shows up
# as a failing PR to review -- expected here, where a toolchain bump can
# break the kernel internals this package mirrors.
#
# Only the Lean half is automated. flake.nix resolves the toolchain from
# `lean-toolchain` through lean4-nix's vendored release table, so nix.yml
# fails at evaluation on a release that table has not recorded yet. Those
# hashes arrive through lean4-nix's own lean-update PR, which will not
# have merged by the time this job runs, so bumping the `lean4-nix` flake
# input here would only add unrelated churn. It stays a manual follow-up
# on the update PR once lean4-nix has landed the release.
# flake.nix resolves the toolchain from `lean-toolchain` through
# lean4-nix's vendored release table, so nix.yml fails at evaluation on
# a release that table has not recorded yet. `update_lean4_nix` defers
# the update until lean4-nix's default branch carries the release, then
# bumps the `lean4-nix` flake input in the same PR.
#
# The PR is opened with `GITHUB_TOKEN`, so it does not start CI on its
# own; push to it or close and reopen it to run the checks.
- uses: argumentcomputer/lean-update@dev
with:
bump_mode: pinned-tags
on_update_fails: pr
token: ${{ steps.app-token.outputs.token }}
update_lean4_nix: true
Loading