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

[WIP] adding GA to create a PR to reproschema-py #519

Merged
merged 2 commits into from
Jun 20, 2024
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
50 changes: 50 additions & 0 deletions .github/workflows/push_reproschema_py.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Create Pull Request in Another Repository
on:
workflow_dispatch:
inputs:
version:
description: 'version number'
required: true
type: string

jobs:
create-pull-request:
runs-on: ubuntu-latest

steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Set up Git and cloning repository
env:
TARGET_REPO: repronim/reproschema-py
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
git config --global user.name "djarecka"
git config --global user.email "[email protected]"
git clone https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/$TARGET_REPO.git
- name: Make changes to target repository
id: changes
run: |
cp releases/${{ inputs.version }}/reproschema.jsonld reproschema-py/reproschema.jsonld
cd reproschema-py
git checkout -b release_${{ inputs.version }}
# TODO: change to pydantic model
# TODO: a script to change CONTEXTFILE_URL can be added
git add reproschema.jsonld
git commit -m "Add new version of the model"
cd ..
- name: Push changes to target repository
env:
TARGET_REPO: repronim/reproschema-py
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
cd reproschema-py
git push origin release_${{ inputs.version }}
- name: Create pull request
env:
TARGET_REPO: repronim/reproschema-py
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
curl -X POST -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-d '{"title":"Automated PR: Add new version of the model: ${{ inputs.version }}", "head":"release_${{ inputs.version }}", "base":"main"}' \
https://api.github.com/repos/$TARGET_REPO/pulls
Loading