From 66acad234166a2f59347c01b44837a0ca51354e1 Mon Sep 17 00:00:00 2001 From: Curtis Robert Date: Tue, 26 Dec 2023 17:05:13 -0800 Subject: [PATCH] [chore][CI/CD] Ping code owners even if one applies the label (#30136) **Description:** Currently if a label is applied by a code owner of the label's component, we don't ping the component's code owners. This makes sense in the most simple case of one code owner but is less effective for multiple code owners. I believe we should remove this functionality for the following reasons: 1. Other code owners are currently not pinged if one owner places the label. There are components that currently have 4+ code owners, many working in different companies. 2. The code owner applying the label will not be pinged on updates, as applying labels on GitHub doesn't subscribe the user to notifications on the given issue. Downside: This will mean someone applying a label will get pinged for their own action. I see the minor annoyance of this being worth the tradeoff of including other code owners. This change is only relevant when labels are applied to existing issues. **Alternative** It may make sense to check if the label sender is the only code owner, and in that case don't ping. However, I still think it's best for them to be automatically subscribed to issue events, and pinging them does that. I think this alternative would make more sense for the creating new issues workflow, as the issue author wouldn't need pinged as the sole code owner. --- .github/workflows/ping-codeowners-issues.yml | 1 - .github/workflows/scripts/ping-codeowners-issues.sh | 9 ++------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ping-codeowners-issues.yml b/.github/workflows/ping-codeowners-issues.yml index 6f4162b5a296..9a58d23f1f69 100644 --- a/.github/workflows/ping-codeowners-issues.yml +++ b/.github/workflows/ping-codeowners-issues.yml @@ -16,4 +16,3 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ISSUE: ${{ github.event.issue.number }} COMPONENT: ${{ github.event.label.name }} - SENDER: ${{ github.event.sender.login }} diff --git a/.github/workflows/scripts/ping-codeowners-issues.sh b/.github/workflows/scripts/ping-codeowners-issues.sh index cce1d37dbe18..a9ce7a875cbe 100755 --- a/.github/workflows/scripts/ping-codeowners-issues.sh +++ b/.github/workflows/scripts/ping-codeowners-issues.sh @@ -7,8 +7,8 @@ set -euo pipefail -if [[ -z "${COMPONENT:-}" || -z "${ISSUE:-}" || -z "${SENDER:-}" ]]; then - echo "At least one of COMPONENT, ISSUE, or SENDER has not been set, please ensure each is set." +if [[ -z "${COMPONENT:-}" || -z "${ISSUE:-}" ]]; then + echo "Either COMPONENT or ISSUE has not been set, please ensure both are set." exit 0 fi @@ -20,9 +20,4 @@ if [[ -z "${OWNERS}" ]]; then exit 0 fi -if [[ "${OWNERS}" =~ "${SENDER}" ]]; then - echo "Label applied by code owner ${SENDER}" - exit 0 -fi - gh issue comment "${ISSUE}" --body "Pinging code owners for ${COMPONENT}: ${OWNERS}. See [Adding Labels via Comments](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#adding-labels-via-comments) if you do not have permissions to add labels yourself."