chore(ci): use matrix for repo list
This commit is contained in:
committed by
Tobias Fried
parent
74811edda7
commit
3f25a8aa88
14
.github/sync-repos.txt
vendored
14
.github/sync-repos.txt
vendored
@@ -1,14 +0,0 @@
|
|||||||
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
|
|
||||||
54
.github/workflows/sync-docs.yaml
vendored
54
.github/workflows/sync-docs.yaml
vendored
@@ -15,6 +15,24 @@ concurrency:
|
|||||||
jobs:
|
jobs:
|
||||||
sync-docs:
|
sync-docs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
repository: [
|
||||||
|
'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'
|
||||||
|
]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -34,24 +52,23 @@ jobs:
|
|||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
cache-dependency-path: source-repo/pnpm-lock.yaml
|
cache-dependency-path: source-repo/pnpm-lock.yaml
|
||||||
|
|
||||||
- name: Read repository list
|
- name: Install dependencies
|
||||||
id: repo-list
|
working-directory: source-repo
|
||||||
run: |
|
run: pnpm install
|
||||||
echo "repos<<EOF" >> $GITHUB_OUTPUT
|
|
||||||
cat source-repo/.github/sync-repos.txt >> $GITHUB_OUTPUT
|
|
||||||
echo "EOF" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Sync to target repositories
|
- name: Sync to target repositories
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GITHUB_TOKEN: ${{ secrets.SYNC_PAT }}
|
||||||
run: |
|
run: |
|
||||||
for repo in ${{ steps.repo-list.outputs.repos }}; do
|
echo "Syncing to ${{ matrix.repository }}"
|
||||||
echo "Syncing to $repo"
|
|
||||||
# Clone target repository
|
# Clone target repository using HTTPS with token
|
||||||
gh repo clone $repo target-repo
|
git clone "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ matrix.repository }}.git" target-repo
|
||||||
|
|
||||||
# Run sync script
|
# Run sync script
|
||||||
pnpm run sync-docs -- "$repo"
|
cd source-repo
|
||||||
|
pnpm run sync-docs -- target-repo
|
||||||
|
cd ..
|
||||||
|
|
||||||
# Create PR if there are changes
|
# Create PR if there are changes
|
||||||
cd target-repo
|
cd target-repo
|
||||||
@@ -65,15 +82,14 @@ jobs:
|
|||||||
|
|
||||||
# Commit and push changes
|
# Commit and push changes
|
||||||
git add README.md
|
git add README.md
|
||||||
git commit -m "Sync README section from master repository"
|
git commit -m "chore(docs): sync readme section"
|
||||||
git push origin $BRANCH
|
git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ matrix.repository }}.git" $BRANCH
|
||||||
|
|
||||||
# Create PR
|
# Create PR using the GitHub CLI
|
||||||
gh pr create \
|
gh pr create \
|
||||||
|
--repo "${{ matrix.repository }}" \
|
||||||
--title "chore(docs): sync readme section" \
|
--title "chore(docs): sync readme section" \
|
||||||
--body "Automated PR to sync README section from master repository" \
|
--body "Automated PR to sync README section from master repository" \
|
||||||
--base main
|
--base main \
|
||||||
|
--head $BRANCH
|
||||||
fi
|
fi
|
||||||
cd ..
|
|
||||||
rm -rf target-repo
|
|
||||||
done
|
|
||||||
|
|||||||
Reference in New Issue
Block a user