-
-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (63 loc) · 2.66 KB
/
issue.yml
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
name: Create RSS
on:
issues:
types: [labeled]
jobs:
create-rss:
if: github.repository == 'jaywcjlove/quick-rss' && github.event_name == 'issues' && contains(github.event.issue.labels.*.name, 'weekly')
runs-on: ubuntu-latest
steps:
- name: Get the label modifier
run: |
MODIFIER=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/events" \
| jq -r '[.[] | select(.event == "labeled" and .label.name == "weekly")] | last | .actor.login')
echo "Label modifier: $MODIFIER"
# 将修改者 login 写入环境变量
echo "MODIFIER=$MODIFIER" >> $GITHUB_ENV
- uses: actions/checkout@v4
if: env.MODIFIER == 'jaywcjlove'
- uses: actions/setup-node@v4
if: env.MODIFIER == 'jaywcjlove'
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- run: npm install
if: env.MODIFIER == 'jaywcjlove'
- name: Create RSS
run: node .github/scripts/create-rss.mjs
# 判断是不是仓库作者更新的 label,并且判断是否包含 weekly
if: env.MODIFIER == 'jaywcjlove'
env:
ISSUE_BODY: ${{ github.event.issue.body }}
ISSUE_LINK: ${{ github.event.issue.html_url }}
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_ID: ${{ github.event.issue.number }}
ISSUE_DATE: ${{ github.event.issue.created_at }}
ISSUE_AUTHOR: ${{ github.event.issue.user.login }}
ISSUE_AVATAR: ${{ github.event.issue.user.avatar_url }}
- name: Commit changes
if: env.MODIFIER == 'jaywcjlove'
env:
ISSUE_ID: ${{ github.event.issue.number }}
ISSUE_TITLE: ${{ github.event.issue.title }}
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
# 获取当前分支名称
CURRENT_BRANCH=$(echo ${GITHUB_REF#refs/heads/})
git add .
git commit -m "Quick RSS Feed: $ISSUE_TITLE #$ISSUE_ID" -m "https://wangchujiang.com/quick-rss/issue/$ISSUE_ID.html"
git push origin $CURRENT_BRANCH
- name: Trigger Deploy
uses: actions/github-script@v7
if: env.MODIFIER == 'jaywcjlove'
with:
script: |
const res = await github.rest.repos.createDispatchEvent({
owner: 'jaywcjlove',
repo: 'quick-rss',
event_type: 'run-deploy'
});
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}