Skip to content
Merged
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
20 changes: 12 additions & 8 deletions .github/workflows/enforce-pullrequest-rules.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
# This workflow enforces on every pull request that the PR is not based against master,
# taken from https://github.com/oppia/oppia-android/pull/2832/files
# taken from https://github.com/oppia/oppia-android/blob/develop/.github/workflows/static_checks.yml

name: "Enforce Pull-Request Rules"

on:
pull_request_target:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
pull_request:
push:
branches-ignore:
- develop
- master

jobs:
check:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
timeout-minutes: 10
steps:
- name: "Enforce develop branch"
if: ${{ github.event.pull_request.base.ref == 'master' && !contains(github.event.pull_request.labels.*.name, 'mastermerge') }}
- name: "Branch is not based on develop"
if: ${{ github.base_ref != 'develop' && !contains(github.event.pull_request.labels.*.name, 'mastermerge') }}
run: |
echo "This PR is based against the master branch and not a release or hotfix."
echo "Please don't do this. Switch the branch to 'develop'."
echo "Current base branch: $BASE_BRANCH"
echo "Note: PRs should only ever be merged into develop so please rebase your branch on develop and try again."
exit 1
env:
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
BASE_BRANCH: ${{ github.base_ref }}
Loading