-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Neha Singh
committed
Mar 8, 2024
1 parent
574c6a5
commit e4262af
Showing
1 changed file
with
46 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,46 @@ | ||
name: Rebase reminder | ||
on: [pull_request, pull_request_review] | ||
|
||
jobs: | ||
build: | ||
name: rebuild-reminder | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: 'read' | ||
pull-requests: 'write' | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Find behind count | ||
id: behind_count | ||
run: | | ||
echo "behind_count=$(git rev-list --count ${{ github.event.pull_request.head.sha }}..${{ github.event.pull_request.base.sha }})" >> $GITHUB_OUTPUT | ||
- name: Find ahead count | ||
id: ahead_count | ||
run: | | ||
echo "ahead_count=$(git rev-list --count ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }})" >> $GITHUB_OUTPUT | ||
- name: Find combined count | ||
id: combined_count | ||
run: | | ||
echo "combined_count=$(expr ${{steps.behind_count.outputs.behind_count}} + ${{steps.ahead_count.outputs.ahead_count}})" >> $GITHUB_OUTPUT | ||
- name: Edit PR comment - rebasing | ||
if: steps.behind_count.outputs.behind_count > 0 && steps.combined_count.outputs.combined_count > 3 | ||
uses: thollander/actions-comment-pull-request@v2 | ||
with: | ||
message: | | ||
Needs rebasing :bangbang: | ||
behind_count is ${{ steps.behind_count.outputs.behind_count }} | ||
ahead_count is ${{ steps.ahead_count.outputs.ahead_count }} | ||
comment_tag: rebasing | ||
- name: Edit PR comment - no rebasing | ||
if: steps.behind_count.outputs.behind_count == 0 || steps.combined_count.outputs.combined_count <= 3 | ||
uses: thollander/actions-comment-pull-request@v2 | ||
with: | ||
message: | | ||
No need for rebasing :+1: | ||
behind_count is ${{ steps.behind_count.outputs.behind_count }} | ||
ahead_count is ${{ steps.ahead_count.outputs.ahead_count }} | ||
comment_tag: rebasing |