Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create contributor_fetch.yml #10126

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/contributor_fetch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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.GITHUB_TOKEN }} # Use the GitHub 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
Loading