Skip to content

Commit

Permalink
chore: replace mergify with automerge workflow (#363)
Browse files Browse the repository at this point in the history
Signed-off-by: team-tf-cdk <[email protected]>
Co-authored-by: team-tf-cdk <[email protected]>
Co-authored-by: Daniel Schmidt <[email protected]>
  • Loading branch information
3 people authored Dec 7, 2023
1 parent a8c19f6 commit 00929b2
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 232 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/automerge.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

import { cdk } from "projen";
import { UpgradeDependenciesSchedule } from "projen/lib/javascript";
import { Automerge } from "./projenrc/automerge";
import { UpgradeNode } from "./projenrc/upgrade-node";
import { AutoApprove } from "./src/auto-approve";
import { Automerge } from "./src/automerge";
import { CustomizedLicense } from "./src/customized-license";
import { LockIssues } from "./src/lock-issues";

Expand Down
2 changes: 1 addition & 1 deletion projenrc/automerge.ts → src/automerge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class Automerge {
workflow.addJobs({
automerge: {
runsOn: ["ubuntu-latest"],
if: "contains(github.event.pull_request.labels.*.name, 'automerge') && github.event.pull_request.draft == false",
if: "contains(github.event.pull_request.labels.*.name, 'automerge') && !contains(github.event.pull_request.labels.*.name, 'do-not-merge') && github.event.pull_request.draft == false",
steps: [
{
name: "Checkout",
Expand Down
49 changes: 6 additions & 43 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { UpgradeDependenciesSchedule } from "projen/lib/javascript";
import { AlertOpenPrs } from "./alert-open-prs";
import { AutoApprove } from "./auto-approve";
import { AutoCloseCommunityIssues } from "./auto-close-community-issues";
import { Automerge } from "./automerge";
import { CdktfConfig } from "./cdktf-config";
import { CopyrightHeaders } from "./copyright-headers";
import { CustomizedLicense } from "./customized-license";
Expand Down Expand Up @@ -235,42 +236,6 @@ export class CdktfProviderProject extends cdk.JsiiProject {
email: "[email protected]",
},
minMajorVersion: MIN_MAJOR_VERSION,
githubOptions: {
mergify: true,
mergifyOptions: {
rules: [
{
name: "Automatically approve PRs with automerge label",
actions: {
review: {
type: "APPROVE",
message: "Automatically approved due to label",
},
},
conditions: [
"label=automerge",
"-label~=(do-not-merge)",
"-draft",
"author=team-tf-cdk",
],
},
{
name: "Automatically close stale PRs",
actions: {
close: {
message:
"Closing this automatic PR, if it has not merged there is most likely a CI or CDKTF issue preventing it from merging",
},
},
conditions: [
"author=team-tf-cdk",
"-draft",
"created-at<1 day ago",
],
},
],
},
},
stale: true,
staleOptions: {
issues: {
Expand All @@ -285,13 +250,10 @@ export class CdktfProviderProject extends cdk.JsiiProject {
},
pullRequest: {
staleLabel: "stale",
daysBeforeStale: 14,
staleMessage:
"14 days have passed since this PR was opened, and I assume other builds have succeeded in the meantime. " +
"If no one removes the `stale` label or comments, I'm going to auto-close this PR in 7 days.",
daysBeforeClose: 7,
closeMessage:
"I'm closing this PR automatically with the assumption that other builds have succeeded in the meantime.",
daysBeforeStale: 1,
staleMessage: `Closing this PR, if it has not merged there is most likely a CI or CDKTF issue preventing it from merging. If this has been a manual PR, please reopen it and add the \`no-auto-close\` label to prevent this from happening again.`,
daysBeforeClose: 0,
exemptLabels: ["no-auto-close"],
},
},
docgen: false,
Expand Down Expand Up @@ -365,6 +327,7 @@ export class CdktfProviderProject extends cdk.JsiiProject {
new GithubIssues(this, { providerName });
new AutoApprove(this);
new AutoCloseCommunityIssues(this, { providerName });
new Automerge(this);
new LockIssues(this);
new NextVersionPr(this, "${{ secrets.GITHUB_TOKEN }}");
new AlertOpenPrs(this, {
Expand Down
Loading

0 comments on commit 00929b2

Please sign in to comment.