From b18acb072c9fa44a7205f74c9d1e75a1e865bd27 Mon Sep 17 00:00:00 2001 From: Matheus Nogueira Date: Mon, 6 Feb 2023 15:13:07 -0300 Subject: [PATCH] chore: add labels to external issues (#1947) add labels to external issues --- .github/TEAM_MEMBERS.txt | 9 ++++ ....yml => community-issue-notification.yaml} | 22 +++++++-- .../community-label-user-requests.yaml | 46 +++++++++++++++++++ 3 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 .github/TEAM_MEMBERS.txt rename .github/workflows/{community-issue-notification.yml => community-issue-notification.yaml} (63%) create mode 100644 .github/workflows/community-label-user-requests.yaml diff --git a/.github/TEAM_MEMBERS.txt b/.github/TEAM_MEMBERS.txt new file mode 100644 index 0000000000..5120da4481 --- /dev/null +++ b/.github/TEAM_MEMBERS.txt @@ -0,0 +1,9 @@ +adnanrahic +danielbdias +jfermi +jorgeepc +kdhamric +mathnogueira +olha23 +schoren +xoscar diff --git a/.github/workflows/community-issue-notification.yml b/.github/workflows/community-issue-notification.yaml similarity index 63% rename from .github/workflows/community-issue-notification.yml rename to .github/workflows/community-issue-notification.yaml index 2c408afa0e..98c0d9a426 100644 --- a/.github/workflows/community-issue-notification.yml +++ b/.github/workflows/community-issue-notification.yaml @@ -1,23 +1,38 @@ -# Send us messages on slack when users from the community either open new issues or PRs +# Send the tracetest team a notification about a new +# issue opened by a user + on: issues: types: - opened +permissions: + id-token: write + contents: read + issues: write + pull-requests: write + jobs: notify_slack: name: Notify team runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Load team members + id: load_team_members + run: + echo "team_members=$(cat .github/TEAM_MEMBERS.txt | tr '\n' ',')" >> $GITHUB_OUTPUT - name: Check if it's team member id: is_team_member if: github.event.action == 'opened' uses: mathnogueira/user-blocklist@1.0.0 with: - blocked_users: adnanrahic, danielbdias, jfermi, jorgeepc, kdhamric, mathnogueira, olha23, schoren, xoscar + blocked_users: ${{ steps.load_team_members.outputs.team_members }} - - name: Notify us if not a kubeshop member + - name: Notify team about issue if: | steps.is_team_member.outputs.result == 'false' uses: rtCamp/action-slack-notify@v2 @@ -32,4 +47,3 @@ jobs: SLACK_LINK_NAMES: true SLACK_FOOTER: ${{ github.event.issue.html_url }} MSG_MINIMAL: true - diff --git a/.github/workflows/community-label-user-requests.yaml b/.github/workflows/community-label-user-requests.yaml new file mode 100644 index 0000000000..8f9d56b756 --- /dev/null +++ b/.github/workflows/community-label-user-requests.yaml @@ -0,0 +1,46 @@ +# Label PRs and issues created by users that are not part +# of the tracetest team. + +on: + issues: + types: + - opened + +permissions: + id-token: write + contents: read + issues: write + pull-requests: write + +jobs: + notify_slack: + name: Label user request + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Load team members + id: load_team_members + run: + echo "team_members=$(cat .github/TEAM_MEMBERS.txt | tr '\n' ',')" >> $GITHUB_OUTPUT + + - name: Check if it's team member + id: is_team_member + if: github.event.action == 'opened' + uses: mathnogueira/user-blocklist@1.0.0 + with: + blocked_users: ${{ steps.load_team_members.outputs.team_members }} + + - name: Label issue + if: | + steps.is_team_member.outputs.result == 'false' + uses: actions/github-script@v6 + with: + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['user-request'] + })