Skip to content

Commit

Permalink
Merge branch 'main' into change-license
Browse files Browse the repository at this point in the history
  • Loading branch information
xiehan authored Dec 22, 2022
2 parents f91e53c + 0ad4acc commit 7347170
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitattributes

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

4 changes: 2 additions & 2 deletions .github/workflows/build.yml

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

19 changes: 19 additions & 0 deletions .github/workflows/lock.yml

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

30 changes: 30 additions & 0 deletions .github/workflows/stale.yml

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

9 changes: 5 additions & 4 deletions .github/workflows/upgrade-main.yml

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

2 changes: 2 additions & 0 deletions .gitignore

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

2 changes: 2 additions & 0 deletions .projen/files.json

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

34 changes: 34 additions & 0 deletions .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
RunsUsing,
} from "projen-github-action-typescript";
import { CustomizedLicense } from "./projenrc/customized-license";
import { LockIssues } from "./projenrc/lock-issues";

const inputs = {
cdktfVersion: {
Expand Down Expand Up @@ -65,6 +66,38 @@ const project = new GitHubActionTypeScriptProject({
prettier: true,
projenrcTs: true,
licensed: false, // we do supply our own license file with a custom header
depsUpgradeOptions: {
workflowOptions: {
labels: ["automerge", "dependencies"],
},
},
workflowGitIdentity: {
name: "team-tf-cdk",
email: "[email protected]",
},
stale: true,
staleOptions: {
issues: {
staleLabel: "stale",
daysBeforeStale: 30,
staleMessage:
"Hi there! 👋 We haven't heard from you in 30 days and would like to know if the problem has been resolved or if " +
"you still need help. If we don't hear from you before then, I'll auto-close this issue in 30 days.",
daysBeforeClose: 30,
closeMessage:
"I'm closing this issue because we haven't heard back in 60 days. ⌛️ If you still need help, feel free to reopen the issue!",
},
pullRequest: {
staleLabel: "stale",
daysBeforeStale: 60,
staleMessage:
"Hi there! 👋 We haven't heard from you in 60 days and would like to know if you're still working on this or need help. " +
"If we don't hear from you before then, I'll auto-close this PR in 30 days.",
daysBeforeClose: 30,
closeMessage:
"I'm closing this pull request because we haven't heard back in 90 days. ⌛️ If you're still working on this, feel free to reopen the PR or create a new one!",
},
},

actionMetadata: {
author: "HashiCorp, Inc.",
Expand Down Expand Up @@ -99,6 +132,7 @@ const project = new GitHubActionTypeScriptProject({
});

new CustomizedLicense(project);
new LockIssues(project);

new TextFile(project, "src/inputs.ts", {
committed: true,
Expand Down
46 changes: 46 additions & 0 deletions projenrc/lock-issues.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { javascript } from "projen";
import { JobPermission } from "projen/lib/github/workflows-model";

/**
* Automatically locks issues and PRs after 30 days.
*/
export class LockIssues {
constructor(project: javascript.NodeProject) {
const workflow = project.github?.addWorkflow("lock");

if (!workflow) throw new Error("no workflow defined");

workflow.on({
schedule: [{ cron: "20 2 * * *" }],
});

workflow.addJob("lock", {
runsOn: ["ubuntu-latest"],
permissions: {
pullRequests: JobPermission.WRITE,
issues: JobPermission.WRITE,
},
steps: [
{
uses: "dessant/[email protected]",
with: {
"issue-comment":
`I'm going to lock this issue because it has been closed for at least 30 days.
This helps our maintainers find and focus on the active issues.
If you've found a problem that seems similar to this, please
[open a new issue](https://github.com/hashicorp/terraform-cdk-action/issues/new)
so we can investigate further.`.replace(/\s+/g, " "),
"issue-inactive-days": 30,
"pr-comment":
`I'm going to lock this pull request because it has been closed for at least 30 days.
This helps our maintainers find and focus on the active issues.
If you've found a problem that seems related to this change, please
[open a new issue](https://github.com/hashicorp/terraform-cdk-action/issues/new)
so we can investigate further.`.replace(/\s+/g, " "),
"pr-inactive-days": 30,
},
},
],
});
}
}

0 comments on commit 7347170

Please sign in to comment.