-
Notifications
You must be signed in to change notification settings - Fork 722
58 lines (47 loc) · 2.16 KB
/
contributor_fetch.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: Generate Contributors List and Push to Collabora Github IO
# This will run the workflow every day at 3:00 UTC
on:
schedule:
- cron: '0 3 * * *' # This sets the cron job to run daily at 3 AM UTC
# Allows the workflow to be triggered manually as well
workflow_dispatch:
jobs:
generate-contributors:
runs-on: ubuntu-latest
steps:
- name: Checkout main repository
uses: actions/checkout@v3
with:
repository: CollaboraOnline/online # Specify the main repo
ref: master # Ensure we check out the master branch
# Fetch the latest changes from the remote repository
- name: Fetch latest changes
run: git pull origin master # Pull the latest changes from master
# Step to run the script and generate the contributors.md file
- name: Install Node.js and dependencies
uses: actions/setup-node@v3
with:
node-version: '18' # Adjust the Node.js version if needed
- run: npm install node-fetch@2 # Ensure node-fetch v2 is installed
- run: node scripts/contributors-credit.js # Run the script that generates `contributors.md`
# Step to commit and push the generated markdown file to the GitHub IO repository
- name: Checkout GitHub IO Repo
uses: actions/checkout@v3
with:
repository: CollaboraOnline/CollaboraOnline.github.io # Target GitHub Pages repository
token: ${{ secrets.GENERATE_CONTRIBUTORS }} # Use the GitHub(Personal access token) token for authentication
path: repo # Specify the path for the repo checkout
- name: Copy generated file to GitHub IO repo
run: |
cp contributors.md repo/content/post/contributors.md # Copy to the desired path
- name: Commit changes
run: |
cd repo
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
git add content/post/contributors.md
git commit -m "Update contributors list" --signoff # Add sign-off to the commit
- name: Push changes
run: |
cd repo
git push origin master # Push to master branch