From 13ee4720b36acd4d39c5c26597a25c7ebe42f353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20G=C3=B3mez=20Mor=C3=B3n?= Date: Tue, 26 Jul 2022 13:29:11 +0200 Subject: [PATCH] [bitnami/*] Parametrizing teams for the support workflows (#769) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Automated PRs created by the bitnami-bot should be ignored by any workflow related to support activities. Signed-off-by: Alejandro Gómez * Parametrizing triage and support teams. Automating BITNAMI_TEAM on .env file (daily). Using the BITNAMI_BOT_TOKEN instead of the PAT one Signed-off-by: Alejandro Gómez * Parametrizing triage and support teams. Automating BITNAMI_TEAM on .env file (daily). Using the BITNAMI_BOT_TOKEN instead of the PAT one Signed-off-by: Alejandro Gómez * Adding the proper user.name and user.email to the git commands Signed-off-by: Alejandro Gómez * Adding suggestions from fmulero Signed-off-by: Alejandro Gómez * Adding suggestions from fmulero Signed-off-by: Alejandro Gómez --- .github/workflows/.env | 4 +-- .github/workflows/move-closed-issues.yml | 11 ++----- .github/workflows/moving-cards.yml | 18 +++-------- .github/workflows/sync-teams.yml | 39 ++++++++++++++++++++++++ .github/workflows/triage.yml | 16 +++------- 5 files changed, 52 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/sync-teams.yml diff --git a/.github/workflows/.env b/.github/workflows/.env index 6d1d1380a2ea..18d9ced7ccd8 100644 --- a/.github/workflows/.env +++ b/.github/workflows/.env @@ -1,9 +1,9 @@ BITNAMI_TEAM='["bitnami-bot","jotamartos","alemorcuq","agomezmoron","carrodher","corico44","dgomezleon","fmulero","FraPazGal","javsalgar","gongomgra","joancafom","marcosbc","aoterolorenzo","CeliaGMqrz","Mauraza","mdhont","migruiz4","rafariossaa","beltran-rubo","recena"]' -SUPPORT_TEAM='["alemorcuq","carrodher","fmulero","FraPazGal","javsalgar","joancafom","marcosbc","migruiz4","rafariossaa"]' -TRIAGE_TEAM='["carrodher","fmulero", "javsalgar","rafariossaa"]' IN_PROGRESS_COLUMN_ID=19026822 TRIAGE_COLUMN_ID=19026814 SOLVED_COLUMN_ID=19026825 ON_HOLD_COLUMN_ID=19026824 BITNAMI_COLUMN_ID=19026814 PENDING_COLUMN_ID=19026823 +SUPPORT_TEAM_NAME='containers-support' +TRIAGE_TEAM_NAME='containers-triage' \ No newline at end of file diff --git a/.github/workflows/move-closed-issues.yml b/.github/workflows/move-closed-issues.yml index d60283662b1b..bb66aa2cc268 100644 --- a/.github/workflows/move-closed-issues.yml +++ b/.github/workflows/move-closed-issues.yml @@ -29,25 +29,18 @@ jobs: uses: xom9ikk/dotenv@v1.0.2 with: path: .github/workflows/ - - name: Preparing string variables - run: | - TRIAGE_TEAM_STRING=${TRIAGE_TEAM/[/} - TRIAGE_TEAM_STRING=${TRIAGE_TEAM_STRING/]/} - TRIAGE_TEAM_STRING=${TRIAGE_TEAM_STRING//'"'/} - # creating env variable "on the fly" - echo "TRIAGE_TEAM_STRING=$TRIAGE_TEAM_STRING" >> $GITHUB_ENV - name: Send to the Solved column uses: peter-evans/create-or-update-project-card@v2 with: project-name: Support # If the author comes from Bitnami, send it to Bitnami. Otherwise, all to Triage column-name: 'Solved' - token: "${{ secrets.GHPROJECT_TOKEN }}" + token: "${{ secrets.BITNAMI_BOT_TOKEN }}" issue-number: ${{ github.event_name != 'issues' && github.event.number || github.event.issue.number }} - name: Solved labeling # Only if moved into Solved uses: andymckay/labeler@1.0.4 with: - repo-token: "${{ secrets.GHPROJECT_TOKEN }}" + repo-token: "${{ secrets.BITNAMI_BOT_TOKEN }}" add-labels: "solved" remove-labels: "in-progress, on-hold, triage" \ No newline at end of file diff --git a/.github/workflows/moving-cards.yml b/.github/workflows/moving-cards.yml index 8275ee52ee99..5449210ad585 100644 --- a/.github/workflows/moving-cards.yml +++ b/.github/workflows/moving-cards.yml @@ -33,7 +33,7 @@ jobs: if: ${{ github.event.project_card.column_id == env.ON_HOLD_COLUMN_ID }} uses: andymckay/labeler@1.0.4 with: - repo-token: "${{ secrets.GHPROJECT_TOKEN }}" + repo-token: "${{ secrets.BITNAMI_BOT_TOKEN }}" add-labels: "on-hold" remove-labels: "triage" - name: In progress labeling @@ -41,7 +41,7 @@ jobs: if: ${{ github.event.project_card.column_id == env.IN_PROGRESS_COLUMN_ID }} uses: andymckay/labeler@1.0.4 with: - repo-token: "${{ secrets.GHPROJECT_TOKEN }}" + repo-token: "${{ secrets.BITNAMI_BOT_TOKEN }}" add-labels: "in-progress" remove-labels: "on-hold, triage" - name: Solved labeling @@ -49,7 +49,7 @@ jobs: if: ${{ github.event.project_card.column_id == env.SOLVED_COLUMN_ID }} uses: andymckay/labeler@1.0.4 with: - repo-token: "${{ secrets.GHPROJECT_TOKEN }}" + repo-token: "${{ secrets.BITNAMI_BOT_TOKEN }}" add-labels: "solved" remove-labels: "in-progress, on-hold, triage" assign-assignee-if-needed: @@ -64,20 +64,12 @@ jobs: uses: xom9ikk/dotenv@v1.0.2 with: path: .github/workflows/ - - name: Preparing string variables - run: | - SUPPORT_TEAM_STRING=${SUPPORT_TEAM/[/} - SUPPORT_TEAM_STRING=${SUPPORT_TEAM_STRING/]/} - SUPPORT_TEAM_STRING=${SUPPORT_TEAM_STRING//'"'/} - # creating env variable "on the fly" - echo "SUPPORT_TEAM_STRING=$SUPPORT_TEAM_STRING" >> $GITHUB_ENV - name: Assign to a person to work on it # Only if moved into In progress FROM Triage if: ${{ github.event.project_card.column_id == env.IN_PROGRESS_COLUMN_ID && github.event.changes != null && github.event.changes.column_id && github.event.changes.column_id.from == env.TRIAGE_COLUMN_ID }} uses: pozil/auto-assign-issue@v1.7.3 with: numOfAssignee: 1 - assignees: ${{ env.SUPPORT_TEAM_STRING }} removePreviousAssignees: true - # teams: XXX - repo-token: "${{ secrets.GHPROJECT_TOKEN }}" \ No newline at end of file + teams: ${{ env.SUPPORT_TEAM_NAME }} + repo-token: "${{ secrets.BITNAMI_BOT_TOKEN }}" \ No newline at end of file diff --git a/.github/workflows/sync-teams.yml b/.github/workflows/sync-teams.yml new file mode 100644 index 000000000000..51222e3eb90c --- /dev/null +++ b/.github/workflows/sync-teams.yml @@ -0,0 +1,39 @@ +name: '[Support] Synchronize team members in the .env file' +on: + schedule: + # Daily + - cron: '0 1 * * *' +permissions: + repository-projects: write + +jobs: + sync-support-teams: + runs-on: ubuntu-latest + steps: + - name: Repo checkout + uses: actions/checkout@v3 + with: + token: ${{ secrets.BITNAMI_BOT_TOKEN }} + fetch-depth: 1 + - name: Load .env file + uses: xom9ikk/dotenv@v1.0.2 + with: + path: .github/workflows/ + - name: Updating members of the Bitnami team + run: | + TEAM_MEMBERS=$(curl --request GET \ + --url https://api.github.com/orgs/bitnami/teams/developers/members \ + --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ + --header 'content-type: application/json' \ + | jq 'sort_by(.login)|map(.login)|join(",")') + TEAM_MEMBERS='['${TEAM_MEMBERS//','/'","'}']' + if [ $TEAM_MEMBERS != $BITNAMI_TEAM ]; then + echo "Replacing $BITNAMI_TEAM for $TEAM_MEMBERS" + sed -i "s|BITNAMI_TEAM=.*$|BITNAMI_TEAM='${TEAM_MEMBERS}'|g" .github/workflows/.env + git config user.name "bitnami-bot" + git config user.email "bitnami-bot@vmware.com" + git commit -s -m"[bitnami-bot] Updating Bitnami team members" .github/workflows/.env + git push + else + echo "BITNAMI_TEAM is updated and nothing should be done" + fi \ No newline at end of file diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index 6b1f7806a2e2..5fb07eec56e3 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -32,34 +32,26 @@ jobs: uses: xom9ikk/dotenv@v1.0.2 with: path: .github/workflows/ - - name: Preparing string variables - run: | - TRIAGE_TEAM_STRING=${TRIAGE_TEAM/[/} - TRIAGE_TEAM_STRING=${TRIAGE_TEAM_STRING/]/} - TRIAGE_TEAM_STRING=${TRIAGE_TEAM_STRING//'"'/} - # creating env variable "on the fly" - echo "TRIAGE_TEAM_STRING=$TRIAGE_TEAM_STRING" >> $GITHUB_ENV - name: Assign to a person to work on it uses: pozil/auto-assign-issue@v1.7.3 with: numOfAssignee: 1 - assignees: ${{ env.TRIAGE_TEAM_STRING }} removePreviousAssignees: false - # teams: XXX - repo-token: "${{ secrets.GHPROJECT_TOKEN }}" + teams: ${{ env.TRIAGE_TEAM_NAME }} + repo-token: "${{ secrets.BITNAMI_BOT_TOKEN }}" - name: Send to the board uses: peter-evans/create-or-update-project-card@v2 with: project-name: Support # If the author comes from Bitnami, send it to Bitnami. Otherwise, all to Triage column-name: ${{ (contains(fromJson(env.BITNAMI_TEAM), github.actor)) && 'From Bitnami' || 'Triage' }} - token: "${{ secrets.GHPROJECT_TOKEN }}" + token: "${{ secrets.BITNAMI_BOT_TOKEN }}" issue-number: ${{ github.event_name != 'issues' && github.event.number || github.event.issue.number }} - name: Triage labeling # Only if moved into Solved uses: andymckay/labeler@1.0.4 with: - repo-token: "${{ secrets.GHPROJECT_TOKEN }}" + repo-token: "${{ secrets.BITNAMI_BOT_TOKEN }}" add-labels: ${{ (!contains(fromJson(env.BITNAMI_TEAM), github.actor)) && 'triage' || 'bitnami' }} # For reopened issues remove-labels: "solved" \ No newline at end of file