Create pr_merge_conflict_check.py #2
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
name: Check PR Merge Conflicts | |
on: | |
push: | |
branches: | |
- 'develop' | |
# Allow manual triggering of the workflow | |
workflow_dispatch: | |
permissions: read-all | |
jobs: | |
check-pr-merge-conflicts: | |
name: Check PR Merge Conflicts | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Optional: If you need to merge develop branch or set up dependencies | |
- name: Merge develop branch and set up dependencies | |
uses: ./.github/actions/merge-develop-and-set-up-dependencies | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
- name: Check PR Merge Conflicts | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
python -m scripts.pr_merge_conflict_checker | |
# Optional: Failure notification for specific branch | |
- name: Report failure if failed on oppia/oppia develop branch | |
if: ${{ failure() && github.event_name == 'schedule' && github.repository == 'oppia/oppia' && github.ref == 'refs/heads/develop' }} | |
uses: ./.github/actions/send-webhook-notification | |
with: | |
message: "PR merge conflict check failed on the upstream develop branch." | |
webhook-url: ${{ secrets.BUILD_FAILURE_ROOM_WEBHOOK_URL }} |