Skip to content

Build Metadata and Create PR #1

Build Metadata and Create PR

Build Metadata and Create PR #1

name: Build Metadata and Create PR
on:
workflow_dispatch: # Allows the workflow to be triggered manually
jobs:
run-script-and-create-pr:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# Step 2: Set up Python
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: '3.x'
# Step 3: Install dependencies (if any)
- name: Install dependencies
run: |
pip install -r requirements.txt
# Step 4: Run the Python script
- name: Run metadata generator script
run: |
python scripts/metadata-generator.py
# Step 5: Checkout the second repository to create the PR
- name: Checkout target repository
uses: actions/checkout@v3
with:
repository: Chrystinne/pr-metadata-generator
path: pr-repo
token: ${{ secrets.GITHUB_TOKEN }}
# Step 6: Copy the datasets folder to the target repo
- name: Copy datasets to target repo
run: |
cp -r datasets pr-repo/
# Step 7: Create a new branch in the target repo
- name: Create new branch
run: |
cd pr-repo
git checkout -b metadata-update-branch
# Step 8: Commit changes
- name: Commit changes
run: |
cd pr-repo
git add datasets
git commit -m "Add datasets from metadata generator"
# Step 9: Push the new branch
- name: Push changes
run: |
cd pr-repo
git push origin metadata-update-branch
# Step 10: Create a pull request
- name: Create pull request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Add datasets from metadata generator"
branch: metadata-update-branch
base: main
title: "Metadata update from Python script"
body: "This PR contains the datasets folder generated by the metadata-generator script."