From cbfc1f11372b8be3e4c46bad025c0da2d5590875 Mon Sep 17 00:00:00 2001 From: Desi McAdam Date: Thu, 20 Mar 2025 14:34:22 -0600 Subject: [PATCH 1/3] feat(action): Add ability to add items without team info --- .github/workflows/add-item-to-project.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/add-item-to-project.yml b/.github/workflows/add-item-to-project.yml index 8be48c52..c578cbbc 100644 --- a/.github/workflows/add-item-to-project.yml +++ b/.github/workflows/add-item-to-project.yml @@ -15,11 +15,17 @@ on: description: 'Label that indicates the Issue/PR belongs to the team' required: true type: string + filter-enabled: + description: 'If true, only add items that match the team criteria. If false, add every item.' + required: false + type: boolean + default: true secrets: github-token: description: 'GitHub token with permissions to add items to projects' required: true + jobs: add_to_project: name: 'Add to Project Board' @@ -36,8 +42,14 @@ jobs: steps: - name: Add item to project board uses: actions/add-to-project@244f685bbc3b7adfa8466e08b698b5577571133e + # If filtering is disabled, the condition is always true. + # If filtering is enabled, then: + # - For PRs, check that the PR either has the specified team in requested_team + # or contains the team label. + # - For Issues, check that the issue contains the team label. if: | - (github.event_name == 'pull_request' && + !inputs.filter-enabled || + ((github.event_name == 'pull_request' && ( github.event.requested_team.name == inputs.team-name || contains(github.event.pull_request.labels.*.name, inputs.team-label) || @@ -49,7 +61,7 @@ jobs: ( contains(github.event.issue.labels.*.name, inputs.team-label) ) - ) + )) with: project-url: ${{ inputs.project-url }} github-token: ${{ secrets.github-token }} From 5aa46c2d2d1dce471dbd173c7dd275ada67dc336 Mon Sep 17 00:00:00 2001 From: Desi McAdam Date: Fri, 11 Apr 2025 07:07:35 -0600 Subject: [PATCH 2/3] Fix lint issue --- src/scripts/count-references-to-contributor-docs/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/count-references-to-contributor-docs/cli.ts b/src/scripts/count-references-to-contributor-docs/cli.ts index 9a43268e..9cc60738 100644 --- a/src/scripts/count-references-to-contributor-docs/cli.ts +++ b/src/scripts/count-references-to-contributor-docs/cli.ts @@ -15,7 +15,7 @@ const REPOSITORY_NAMES = [ 'snaps', ] as const; -type RepositoryName = (typeof REPOSITORY_NAMES)[number]; +type RepositoryName = typeof REPOSITORY_NAMES[number]; /** * It is not necessary for us to query all of the pull requests or pull requests From ddd61941ba525a092aa94b1392535ba9e68983ad Mon Sep 17 00:00:00 2001 From: Desi McAdam Date: Fri, 11 Apr 2025 07:16:37 -0600 Subject: [PATCH 3/3] Correct lint fix --- .github/workflows/add-item-to-project.yml | 1 - src/scripts/count-references-to-contributor-docs/cli.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/add-item-to-project.yml b/.github/workflows/add-item-to-project.yml index c578cbbc..328f30df 100644 --- a/.github/workflows/add-item-to-project.yml +++ b/.github/workflows/add-item-to-project.yml @@ -25,7 +25,6 @@ on: description: 'GitHub token with permissions to add items to projects' required: true - jobs: add_to_project: name: 'Add to Project Board' diff --git a/src/scripts/count-references-to-contributor-docs/cli.ts b/src/scripts/count-references-to-contributor-docs/cli.ts index 9cc60738..9a43268e 100644 --- a/src/scripts/count-references-to-contributor-docs/cli.ts +++ b/src/scripts/count-references-to-contributor-docs/cli.ts @@ -15,7 +15,7 @@ const REPOSITORY_NAMES = [ 'snaps', ] as const; -type RepositoryName = typeof REPOSITORY_NAMES[number]; +type RepositoryName = (typeof REPOSITORY_NAMES)[number]; /** * It is not necessary for us to query all of the pull requests or pull requests