Update the recipes #110
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Merge upstream recipes | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 8 * * 5' | |
jobs: | |
pr: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
base_ref: | |
- akirak | |
upstream: | |
- 'https://github.com/melpa/melpa.git' | |
upstream_branch: | |
- 'master' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
sparse-checkout: '.' | |
ref: ${{ matrix.base_ref }} | |
- name: Switch to a work branch | |
id: start | |
run: | | |
echo "rev=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | |
- name: Install git-filter-repo | |
run: | | |
sudo apt-get update && sudo apt-get install git-filter-repo --yes | |
- name: Fetch the upstream | |
run: | | |
git remote add upstream ${{ matrix.upstream }} | |
git fetch upstream ${{ matrix.upstream_branch }} | |
- 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 }} ${{ matrix.base_ref }}) | |
echo "rev=$rev" > "$GITHUB_OUTPUT" | |
- name: Filter commits | |
run: | | |
git switch -C upstream-recipes upstream/${{ matrix.upstream_branch }} | |
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: Cherry-pick the filtered commits | |
run: | | |
git switch ${{ matrix.base_ref }} | |
git cherry-pick --strategy ort -X theirs ..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 |