-
Notifications
You must be signed in to change notification settings - Fork 21
53 lines (51 loc) · 2.26 KB
/
push_reproschema_py.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Create Pull Request to reproschema-py
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@v4
- 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 "djarecka@gmail.com"
git clone https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/$TARGET_REPO.git
- name: Make changes to target repository
id: changes
run: |
# updating pydantic model
cp releases/${{ inputs.version }}/reproschema_model.py reproschema-py/reproschema/models/model.py
cd reproschema-py
# updating url to context
echo "# this is automatically updated after reproschema new release" > reproschema/context_url.py
echo "CONTEXTFILE_URL = 'https://raw.githubusercontent.com/ReproNim/reproschema/main/releases/${{ inputs.version }}/reproschema'" >> reproschema/context_url.py
git checkout -b release_${{ inputs.version }}
git add reproschema/models/model.py
git add reproschema/context_url.py
git commit -m "Add new version of the pydantic model and new context url"
cd ..
- name: Push changes to reproschema-py
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 to reproschema-py
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