Skip to content

Tidy the workflow for merging upstream recipes #98

Tidy the workflow for merging upstream recipes

Tidy the workflow for merging upstream recipes #98

Workflow file for this run

name: Merge upstream recipes
on:
workflow_dispatch:
schedule:
- cron: '0 8 * * 5'
pull_request:
paths:
# This file
- '**/.github/workflows/merge-upstream.yml'
jobs:
pr:
runs-on: ubuntu-latest
strategy:
matrix:
- base_ref: akirak

Check failure on line 18 in .github/workflows/merge-upstream.yml

View workflow run for this annotation

GitHub Actions / Merge upstream recipes

Invalid workflow file

The workflow is not valid. .github/workflows/merge-upstream.yml (Line: 18, Col: 7): A sequence was not expected
upstream: 'https://github.com/melpa/melpa.git'
upstream_branch: 'master'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
sparse-checkout: '.'
ref: ${{ strategy.base_ref }}
- name: Switch to a work branch
id: start
run: |
echo "rev=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: Fetch the upstream
run: |
git remote add upstream ${{ matrix.upstream }}
git fetch upstream ${{ matrix.upstream_branch }}
- uses: DeterminateSystems/nix-installer-action@v4
with:
diagnostic-endpoint: ''
- name: Configure the Git identity
run: |
# 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'
- name: Retrieve the merge base
id: merge-base
run: |
rev=$(git merge-base upstream/${{ matrix.upstream_branch }} ${{ strategy.base_ref }})
echo "rev=$rev" > "$GITHUB_OUTPUT"
- name: Filter commits
run: |
git switch -C upstream-recipes upstream/${{ matrix.upstream_branch }}
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
- name: Rebase
run: |
git rebase -s ort -X ours ${{ steps.start.outputs.rev }}
- name: Merge into the original branch
run: |
git switch -c ${{ strategy.base_ref }}
git merge --ff upstream-recipes
- name: Create a pull request
uses: peter-evans/create-pull-request@v5
with:
branch: create-pull-request/recipes
token: ${{ secrets.PAT_FOR_PR }}
title: 'Merge upstream recipe commits'
labels: automation