-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (51 loc) · 1.88 KB
/
pull-repos.yml
File metadata and controls
61 lines (51 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Pull External Repositories
on:
workflow_dispatch:
inputs:
repos_file:
description: 'Path to the TOML file containing repository configurations (default: repos.toml)'
required: false
default: 'repos.toml'
target_base_dir:
description: 'Base directory to clone/pull repositories into (default: . for repository root)'
required: false
default: '.'
permissions:
contents: write
jobs:
pull-repos:
runs-on: ubuntu-latest
steps:
- name: Checkout current repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install toml
- name: Process repositories
env:
REPOS_FILE: ${{ inputs.repos_file || 'repos.toml' }}
TARGET_BASE: ${{ inputs.target_base_dir }}
run: |
python3 .github/workflows/pull_repos_script.py
- name: Generate monorepo trees
run: |
python3 .github/workflows/monorepo_tree.py --root . --output-local LOCAL_TREE.md --output-online ONLINE_TREE.md
- name: Commit and push changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add "${{ inputs.target_base_dir }}" LOCAL_TREE.md ONLINE_TREE.md
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "Update external repositories [skip ci]" -m "Synced from workflow: ${{ github.run_number }}" -m "Generated monorepo trees"
git push origin HEAD:${{ github.ref_name }}
fi