Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the merge workflow #6

Closed
wants to merge 12 commits into from
22 changes: 18 additions & 4 deletions .github/workflows/merge-upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ on:
- cron: '0 8 * * 5'

jobs:
job:
create-pr:
runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v3
with:
fetch-depth: 0
sparse-checkout: '.'
ref: akirak

- name: Switch to a work branch
Expand All @@ -21,21 +23,33 @@ jobs:
- name: Fetch the upstream
run: |
git remote add upstream https://github.com/melpa/melpa.git
git fetch upstream
git fetch upstream master

- uses: DeterminateSystems/nix-installer-action@v4
with:
diagnostic-endpoint: ''

- name: Merge upstream recipes
run: |
nix run github:emacs-twist/recipes-updater --no-write-lock-file \
-- upstream/master
# Set some identity. Actually it will be overridden later, so it's
# unused
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

# A workaround to prevent peter-evans/create-pull-request from resetting the
# head here:
# <https://github.com/peter-evans/create-pull-request/blob/d806186ee3288c60a352af9852b6b18afbbfd87e/src/create-or-update-branch.ts#L178>
- name: Detach the head
run: git switch --detach `git rev-parse HEAD`

- name: Create a pull request
uses: peter-evans/create-pull-request@v5
with:
base: akirak
token: ${{ secrets.PAT_FOR_PR }}
title: 'Merge the upstream recipe commits'
branch: create-pull-request/merge-recipes
labels: automation
Loading