Skip to content

Commit

Permalink
ci(.github): 🛠 - 自动合并GitHub pages
Browse files Browse the repository at this point in the history
  • Loading branch information
jsxiaosi committed Dec 11, 2024
1 parent fa952a1 commit e74161c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Auto merge main into git-pages

on:
push:
branches:
- main
pull_request:
types: [closed]

permissions:
contents: write

jobs:
sync:
if: github.event.pull_request.merged == true || github.event_name == 'push'
runs-on: ubuntu-latest

steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Add git-pages remote
run: |
git remote add git-pages https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
- name: Fetch git-pages branch
run: git fetch origin git-pages:git-pages

- name: Checkout git-page branch
run: git checkout git-pages

- name: Merge main into git-pages
run: |
git merge main --no-ff -m "feat: ✨ Auto-merge main into git-pages"
- name: Push changes to git-pages
run: git push origin git-pages

- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v3
with:
event-type: git-pages-deploy
2 changes: 2 additions & 0 deletions .github/workflows/git-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- git-pages
repository_dispatch:
types: [git-pages-deploy]

jobs:
build:
Expand Down

0 comments on commit e74161c

Please sign in to comment.