Skip to content

Commit 1998b62

Browse files
authored
testing: update "Enforce Pull-Request Rules" workflow (#3987)
With this update the workflow file from inside the feature branch is used, not the old stuff coming from `master` as before. This does not help for the currently failing job which still comes from `master` (we have to live with this until next release), but this will help in the future to prevent such errors. Tested this on my fork: - base against `develop`: workflow is skipped - base against `master`: workflow fails - base against `master` with label `mastermerge`: workflow is skipped I took this new workflow from the same repo where the previous workflows was taken (see diff for the link) so this is the further development.
1 parent e7ad361 commit 1998b62

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed
Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
# This workflow enforces on every pull request that the PR is not based against master,
2-
# taken from https://github.com/oppia/oppia-android/pull/2832/files
2+
# taken from https://github.com/oppia/oppia-android/blob/develop/.github/workflows/static_checks.yml
33

44
name: "Enforce Pull-Request Rules"
55

66
on:
7-
pull_request_target:
8-
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
7+
pull_request:
8+
push:
9+
branches-ignore:
10+
- develop
11+
- master
912

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

0 commit comments

Comments
 (0)