-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from fkfest/auto/from-devel-repo
Merge changes from development repository
- Loading branch information
Showing
11 changed files
with
519 additions
and
40 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# @author jphaupt | ||
name: Push changes to a public repository | ||
|
||
on: | ||
push: | ||
branches: | ||
- stable # branch on private that triggers action | ||
|
||
# edit these environment variables if you wish to use in a new project | ||
# note this depends on a separate workflow called build_and_test to exist | ||
# (this job does not run unless build_and_test is successful) | ||
env: | ||
BOT_TOKEN: ${{ secrets.PRIVATE_TO_PUBLIC_PAT }} # PAT for jph-bot | ||
TARGET_REPO: e-cojl | ||
TARGET_BRANCH: main | ||
SOURCE_REPO: e-cojl-devel | ||
SOURCE_BRANCH: stable | ||
|
||
jobs: | ||
push-changes: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: stable # unfortunately, cannot use env here, must change manually as well | ||
fetch-depth: 0 | ||
|
||
- name: clone $SOURCE_BRANCH repo | ||
run: | | ||
git clone https://fkfest:[email protected]/fkfest/$TARGET_REPO.git | ||
cd $TARGET_REPO | ||
git checkout -b auto/from-devel-repo | ||
git config user.name "actions-user" | ||
git config user.email "[email protected]" | ||
- name: pull changes into local copy of public repo from private repo | ||
run: | | ||
cd $TARGET_REPO | ||
git remote add source https://fkfest:[email protected]/fkfest/$SOURCE_REPO | ||
git fetch source $SOURCE_BRANCH | ||
- name: merge changes in public repo | ||
run: | | ||
cd $TARGET_REPO | ||
git merge source/$SOURCE_BRANCH --no-edit | ||
- name: publish new branch | ||
run: | | ||
cd $TARGET_REPO | ||
git push -u origin auto/from-devel-repo | ||
- name: Create Pull Request | ||
run: | | ||
cd $TARGET_REPO | ||
PR_TITLE="Merge changes from development repository" | ||
PR_BODY="This pull request merges changes from the private development repository and was automatically generated by GitHub Actions." | ||
PR_HEAD="auto/from-devel-repo" # branch with changes | ||
PR_BASE="$TARGET_BRANCH" | ||
PR_API_URL=$(curl --silent --request POST --url https://api.github.com/repos/fkfest/$TARGET_REPO/pulls \ | ||
--header "authorization: Bearer $BOT_TOKEN" \ | ||
--header "content-type: application/json" \ | ||
--data "{\"title\":\"$PR_TITLE\",\"body\":\"$PR_BODY\",\"head\":\"$PR_HEAD\",\"base\":\"$PR_BASE\"}" \ | ||
--write-out '%{url_effective}' \ | ||
--output /dev/null) | ||
PR_NUMBER=$(echo $PR_API_URL | cut -d / -f 8) | ||
echo "Pull Request #$PR_NUMBER created." |
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
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
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
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
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
Oops, something went wrong.