mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-03 03:56:52 -04:00
ci: automate fork sync workflow
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
6620ae1c44
commit
71d052a0af
3 changed files with 112 additions and 0 deletions
49
.github/workflows/rebase-patches.yml
vendored
Normal file
49
.github/workflows/rebase-patches.yml
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
name: Rebase patches
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_run:
|
||||
workflows:
|
||||
- Sync upstream
|
||||
types:
|
||||
- completed
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: rebase-patches
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
rebase-patches:
|
||||
name: Rebase my-patches onto main
|
||||
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: my-patches
|
||||
|
||||
- name: Configure git
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
- name: Fetch main and patch branches
|
||||
run: |
|
||||
git fetch origin \
|
||||
+refs/heads/main:refs/remotes/origin/main \
|
||||
+refs/heads/my-patches:refs/remotes/origin/my-patches
|
||||
|
||||
git show-ref --verify --quiet refs/remotes/origin/main
|
||||
git show-ref --verify --quiet refs/remotes/origin/my-patches
|
||||
|
||||
- name: Rebase patch branch
|
||||
run: |
|
||||
git checkout my-patches
|
||||
git rebase refs/remotes/origin/main
|
||||
|
||||
- name: Push my-patches
|
||||
run: git push --force-with-lease origin my-patches
|
||||
45
.github/workflows/sync-upstream.yml
vendored
Normal file
45
.github/workflows/sync-upstream.yml
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
name: Sync upstream
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "17 * * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: sync-upstream
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
sync-main:
|
||||
name: Sync main from upstream
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: main
|
||||
|
||||
- name: Configure git
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
- name: Fetch upstream main
|
||||
run: |
|
||||
if git remote get-url upstream >/dev/null 2>&1; then
|
||||
git remote set-url upstream https://github.com/nvim-treesitter/nvim-treesitter.git
|
||||
else
|
||||
git remote add upstream https://github.com/nvim-treesitter/nvim-treesitter.git
|
||||
fi
|
||||
git fetch upstream +refs/heads/main:refs/remotes/upstream/main
|
||||
|
||||
- name: Rebase fork metadata onto upstream
|
||||
run: |
|
||||
git checkout main
|
||||
git rebase refs/remotes/upstream/main
|
||||
|
||||
- name: Push main
|
||||
run: git push --force-with-lease origin main
|
||||
Loading…
Add table
Add a link
Reference in a new issue