Skip to content

Commit

Permalink
Jin/count files (#129)
Browse files Browse the repository at this point in the history
* Create auto-pr-for-count-files.yml

* Create auto-merge-for-count-files.yml
  • Loading branch information
binary-ho authored Apr 19, 2024
1 parent 1a83d82 commit 9b8a418
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/auto-merge-for-count-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Auto Merge PRs

on:
pull_request:
types: [opened, synchronize]
branches:
- main

jobs:
auto-merge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Auto approve and merge if from bot/count-files branch
if: github.event.pull_request.head.ref == 'bot/count-files' && github.actor == 'github-actions[bot]'
run: |
echo "Approving and merging PR from bot/count-files branch"
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews \
-d '{"event":"APPROVE"}'
curl -X PUT -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/merge \
-d '{"commit_title":"${{ github.event.pull_request.title }}","merge_method":"merge"}'
20 changes: 20 additions & 0 deletions .github/workflows/auto-pr-for-count-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Auto PR to main

on:
push:
branches:
- bot/count-files

jobs:
build-and-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create Pull Request
uses: repo-sync/pull-request@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_branch: "main"
source_branch: "bot/count-files"
pr_title: "Automated PR to Main"
pr_body: "Update main branch with changes from develop."

0 comments on commit 9b8a418

Please sign in to comment.