diff --git a/src/auto-close-community-issues.ts b/src/auto-close-community-issues.ts index e061a96e..c9fc3de9 100644 --- a/src/auto-close-community-issues.ts +++ b/src/auto-close-community-issues.ts @@ -37,6 +37,7 @@ export class AutoCloseCommunityIssues { }, }); + const maintainerStatuses = `fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]')`; const comment = `Hi there! 👋 We appreciate your interest, but this is probably not the right place. All the code in this repository is auto-generated using @@ -53,7 +54,7 @@ export class AutoCloseCommunityIssues { permissions: { issues: JobPermission.WRITE, }, - if: "github.event.issue.author_association != 'OWNER' && github.event.issue.author_association != 'MEMBER' && github.event.issue.author_association != 'COLLABORATOR'", + if: `github.event.issue.user.login == 'team-tf-cdk' || contains(${maintainerStatuses}, github.event.issue.author_association)`, steps: [ { name: "Checkout", @@ -84,7 +85,7 @@ export class AutoCloseCommunityIssues { permissions: { pullRequests: JobPermission.WRITE, }, - if: "github.event.pull_request.author_association != 'OWNER' && github.event.pull_request.author_association != 'MEMBER' && github.event.pull_request.author_association != 'COLLABORATOR'", + if: `github.event.pull_request.user.login == 'team-tf-cdk' || contains(${maintainerStatuses}, github.event.pull_request.author_association)`, steps: [ { name: "Checkout", diff --git a/test/__snapshots__/index.test.ts.snap b/test/__snapshots__/index.test.ts.snap index 83cfbdca..0d64b4e5 100644 --- a/test/__snapshots__/index.test.ts.snap +++ b/test/__snapshots__/index.test.ts.snap @@ -120,7 +120,7 @@ jobs: runs-on: ubuntu-latest permissions: issues: write - if: github.event.issue.author_association != 'OWNER' && github.event.issue.author_association != 'MEMBER' && github.event.issue.author_association != 'COLLABORATOR' + if: github.event.issue.user.login == 'team-tf-cdk' || contains(fromJSON('[\\"OWNER\\", \\"MEMBER\\", \\"COLLABORATOR\\", \\"CONTRIBUTOR\\"]'), github.event.issue.author_association) steps: - name: Checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab @@ -145,7 +145,7 @@ jobs: runs-on: ubuntu-latest permissions: pull-requests: write - if: github.event.pull_request.author_association != 'OWNER' && github.event.pull_request.author_association != 'MEMBER' && github.event.pull_request.author_association != 'COLLABORATOR' + if: github.event.pull_request.user.login == 'team-tf-cdk' || contains(fromJSON('[\\"OWNER\\", \\"MEMBER\\", \\"COLLABORATOR\\", \\"CONTRIBUTOR\\"]'), github.event.pull_request.author_association) steps: - name: Checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab @@ -2800,7 +2800,7 @@ jobs: runs-on: ubuntu-latest permissions: issues: write - if: github.event.issue.author_association != 'OWNER' && github.event.issue.author_association != 'MEMBER' && github.event.issue.author_association != 'COLLABORATOR' + if: github.event.issue.user.login == 'team-tf-cdk' || contains(fromJSON('[\\"OWNER\\", \\"MEMBER\\", \\"COLLABORATOR\\", \\"CONTRIBUTOR\\"]'), github.event.issue.author_association) steps: - name: Checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab @@ -2825,7 +2825,7 @@ jobs: runs-on: ubuntu-latest permissions: pull-requests: write - if: github.event.pull_request.author_association != 'OWNER' && github.event.pull_request.author_association != 'MEMBER' && github.event.pull_request.author_association != 'COLLABORATOR' + if: github.event.pull_request.user.login == 'team-tf-cdk' || contains(fromJSON('[\\"OWNER\\", \\"MEMBER\\", \\"COLLABORATOR\\", \\"CONTRIBUTOR\\"]'), github.event.pull_request.author_association) steps: - name: Checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab @@ -5531,7 +5531,7 @@ jobs: runs-on: ubuntu-latest permissions: issues: write - if: github.event.issue.author_association != 'OWNER' && github.event.issue.author_association != 'MEMBER' && github.event.issue.author_association != 'COLLABORATOR' + if: github.event.issue.user.login == 'team-tf-cdk' || contains(fromJSON('[\\"OWNER\\", \\"MEMBER\\", \\"COLLABORATOR\\", \\"CONTRIBUTOR\\"]'), github.event.issue.author_association) steps: - name: Checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab @@ -5556,7 +5556,7 @@ jobs: runs-on: ubuntu-latest permissions: pull-requests: write - if: github.event.pull_request.author_association != 'OWNER' && github.event.pull_request.author_association != 'MEMBER' && github.event.pull_request.author_association != 'COLLABORATOR' + if: github.event.pull_request.user.login == 'team-tf-cdk' || contains(fromJSON('[\\"OWNER\\", \\"MEMBER\\", \\"COLLABORATOR\\", \\"CONTRIBUTOR\\"]'), github.event.pull_request.author_association) steps: - name: Checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab