From 4ee86a28299ca4d2b369bc7042ac827e30f1e800 Mon Sep 17 00:00:00 2001 From: Akira Komamura Date: Thu, 2 Nov 2023 23:28:38 +0900 Subject: [PATCH] Don't use the Nix flake --- .github/workflows/merge-upstream.yml | 36 +++++++++++++++++++++------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/.github/workflows/merge-upstream.yml b/.github/workflows/merge-upstream.yml index 36c98838cf8..f1ce38a399c 100644 --- a/.github/workflows/merge-upstream.yml +++ b/.github/workflows/merge-upstream.yml @@ -18,26 +18,46 @@ jobs: ref: akirak - name: Switch to a work branch - run: git switch -C upstream-recipes + id: start + run: | + git switch -C upstream-recipes + echo "rev=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" - name: Fetch the upstream + id: upstream run: | git remote add upstream https://github.com/melpa/melpa.git git fetch upstream master + echo "ref=upstream/master" >> "$GITHUB_OUTPUT" - uses: DeterminateSystems/nix-installer-action@v4 with: diagnostic-endpoint: '' - - name: Merge upstream recipes + - name: Configure the Git identity run: | - # Set some identity. Actually it will be overridden later, so it's - # unused + # Set some identity. Actually it will be overridden later by git-filter-repo, + # so it can be anything git config --add user.name 'github-actions[bot]' git config --add user.email '6270544+github-actions[bot]@users.noreply.github.com' - nix run github:emacs-twist/recipes-updater/remain-on-tmp-branch#forceUpdate \ - --no-write-lock-file -- upstream/master - git rebase akirak + + - name: Retrieve the merge base + id: merge-base + run: | + rev=$(git merge-base ${{ steps.upstream.outputs.ref }} ${{ steps.start.outputs.rev }}) + echo "rev=$rev" >> "$GITHUB_OUTPUT" + + - name: Filter commits + run: | + tmp="recipes-$(date +%s)" + git switch -c "$tmp" ${{ steps.upstream.outputs.ref }} + nix run nixpkgs#git-filter-repo -- \ + --path recipes/ --refs "${{ steps.merge-base.outputs.rev }}..HEAD" \ + --commit-callback ' + commit.committer_name = commit.author_name + commit.committer_email = commit.author_email + commit.committer_date = commit.author_date + ' --force # A workaround to prevent peter-evans/create-pull-request from resetting the # head here: @@ -48,7 +68,7 @@ jobs: - name: Create a pull request uses: peter-evans/create-pull-request@v5 with: - base: akirak + base: ${{ steps.merge-base.outputs.rev }} token: ${{ secrets.PAT_FOR_PR }} title: 'Merge the upstream recipe commits' branch: create-pull-request/merge-recipes