From aa8f68021b9847c4ab1c6930183b8814c7f776c9 Mon Sep 17 00:00:00 2001 From: Martin Kinkelin Date: Fri, 17 Jul 2026 18:28:12 +0200 Subject: [PATCH] CI: Automate update-dmd-rewrite.sh runs --- .github/workflows/update-dmd-rewrite.yml | 29 ++++++++++++++++++++++++ tools/update-dmd-rewrite.sh | 8 +++++-- 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/update-dmd-rewrite.yml diff --git a/.github/workflows/update-dmd-rewrite.yml b/.github/workflows/update-dmd-rewrite.yml new file mode 100644 index 00000000000..a36b7b5c691 --- /dev/null +++ b/.github/workflows/update-dmd-rewrite.yml @@ -0,0 +1,29 @@ +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions + +name: Update DMD rewrite +on: + schedule: + - cron: "0 0 * * *" # run every day at 00:00 + workflow_dispatch: # enable manual runs + +permissions: + contents: write + +jobs: + update-dmd-rewrite: + name: Update DMD rewrite + if: github.repository == 'ldc-developers/ldc' # don't run for forks + runs-on: ubuntu-22.04 + timeout-minutes: 20 + steps: + - uses: actions/checkout@v6 + with: + submodules: false + - name: Install git-filter-repo v2.34.0 + run: | + set -eux + sudo apt-get -q update + sudo apt-get install -yq git-filter-repo + - run: tools/update-dmd-rewrite.sh + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/tools/update-dmd-rewrite.sh b/tools/update-dmd-rewrite.sh index 457a22e4ad7..1685e6a932f 100755 --- a/tools/update-dmd-rewrite.sh +++ b/tools/update-dmd-rewrite.sh @@ -31,7 +31,7 @@ This reverts commit 4b76bfcb2eb24bb8786bd293201a5711fbf747fe==>This reverts comm EOF # clone DMD monorepo -git clone git@github.com:dlang/dmd.git dmd.tmp +git clone https://github.com/dlang/dmd.git dmd.tmp cd dmd.tmp # only for initialization: @@ -86,7 +86,11 @@ git branch --no-track "${refs_prefix}master" master git branch --no-track "${refs_prefix}stable" stable # add LDC repo as `ldc` remote -git remote add ldc git@github.com:ldc-developers/ldc.git +if [[ -v GITHUB_TOKEN ]]; then + git remote add ldc https://git:${GITHUB_TOKEN}@github.com/ldc-developers/ldc.git +else + git remote add ldc git@github.com:ldc-developers/ldc.git +fi # check for newly added DMD source files if [[ "$initialize" != 1 ]]; then