-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add mergify and pr lint workflows (#41)
- Loading branch information
Showing
6 changed files
with
199 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Pull Request Lint | ||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
- edited | ||
branches-ignore: | ||
- mergify/merge-queue/* | ||
jobs: | ||
validate: | ||
name: Validate PR title | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
types: |- | ||
feat | ||
fix | ||
docs | ||
chore | ||
rfc | ||
revert | ||
subjectPattern: ^[^A-Z][^:]+[^.]$ | ||
subjectPatternError: Subject must start with a lowercase, should not include ':' | ||
and should not end with a period | ||
requireScope: false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,6 @@ jobs: | |
- name: Test | ||
run: wing test | ||
working-directory: redis | ||
- name: Pack | ||
run: wing pack | ||
working-directory: redis |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
queue_rules: | ||
- name: default | ||
speculative_checks: 2 | ||
conditions: | ||
- -files=.mergify.yml | ||
pull_request_rules: | ||
- name: automatic merge | ||
actions: | ||
comment: | ||
message: > | ||
Thanks for contributing, @{{author}}! This PR will now be added to the | ||
[merge queue](https://mergify.com/merge-queue), or immediately merged | ||
if `{{head}}` is up-to-date with `{{base}}` and the queue is empty. | ||
queue: | ||
name: default | ||
method: squash | ||
commit_message_template: |- | ||
{{ title }} (#{{ number }}) | ||
{{ body }} | ||
conditions: | ||
- -files=.mergify.yml | ||
- -title~=(?i)wip | ||
- -label~=(🚧 pr/do-not-merge|⚠️ pr/review-mutation) | ||
- -merged | ||
- -closed | ||
- branch-protection-review-decision=APPROVED | ||
- "#approved-reviews-by>=1" | ||
- "#changes-requested-reviews-by=0" | ||
- "#review-threads-unresolved=0" | ||
- -approved-reviews-by~=author | ||
- check-success=Validate PR title | ||
- base=main | ||
- name: requires manual merge | ||
conditions: | ||
- files=.mergify.yml | ||
- -title~=(?i)wip | ||
- -label~=(🚧 pr/do-not-merge|⚠️ pr/review-mutation|⚠️ | ||
mergify/review-config) | ||
- -merged | ||
- -closed | ||
- "#approved-reviews-by>=1" | ||
- "#changes-requested-reviews-by=0" | ||
- "#review-threads-unresolved=0" | ||
- -approved-reviews-by~=author | ||
- check-success=Validate PR title | ||
- base=main | ||
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)). | ||
label: | ||
add: | ||
- ⚠️ mergify/review-config |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
bring fs; | ||
|
||
pub class MergifyWorkflow { | ||
new() { | ||
fs.writeYaml(".mergify.yml", { | ||
"queue_rules": [ | ||
{ | ||
"name": "default", | ||
"speculative_checks": 2, | ||
"conditions": [ | ||
"-files=.mergify.yml", | ||
] | ||
} | ||
], | ||
"pull_request_rules": [ | ||
{ | ||
"name": "automatic merge", | ||
"actions": { | ||
"comment": { | ||
"message": "Thanks for contributing, @\{\{author\}\}! This PR will now be added to the [merge queue](https://mergify.com/merge-queue), or immediately merged if `\{\{head\}\}` is up-to-date with `\{\{base\}\}` and the queue is empty.\n" | ||
}, | ||
"queue": { | ||
"name": "default", | ||
"method": "squash", | ||
"commit_message_template": "\{\{ title \}\} (#\{\{ number \}\})\n\{\{ body \}\}" | ||
} | ||
}, | ||
"conditions": [ | ||
"-files=.mergify.yml", | ||
"-title~=(?i)wip", | ||
"-label~=(🚧 pr/do-not-merge|⚠️ pr/review-mutation)", | ||
"-merged", | ||
"-closed", | ||
"branch-protection-review-decision=APPROVED", | ||
"#approved-reviews-by>=1", | ||
"#changes-requested-reviews-by=0", | ||
"#review-threads-unresolved=0", | ||
"-approved-reviews-by~=author", | ||
"check-success=Validate PR title", | ||
"base=main", | ||
] | ||
}, | ||
{ | ||
"name": "requires manual merge", | ||
"conditions": [ | ||
"files=.mergify.yml", | ||
"-title~=(?i)wip", | ||
"-label~=(🚧 pr/do-not-merge|⚠️ pr/review-mutation|⚠️ mergify/review-config)", | ||
"-merged", | ||
"-closed", | ||
"#approved-reviews-by>=1", | ||
"#changes-requested-reviews-by=0", | ||
"#review-threads-unresolved=0", | ||
"-approved-reviews-by~=author", | ||
"check-success=Validate PR title", | ||
"base=main" | ||
], | ||
"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))." | ||
}, | ||
"label": { | ||
"add": [ | ||
"⚠️ mergify/review-config" | ||
] | ||
}, | ||
} | ||
} | ||
] | ||
}); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
bring fs; | ||
|
||
pub class PullRequestLintWorkflow { | ||
new(workflowdir: str) { | ||
fs.writeYaml("{workflowdir}/pull-request-lint.yaml", { | ||
name: "Pull Request Lint", | ||
on: { | ||
pull_request_target: { | ||
types: ["opened", "synchronize", "reopened", "edited"], | ||
"branches-ignore": ["mergify/merge-queue/*"], | ||
}, | ||
}, | ||
"jobs": { | ||
"validate": { | ||
"name": "Validate PR title", | ||
"runs-on": "ubuntu-latest", | ||
"steps": [ | ||
{ | ||
"uses": "amannn/[email protected]", | ||
"env": { | ||
"GITHUB_TOKEN": "$\{\{ secrets.GITHUB_TOKEN \}\}" | ||
}, | ||
"with": { | ||
"types": "feat\nfix\ndocs\nchore\nrfc\nrevert", | ||
"subjectPattern": "^[^A-Z][^:]+[^.]$", | ||
"subjectPatternError": "Subject must start with a lowercase, should not include ':' and should not end with a period", | ||
"requireScope": false | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}); | ||
} | ||
} |