Merge branch 'main' of https://github.com/metagov/oss-funding #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate DAOIP-5 Files and Create PR | |
on: | |
push: | |
paths: | |
- 'data/funders/**' # Trigger on changes in the funders folder | |
jobs: | |
generate_and_pr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Generate JSON files | |
run: | | |
# Detecting the updated/added folder in the funders directory | |
FOLDER_PATH=$(git diff --name-only HEAD^ HEAD | grep '^data/funders' | head -1 | xargs dirname) | |
# Running the main.py script with the detected path | |
python3 daoip-5/scripts/main.py --path "./$FOLDER_PATH" | |
- name: Commit generated files | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git add daoip-5/json | |
git commit -m "Auto-generated files for new/updated folder" | |
- name: Push changes and create PR | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
commit-message: Auto-generated DAOIP-5 files for new/updated folder | |
branch: auto-generated-pr | |
title: "Auto-generated DAOIP-5 files for new/updated folder" | |
body: "This PR contains files generated automatically." | |
base: main |