Skip to content

Commit

Permalink
Add external issue label and project automation (#15945)
Browse files Browse the repository at this point in the history
This PR creates two new GitHub Actions around issue and PR tracking

### `external_issue_labeler.yml`
This action automatically adds a label, currently `External`, to any issue or PR that is opened by someone that is not either an owner, member, or collaborator to the cuDF repo

### `pr_issue_status_automation.yml`
This action uses the [shared workflows](https://github.com/rapidsai/shared-workflows/tree/branch-24.08/.github/workflows) in rapdsai/shared-workflows to, on open/edit/synchronize of an open PR, to:
1. Set the PR to `in progress`
2. Set all linked issues `in progress`
3. Set the PR's sprint to the current iteration
4. Set all linked issues to the current iteration

Edit triggers on edit of the PR description, (so new linked issues will get synchronized to `in progress`). Synchronize triggers on push and rebase events - this really is to cover the "what are we working on right now" because anything we touch goes into the current sprint in the project.

Authors:
  - Ben Jarmak (https://github.com/jarmak-nv)
  - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
  - Vyas Ramasubramani (https://github.com/vyasr)

URL: #15945
  • Loading branch information
jarmak-nv authored Jun 11, 2024
1 parent 570df6c commit 1bd210d
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/external_issue_labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# SPDX-FileCopyrightText: Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Label external issues and PRs

on:
issues:
types:
- opened

pull_request:
types:
- opened

env:
GITHUB_TOKEN: ${{ github.token }}

permissions:
issues: write
pull-requests: write

jobs:
Label-Issue:
runs-on: ubuntu-latest
# Only run if the issue author is not part of RAPIDS
if: ${{ ! contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.issue.author_association)}}
steps:
- name: add-external-labels
run: |
issue_url=${{ github.event.issue.html_url }}
gh issue edit ${issue_url} --add-label "External"
continue-on-error: true

Label-PR:
runs-on: ubuntu-latest
# Only run if the issue author is not part of RAPIDS
if: ${{ ! contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)}}
steps:
- name: add-external-labels
run: |
pr_url=${{ github.event.pull_request.html_url }}
gh issue edit ${pr_url} --add-label "External"
continue-on-error: true
64 changes: 64 additions & 0 deletions .github/workflows/pr_issue_status_automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# SPDX-FileCopyrightText: Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Set PR and Issue Project Fields

on:
pull_request_target:
# This job runs when a PR is first opened, or it is updated
# Only runs if the PR is open (we don't want to update the status of a closed PR)
types: [opened, edited, synchronize]

jobs:
get-project-id:
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
if: github.event.pull_request.state == 'open'
secrets: inherit
permissions:
contents: read
with:
PROJECT_ID: "PVT_kwDOAp2shc4AiNzl"
ITEM_NODE_ID: "${{ github.event.pull_request.node_id }}"

update-status:
# This job sets the PR and its linked issues to "In Progress" status
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
if: github.event.pull_request.state == 'open'
needs: get-project-id
with:
PROJECT_ID: "PVT_kwDOAp2shc4AiNzl"
SINGLE_SELECT_FIELD_ID: "PVTSSF_lADOAp2shc4AiNzlzgaxNac"
SINGLE_SELECT_FIELD_NAME: "Status"
SINGLE_SELECT_OPTION_VALUE: "In Progress"
ITEM_PROJECT_ID: "${{ needs.get-project-id.outputs.ITEM_PROJECT_ID }}"
ITEM_NODE_ID: "${{ github.event.pull_request.node_id }}"
UPDATE_ITEM: true
UPDATE_LINKED_ISSUES: true
secrets: inherit

update-sprint:
# This job sets the PR and its linked issues to the current "Weekly Sprint"
uses: jarmak-nv/shared-workflows/.github/workflows/[email protected]
if: github.event.pull_request.state == 'open'
needs: get-project-id
with:
PROJECT_ID: "PVT_kwDOAp2shc4AiNzl"
ITERATION_FIELD_ID: "PVTIF_lADOAp2shc4AiNzlzgbU_po"
ITERATION_FIELD_NAME: "Weekly Sprint"
ITEM_PROJECT_ID: "${{ needs.get-project-id.outputs.ITEM_PROJECT_ID }}"
ITEM_NODE_ID: "${{ github.event.pull_request.node_id }}"
UPDATE_ITEM: true
UPDATE_LINKED_ISSUES: true
secrets: inherit

0 comments on commit 1bd210d

Please sign in to comment.