Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion .github/workflows/reusable-jira-pr_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ jobs:
(github.event.action == 'opened' ||
(github.event.action == 'synchronize' &&
github.event.pull_request.user.type == 'Bot' &&
github.event.sender.type == 'User') ||
(github.event.action == 'ready_for_review' &&
github.event.sender.type == 'User')) }}
runs-on: ubuntu-latest
timeout-minutes: 20
Expand Down Expand Up @@ -141,7 +143,9 @@ jobs:
> /dev/null

check_jira_issue:
if: ${{ needs.get_issue_key.result == 'success' }}
if: ${{ needs.get_issue_key.result == 'success' &&
!(github.event.action == 'ready_for_review' &&
github.event.sender.type == 'Bot') }}
runs-on: ubuntu-latest
timeout-minutes: 20
needs: get_issue_key
Expand Down Expand Up @@ -193,3 +197,33 @@ jobs:
echo -e $error
exit 1
fi

notify_force_push:
name: Notify force push on PR
runs-on: ubuntu-latest
timeout-minutes: 5
if: github.event.action == 'synchronize'
steps:
- name: Detect force push
id: detect
run: |
STATUS=$(gh api \
"repos/${{ github.repository }}/compare/${{ github.event.before }}...${{ github.event.after }}" \
--jq '.status' 2>/dev/null || echo "not_found")
echo "compare status: $STATUS"
if [[ "$STATUS" == "diverged" || "$STATUS" == "behind" || "$STATUS" == "not_found" ]]; then
echo "is_force_push=true" >> "$GITHUB_OUTPUT"
else
echo "is_force_push=false" >> "$GITHUB_OUTPUT"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Post force push warning comment
if: steps.detect.outputs.is_force_push == 'true'
run: |
gh pr comment ${{ github.event.pull_request.number }} \
--repo ${{ github.repository }} \
--body "⚠️ **Force push detected** - Previous Copilot review comments may no longer be relevant to the current code. Please resolve any outdated threads and re-request a Copilot review when ready."
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading