-
Notifications
You must be signed in to change notification settings - Fork 152
58 lines (50 loc) · 1.63 KB
/
cron-update-contributors.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
name: Update contributors
on:
schedule:
- cron: "0 11 * * *"
workflow_dispatch:
env:
new_files: false
jobs:
cron-update-contributors:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Node
uses: ./.github/actions/node
- name: Today date
run: echo "TODAY=$(date '+%Y-%m-%d')" >> $GITHUB_ENV
- name: Setup git identity
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Update contributors
run: |
yarn docs fetch:contributors
git add --all
if git diff-index --quiet HEAD; then
echo "No changes to contributors. Exiting."
echo "new_files=false" >> $GITHUB_ENV
else
git checkout -b docs/update-contributors
git commit -m "docs: update contributors"
git push origin docs/update-contributors
echo "new_files=true" >> $GITHUB_ENV
fi
env:
FIGMA_TOKEN: ${{ secrets.FIGMA_TOKEN }}
- name: Create PR
uses: actions/github-script@v6
if: env.new_files == 'true'
with:
script: |
github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: "chore: update contributors",
body: `- Automatically generated PR on ${process.env.TODAY}.\n- Updates contributors for docs`,
head: "docs/update-contributors",
base: "master",
maintainer_can_modify: true,
});