Skip to content

Commit

Permalink
Add workflow to build metadata and create PR.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chrystinne committed Oct 3, 2024
1 parent 698c591 commit 7c9ce13
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/build-metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
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."

0 comments on commit 7c9ce13

Please sign in to comment.