Skip to content

Commit

Permalink
chore: fix mergify conditions (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chriscbr authored Jan 4, 2024
1 parent 3109a0f commit 692e5ae
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 10 deletions.
52 changes: 50 additions & 2 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,31 @@ pull_request_rules:
- check-success=Validate PR title
- check-success=build
- base=main
- check-success=Validate PR title
- or:
- check-success=bedrock-pull / build
- check-skipped=bedrock-pull / build
- or:
- check-success=checks-pull / build
- check-skipped=checks-pull / build
- or:
- check-success=containers-pull / build
- check-skipped=containers-pull / build
- or:
- check-success=fifoqueue-pull / build
- check-skipped=fifoqueue-pull / build
- or:
- check-success=github-pull / build
- check-skipped=github-pull / build
- or:
- check-success=postgres-pull / build
- check-skipped=postgres-pull / build
- or:
- check-success=redis-pull / build
- check-skipped=redis-pull / build
- or:
- check-success=websockets-pull / build
- check-skipped=websockets-pull / build
- name: requires manual merge
conditions:
- files=.mergify.yml
Expand All @@ -43,9 +68,32 @@ pull_request_rules:
- "#changes-requested-reviews-by=0"
- "#review-threads-unresolved=0"
- -approved-reviews-by~=author
- check-success=Validate PR title
- check-success=build
- base=main
- check-success=Validate PR title
- or:
- check-success=bedrock-pull / build
- check-skipped=bedrock-pull / build
- or:
- check-success=checks-pull / build
- check-skipped=checks-pull / build
- or:
- check-success=containers-pull / build
- check-skipped=containers-pull / build
- or:
- check-success=fifoqueue-pull / build
- check-skipped=fifoqueue-pull / build
- or:
- check-success=github-pull / build
- check-skipped=github-pull / build
- or:
- check-success=postgres-pull / build
- check-skipped=postgres-pull / build
- or:
- check-success=redis-pull / build
- check-skipped=redis-pull / build
- or:
- check-success=websockets-pull / build
- check-skipped=websockets-pull / build
actions:
comment:
message: Thank you for contributing! Your pull request contains mergify
Expand Down
5 changes: 4 additions & 1 deletion generate-workflows.main.w
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ let workflowdir = ".github/workflows";
fs.remove(".github/workflows");
fs.mkdir(".github/workflows");

let libs = MutArray<str>[];

for file in fs.readdir(".") {
if !fs.exists("{file}/package.json") {
log("skipping {file}");
continue;
}

new l.Library(workflowdir, file) as file;
libs.push(file);
}

new stale.StaleWorkflow(workflowdir);
new mergify.MergifyWorkflow();
new mergify.MergifyWorkflow(libs.copy());
new prlint.PullRequestLintWorkflow(workflowdir);
23 changes: 16 additions & 7 deletions mergify.w
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
bring fs;

pub class MergifyWorkflow {
new() {
new(libs: Array<str>) {
let buildChecks = MutArray<Json>[];
buildChecks.push("check-success=Validate PR title");
for lib in libs {
buildChecks.push(Json {
"or": [
"check-success={lib}-pull / build",
"check-skipped={lib}-pull / build",
]
});
}

fs.writeYaml(".mergify.yml", {
"queue_rules": [
{
Expand All @@ -25,7 +36,7 @@ pub class MergifyWorkflow {
"commit_message_template": "\{\{ title \}\} (#\{\{ number \}\})\n\{\{ body \}\}"
}
},
"conditions": [
"conditions": Array<Json>[
"-files=.mergify.yml",
"-title~=(?i)wip",
"-label~=(🚧 pr/do-not-merge|⚠️ pr/review-mutation)",
Expand All @@ -39,11 +50,11 @@ pub class MergifyWorkflow {
"check-success=Validate PR title",
"check-success=build",
"base=main",
]
].concat(buildChecks.copy())
},
{
"name": "requires manual merge",
"conditions": [
"conditions": Array<Json>[
"files=.mergify.yml",
"-title~=(?i)wip",
"-label~=(🚧 pr/do-not-merge|⚠️ pr/review-mutation|⚠️ mergify/review-config)",
Expand All @@ -53,10 +64,8 @@ pub class MergifyWorkflow {
"#changes-requested-reviews-by=0",
"#review-threads-unresolved=0",
"-approved-reviews-by~=author",
"check-success=Validate PR title",
"check-success=build",
"base=main"
],
].concat(buildChecks.copy()),
"actions": {
"comment": {
"message": "Thank you for contributing! Your pull request contains mergify configuration changes and needs manual merge from a maintainer (be sure to [allow changes to be pushed to your fork](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork))."
Expand Down

0 comments on commit 692e5ae

Please sign in to comment.