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: Create Pull Request in Another Repository | |
on: | |
# push: | |
# paths: 'releases' | |
push: | |
branches: | |
- ga_push | |
jobs: | |
create-pull-request: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v3 | |
# - name: Checking the last release | |
# run: | | |
# LAST_VERSION=$(ls -lt releases/ | grep ^d | head -1 | awk '{print $9}') | |
- name: Set up Git and cloning repository | |
env: | |
TARGET_REPO: djarecka/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 | |
# cd reproschema-py | |
git checkout -b release #_$LAST_VERSION | |
# - name: Clone target repository | |
# env: | |
# TARGET_REPO: djarecka/reproschema-py | |
# run: | | |
# git clone https://github.com/$TARGET_REPO.git | |
# cd reproschema-py | |
# git checkout -b release #_$LAST_VERSION | |
- name: Make changes to target repository | |
run: | | |
# TODO | |
LAST_VERSION=$(ls -lt releases/ | grep ^d | head -1 | awk '{print $9}') | |
echo "Last Version" | |
echo $LAST_VERSION | |
cp releases/$LAST_VERSION/reproschema.jsonld reproschema-py/reproschema.jsonld | |
cd reproschema-py | |
# Add your script or commands here to make changes to the repository | |
# For example, let's create a new file | |
#echo "Some changes" > new-file.txt | |
git add reproschema.jsonld | |
git commit -m "Add new file" | |
- name: Push changes to target repository | |
env: | |
TARGET_REPO: djarecka/reproschema-py | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
run: | | |
#cd your-target-repo | |
#git push --set-upstream https://x-access-token:${GITHUB_TOKEN}@github.com/$TARGET_REPO.git release | |
git push --set-upstream https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/$TARGET_REPO.git release | |
- name: Create pull request | |
env: | |
TARGET_REPO: djarecka/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 file", "head":"release", "base":"main"}' \ | |
https://api.github.com/repos/$TARGET_REPO/pulls |