feat(ci): create doc PRs, maybe?

This commit is contained in:
rektdeckard
2024-12-28 21:50:33 -07:00
committed by Tobias Fried
parent 5a390a9231
commit a4421c82b2
6 changed files with 145 additions and 3 deletions

View File

@@ -3,6 +3,10 @@ name: Build and deploy to preview
on:
push
concurrency:
group: 'preview'
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
@@ -13,6 +17,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Install Node.js

View File

@@ -5,6 +5,10 @@ on:
branches:
- master
concurrency:
group: 'prod'
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
@@ -15,6 +19,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Install Node.js

88
.github/workflows/sync-docs.yaml vendored Normal file
View File

@@ -0,0 +1,88 @@
name: Sync README links section
on:
push:
paths:
- 'README.md'
# branches:
# - main
# - master
workflow_dispatch: # Allows manual triggering
concurrency:
group: 'docs'
cancel-in-progress: true
env:
# List of target repositories to sync to
TARGET_REPOS: >-
phosphor-icons/core
phosphor-icons/figma
phosphor-icons/flutter
phosphor-icons/penpot
phosphor-icons/phosphor-elm
phosphor-icons/play
phosphor-icons/react
phosphor-icons/sketch
phosphor-icons/swift
phosphor-icons/theme
phosphor-icons/unplugin
phosphor-icons/vue
phosphor-icons/web
phosphor-icons/webcomponents
jobs:
sync-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Sync to target repositories
env:
GH_TOKEN: ${{ github.token }}
run: |
echo "$TARGET_REPOS" | while read repo; do
echo "Syncing to $repo"
# Clone target repository
gh repo clone $repo target-repo
# Run sync script
pnpm run sync-docs -- "$repo"
# Create PR if there are changes
cd target-repo
if [[ -n "$(git status --porcelain)" ]]; then
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Create branch
BRANCH="sync-readme-$(date +%Y%m%d-%H%M%S)"
git checkout -b $BRANCH
# Commit and push changes
git add README.md
git commit -m "Sync README section from master repository"
git push origin $BRANCH
# Create PR
gh pr create \
--title "Sync README section" \
--body "Automated PR to sync README section from master repository" \
--base main
fi
cd ..
rm -rf target-repo
done