From 6c93c43aac12aeb6978f1f89855d1aca686c5f6a Mon Sep 17 00:00:00 2001 From: Otavio Macedo <288203+otaviomacedo@users.noreply.github.com> Date: Wed, 16 Oct 2024 11:53:44 +0100 Subject: [PATCH 1/2] chore: enable PR auto merge --- .gitattributes | 2 +- .github/workflows/auto-merge.yml | 22 ++++++++++++++++++++++ .github/workflows/build.yml | 3 +++ .github/workflows/pull-request-lint.yml | 4 ++++ .gitignore | 2 +- .mergify.yml | 24 ------------------------ .npmignore | 1 - .projen/files.json | 2 +- .projenrc.ts | 1 + 9 files changed, 33 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/auto-merge.yml delete mode 100644 .mergify.yml diff --git a/.gitattributes b/.gitattributes index 323e6353..81f35efa 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,6 +6,7 @@ /.gitattributes linguist-generated /.github/pull_request_template.md linguist-generated /.github/workflows/auto-approve.yml linguist-generated +/.github/workflows/auto-merge.yml linguist-generated /.github/workflows/build.yml linguist-generated /.github/workflows/pull-request-lint.yml linguist-generated /.github/workflows/release.yml linguist-generated @@ -13,7 +14,6 @@ /.github/workflows/upgrade-dev-deps-main.yml linguist-generated /.github/workflows/upgrade-main.yml linguist-generated /.gitignore linguist-generated -/.mergify.yml linguist-generated /.npmignore linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml new file mode 100644 index 00000000..21ff89c1 --- /dev/null +++ b/.github/workflows/auto-merge.yml @@ -0,0 +1,22 @@ +# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen". + +name: auto-merge +on: + pull_request_target: + types: + - opened + - reopened + - ready_for_review +jobs: + enableAutoMerge: + name: "Set AutoMerge on PR #${{ github.event.number }}" + runs-on: ubuntu-latest + permissions: + pull-requests: write + contents: write + steps: + - uses: peter-evans/enable-pull-request-automerge@v2 + with: + token: ${{ secrets.PROJEN_GITHUB_TOKEN }} + pull-request-number: ${{ github.event.number }} + merge-method: squash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ce2ebde6..eed252b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,9 @@ name: build on: pull_request: {} workflow_dispatch: {} + merge_group: + branches: + - main jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/pull-request-lint.yml b/.github/workflows/pull-request-lint.yml index 2c1c658c..5531d666 100644 --- a/.github/workflows/pull-request-lint.yml +++ b/.github/workflows/pull-request-lint.yml @@ -10,6 +10,9 @@ on: - reopened - ready_for_review - edited + merge_group: + branches: + - main jobs: validate: name: Validate PR title @@ -26,3 +29,4 @@ jobs: fix chore requireScope: false + if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' diff --git a/.gitignore b/.gitignore index df21611a..ff41cf33 100644 --- a/.gitignore +++ b/.gitignore @@ -38,7 +38,6 @@ junit.xml /dist/changelog.md /dist/version.txt !/.github/workflows/release.yml -!/.mergify.yml !/.github/pull_request_template.md !/test/ !/tsconfig.json @@ -47,6 +46,7 @@ junit.xml /lib /dist/ !/.eslintrc.json +!/.github/workflows/auto-merge.yml !/.github/workflows/upgrade-cdklabs-projen-project-types-main.yml !/.github/workflows/upgrade-main.yml !/.github/workflows/upgrade-dev-deps-main.yml diff --git a/.mergify.yml b/.mergify.yml deleted file mode 100644 index 0d8462bd..00000000 --- a/.mergify.yml +++ /dev/null @@ -1,24 +0,0 @@ -# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen". - -queue_rules: - - name: default - update_method: merge - conditions: - - "#approved-reviews-by>=1" - - -label~=(do-not-merge) - - status-success=build -pull_request_rules: - - name: Automatic merge on approval and successful build - actions: - delete_head_branch: {} - queue: - method: squash - name: default - commit_message_template: |- - {{ title }} (#{{ number }}) - - {{ body }} - conditions: - - "#approved-reviews-by>=1" - - -label~=(do-not-merge) - - status-success=build diff --git a/.npmignore b/.npmignore index d33ec41b..0b3c6a77 100644 --- a/.npmignore +++ b/.npmignore @@ -6,7 +6,6 @@ junit.xml permissions-backup.acl /dist/changelog.md /dist/version.txt -/.mergify.yml /test/ /tsconfig.dev.json /src/ diff --git a/.projen/files.json b/.projen/files.json index 89dbaf10..4f14d7e0 100644 --- a/.projen/files.json +++ b/.projen/files.json @@ -4,6 +4,7 @@ ".gitattributes", ".github/pull_request_template.md", ".github/workflows/auto-approve.yml", + ".github/workflows/auto-merge.yml", ".github/workflows/build.yml", ".github/workflows/pull-request-lint.yml", ".github/workflows/release.yml", @@ -11,7 +12,6 @@ ".github/workflows/upgrade-dev-deps-main.yml", ".github/workflows/upgrade-main.yml", ".gitignore", - ".mergify.yml", ".npmignore", ".projen/deps.json", ".projen/files.json", diff --git a/.projenrc.ts b/.projenrc.ts index 611296ab..58e5da9f 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -61,6 +61,7 @@ const project = new CdklabsTypeScriptProject({ skipLibCheck: true, }, }, + enablePRAutoMerge: true, }); // Suppress upgrade prompts, in particular from test runs. From 2ef30e3e8bbe8f897f0e006266e1f12eb36e3025 Mon Sep 17 00:00:00 2001 From: Otavio Macedo <288203+otaviomacedo@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:14:04 +0100 Subject: [PATCH 2/2] Comment --- .projenrc.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.projenrc.ts b/.projenrc.ts index 58e5da9f..847a9a36 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -61,6 +61,8 @@ const project = new CdklabsTypeScriptProject({ skipLibCheck: true, }, }, + + // Because githubOptions: { mergify: false } has no effect on this project type enablePRAutoMerge: true, });