-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (95 loc) · 3.3 KB
/
Copy pathfetch-issues.yml
File metadata and controls
109 lines (95 loc) · 3.3 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Fetch GitHub Issues
on:
schedule:
# 每2小时运行一次
- cron: '0 */2 * * *'
workflow_dispatch:
inputs:
org:
description: 'GitHub Organization to fetch issues from'
required: false
default: 'variableway'
jobs:
fetch-issues:
runs-on: ubuntu-latest
permissions:
contents: write
issues: read
steps:
# 本仓库 checkout 到 apps/innate-wip,与 innate-base monorepo 中的位置一致
- name: Checkout repository
uses: actions/checkout@v4
with:
path: apps/innate-wip
# workspace 依赖直接引用 ../../packages/{ui,utils,tsconfig}(innate-base monorepo 根目录),
# 需要从私有仓库 variableway/innate-fe-templates 稀疏检出共享包。
# 需要在本仓库 Settings → Secrets 中配置 INNATE_BASE_TOKEN(对该私有仓库有 read 权限的 PAT)。
- name: Checkout innate-base shared packages
uses: actions/checkout@v4
with:
repository: variableway/innate-fe-templates
token: ${{ secrets.INNATE_BASE_TOKEN }}
path: .innate-base
sparse-checkout: |
packages/ui
packages/utils
packages/tsconfig
- name: Restore monorepo layout
run: |
mv .innate-base/packages packages
rm -rf .innate-base
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
cache-dependency-path: apps/innate-wip/pnpm-lock.yaml
- name: Install dependencies
run: |
cd apps/innate-wip
pnpm install --no-frozen-lockfile
- name: Fetch projects from GitHub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ORG: ${{ github.event.inputs.org || 'variableway' }}
run: |
cd apps/innate-wip/apps/web
node scripts/fetch-projects.js
- name: Fetch AGENTS.md from GitHub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ORG: ${{ github.event.inputs.org || 'variableway' }}
run: |
cd apps/innate-wip/apps/web
node scripts/fetch-agents.js
- name: Fetch issues from GitHub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ORG: ${{ github.event.inputs.org || 'variableway' }}
run: |
cd apps/innate-wip/apps/web
node scripts/fetch-issues.js
- name: Generate weekly summary
run: |
cd apps/innate-wip/apps/web
node scripts/generate-weekly.js
- name: Check for changes
id: check-changes
run: |
cd apps/innate-wip
if git diff --quiet apps/web/data/; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: steps.check-changes.outputs.has_changes == 'true'
run: |
cd apps/innate-wip
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add apps/web/data/
git commit -m "Update issues data [$(date -u +%Y-%m-%d-%H:%M)]"
git push