Skip to content

Generate Contributors List and Push to Collabora Github IO #70

Generate Contributors List and Push to Collabora Github IO

Generate Contributors List and Push to Collabora Github IO #70

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