-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto PR with Auto merge for syncing master-v2 (#1604)
* feat: auto pr for master-v2 * feat: auto merge pr's without conflicts
1 parent
b23471a
commit cbece84
Showing
2 changed files
with
69 additions
and
0 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,45 @@ | ||
name: Auto Merge PR without conflicts | ||
|
||
on: | ||
pull_request: | ||
branches: [ master-v2 ] | ||
|
||
jobs: | ||
auto-merge-pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Attach Label to PR | ||
run: | | ||
set -o xtrace | ||
curl -X PATCH "https://api.github.com/repos/omgnetwork/elixir-omg/issues/${{ github.event.pull_request.number }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-H "Authorization: token ${{ secrets.HOUSE_KEEPER_BOT_TOKEN }}" \ | ||
--data "{\"labels\": [\"sync master-v2\"]}" | ||
- name: Merge PR | ||
if: github.head_ref == 'master' | ||
run: | | ||
set -o xtrace | ||
function check_merge() { | ||
curl "https://api.github.com/repos/omgnetwork/elixir-omg/pulls/${{ github.event.pull_request.number }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-H "Authorization: token ${{ secrets.HOUSE_KEEPER_BOT_TOKEN }}" | | ||
jq -r '.mergeable' | ||
} | ||
until [ "$(check_merge)" = true -o "$(check_merge)" = false ]; do | ||
echo -n 'waiting...' | ||
sleep 10 | ||
done | ||
if [ "$(check_merge)" = true ]; then | ||
curl -X PUT "https://api.github.com/repos/omgnetwork/elixir-omg/pulls/${{ github.event.pull_request.number }}/merge" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-H "Authorization: token ${{ secrets.HOUSE_KEEPER_BOT_TOKEN }}" \ | ||
--data "{\"commit_title\": \"auto-merged ${{ github.event.pull_request.number }}\"}" | ||
else | ||
echo "PR unmerged" | ||
fi |
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,24 @@ | ||
name: Auto PR for syncing master to master-v2 | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
|
||
jobs: | ||
auto-pr-for-branch-syncing: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Create Pull Request | ||
run: | | ||
set -o xtrace | ||
readonly FROM_BRANCH="master" | ||
readonly TO_BRANCH="master-v2" | ||
readonly TITLE="sync: auto syncing from ${FROM_BRANCH} to ${TO_BRANCH}" | ||
readonly BODY="Time to sync \`${TO_BRANCH}\` with updates from \`${FROM_BRANCH}\`!" | ||
curl -X POST "https://api.github.com/repos/omgnetwork/elixir-omg/pulls" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-H "Authorization: token ${{ secrets.HOUSE_KEEPER_BOT_TOKEN }}" \ | ||
--data "{\"title\": \"${TITLE}\", \"head\": \"${FROM_BRANCH}\", \"base\": \"${TO_BRANCH}\", \"body\": \"${BODY}\"}" |