Skip to content

Commit

Permalink
chore: update auto-approve.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
xiehan authored Oct 19, 2023
1 parent cbfeeee commit 208e360
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions projenrc/auto-approve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ export class AutoApprove {
if (!workflow) throw new Error("no workflow defined");

workflow.on({
pullRequest: {
pullRequestTarget: {
types: ["opened", "labeled", "ready_for_review", "reopened"],
},
});

const maintainerStatuses = `fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]')`;
workflow.addJobs({
approve: {
runsOn: ["ubuntu-latest"],
Expand All @@ -37,7 +38,7 @@ export class AutoApprove {
},
{
name: "Auto-approve PRs by other users as team-tf-cdk",
if: "github.event.pull_request.user.login != 'team-tf-cdk'",
if: `github.event.pull_request.user.login != 'team-tf-cdk' && (contains(${maintainerStatuses}, github.event.pull_request.author_association) || github.actor == 'dependabot[bot])`,
run: "gh pr review ${{ github.event.pull_request.number }} --approve",
env: {
GH_TOKEN: "${{ secrets.PROJEN_GITHUB_TOKEN }}",
Expand Down

0 comments on commit 208e360

Please sign in to comment.