Open1
GitHub Actionsでupstreamブランチを取り込むPull Requestを自動作成する
以下の記事に倣って意図的にコンフリクトマーカーごとコミットしている。
name: Create a pull request to merge upstream changes
on:
schedule:
- cron: "0 0 * * 6"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
create_pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- run: git config user.name "github-actions[bot]"
- run: git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- run: git remote add upstream https://github.com/user/repository.git
- run: git fetch upstream
- run: |
git merge --allow-unrelated-histories upstream/main || true
git commit -a -m "Merge upstream/main with conflicts"
- uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: upstream/main
delete-branch: true
title: "chore: Merge upstream changes"