Skip to content
Merged
Show file tree
Hide file tree
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
64 changes: 64 additions & 0 deletions .github/workflows/critical.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Check critical PRs

# run on every PR that have a label "critical"
# and the PR is not a draft
# if not critical, do nothing
# if critical, check that every member of the "CoreTeam" has reviewed the PR and approved it after the last commit

on:
pull_request_review:
types: [submitted, edited, dismissed]
pull_request:
types: [labeled, unlabeled, opened, reopened]

jobs:
request-review:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'critical') && !github.event.pull_request.draft

steps:
- name: Get team members
uses: actions/github-script@v6

with:
github-token: ${{ secrets.PAT_CI_TEST }}
script: |
const labelName = 'critical';
const teamSlug = 'coreteam';
const org = 'EngineSquared';

const teamMembers = await github.rest.teams.listMembersInOrg({
org: org,
team_slug: teamSlug
});

let reviews = await github.rest.pulls.listReviews({
owner: org,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number
});

const last_commit = await github.rest.pulls.get({
owner: org,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number
});

reviews.data = reviews.data.filter(review => review.commit_id === last_commit.data.head.sha);

const teamMemberNames = teamMembers.data.map(member => member.login);
const reviewers = reviews.data.map(review => review.user.login);
const author = context.payload.pull_request.user.login;
const missingReviewers = teamMemberNames.filter(member => member !== author).filter(member => !reviewers.includes(member));

if (missingReviewers.length > 0) {
for (const reviewer of missingReviewers) {
await github.rest.pulls.requestReviewers({
owner: org,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
reviewers: [reviewer]
});
}
throw new Error(`Need review from ${missingReviewers.join(', ')} before merging`);
}
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ If the pull request is related to a graphical feature, you have to add a screens

To meet the requirements of the project, the pull request has to be approved by the core team and have tests if applicable. (Look at [Testing Policies](#testing-policies) for more details)

> [!IMPORTANT]
> In the case your feature is "critical" (we don't have a definition of "critical" yet but for example, it can be a major feature or modification/addition of data inside CONTRIBUTING), you must add "critical" label to your pull request.
> If it's a draft, it will do nothing.
> If it's a final version, it will be automatically merged only if all the core team members approve it (and all other needed CI job succeed).
> When "critical" label is added, the Core teams will automatically be added as reviewers.

## Project structure

Currently, the project contains 2 main parts: the engine squared core and plugins, respectively located in `./src/engine` and `./src/plugin`.
Expand Down