[bitnami/*] Create new column in support dashboard for failed automated PRs (#6637)

* Add support for new Build Maintenance column
* Comments an moving-cards review and fix issue assigning reopened tasks
* Fix verify labeling and fix auto-merge condition

Signed-off-by: Fran Mulero <fmulero@vmware.com>
This commit is contained in:
Fran Mulero
2022-09-16 11:45:11 +02:00
committed by GitHub
parent 6d077dad7d
commit 5d4286de1e
5 changed files with 63 additions and 38 deletions
+3 -1
View File
@@ -5,5 +5,7 @@ SOLVED_COLUMN_ID=19026825
ON_HOLD_COLUMN_ID=19026824
BITNAMI_COLUMN_ID=19026818
PENDING_COLUMN_ID=19026823
BUILD_MAINTENANCE_COLUMN_ID=19168045
SUPPORT_TEAM_NAME='containers-support'
TRIAGE_TEAM_NAME='containers-triage'
TRIAGE_TEAM_NAME='containers-triage'
BUILD_MAINTAINERS_TEAM_NAME='build-maintainers'
+3
View File
@@ -139,14 +139,17 @@ jobs:
runs-on: ubuntu-latest
name: Reviewal for automated PRs
needs: verification-summary
# This job will be executed when the PR was created by bitnami-bot and it has the 'auto-merge' label
if: |
always() &&
contains(github.event.pull_request.labels.*.name, 'auto-merge') &&
github.event.pull_request.user.login == 'bitnami-bot'
steps:
- name: Enable auto-merge feature
if: ${{ needs.verification-summary.result == 'success' }}
uses: reitermarkus/automerge@v2.1.2
with:
# Necessary to trigger CD workflow
token: ${{ secrets.BITNAMI_BOT_TOKEN }}
merge-method: squash
pull-request: ${{ github.event.number }}
+13 -7
View File
@@ -20,30 +20,36 @@ jobs:
uses: xom9ikk/dotenv@v1.0.2
with:
path: .github/workflows/
- name: Move into From Bitnami
- name: Move into From Build Maintenance
uses: peter-evans/create-or-update-project-card@v2
if: ${{ github.actor == 'bitnami-bot' }}
# The comment was created by bitnami-bot in a pull_request
if: ${{ github.actor == 'bitnami-bot' && github.event.issue.pull_request != null }}
with:
project-name: Support
column-name: From Bitnami
column-name: Build Maintenance
# Required to trigger moving-cards.yml workflow (clean labels and assign people to work on it)
# NOTE: we will need to change it when the new column for failed automated PRs is created
token: "${{ secrets.BITNAMI_BOT_TOKEN }}"
- name: Move into Pending
uses: peter-evans/create-or-update-project-card@v2
if: ${{ github.actor != 'bitnami-bot' && (!contains(github.event.issue.labels.*.name, 'bitnami')) && contains(fromJson(env.BITNAMI_TEAM), github.actor) }}
if: |
(github.actor != 'bitnami-bot' || github.event.issue.pull_request == null) &&
(!contains(github.event.issue.labels.*.name, 'bitnami')) && contains(fromJson(env.BITNAMI_TEAM), github.actor)
with:
project-name: Support
column-name: Pending
- name: Move into In Progress
uses: peter-evans/create-or-update-project-card@v2
if: ${{ github.actor != 'bitnami-bot' && contains(github.event.issue.labels.*.name, 'in-progress') && (!contains(fromJson(env.BITNAMI_TEAM), github.actor)) }}
if: |
(github.actor != 'bitnami-bot' || github.event.issue.pull_request == null) &&
contains(github.event.issue.labels.*.name, 'in-progress') && (!contains(fromJson(env.BITNAMI_TEAM), github.actor))
with:
project-name: Support
column-name: In progress
- name: Move into Triage
uses: peter-evans/create-or-update-project-card@v2
if: ${{ github.actor != 'bitnami-bot' && ((contains(github.event.issue.labels.*.name, 'triage')) || (contains(github.event.issue.labels.*.name, 'solved'))) && (!contains(fromJson(env.BITNAMI_TEAM), github.actor)) }}
if: |
(github.actor != 'bitnami-bot' || github.event.issue.pull_request == null) &&
((contains(github.event.issue.labels.*.name, 'triage')) || (contains(github.event.issue.labels.*.name, 'solved'))) && (!contains(fromJson(env.BITNAMI_TEAM), github.actor))
with:
project-name: Support
column-name: Triage
+38 -28
View File
@@ -17,23 +17,26 @@ jobs:
name: Get issue info
outputs:
assignees: ${{ steps.get-issue-step.outputs.assignees }}
creator: ${{ steps.get-issue-step.outputs.creator }}
author: ${{ steps.get-issue-step.outputs.author }}
type: ${{ steps.get-issue-step.outputs.type }}
draft: ${{ steps.get-issue-step.outputs.draft }}
steps:
- name: Get issue info
id: get-issue-step
run: |
issue_info=$(curl -s --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -X GET -G "${{ github.event.project_card.content_url }}" )
assignees="$(echo $issue_info | jq -r '.assignees')"
creator="$(echo $issue_info | jq -r '.user.login')"
author="$(echo $issue_info | jq -r '.user.login')"
pull_request="$(echo $issue_info | jq -r '.pull_request')"
draft="$(echo $issue_info | jq -r '.draft' | sed -r "s|null|false|g")"
type="pull_request"
if [[ "${pull_request}" == "null" ]]; then
type="issue"
fi
echo "::set-output name=assignees::${assignees}"
echo "::set-output name=creator::${creator}"
echo "::set-output name=author::${author}"
echo "::set-output name=type::${type}"
echo "::set-output name=draft::${draft}"
label-card:
runs-on: ubuntu-latest
needs:
@@ -53,53 +56,61 @@ jobs:
if: ${{ github.event.project_card.column_id == env.TRIAGE_COLUMN_ID }}
uses: andymckay/labeler@1.0.4
with:
add-labels: ${{ (needs.get-issue.outputs.creator == 'bitnami-bot' && needs.get-issue.outputs.type != 'issue') && 'automated, auto-merge' || 'triage' }}
remove-labels: "on-hold, in-progress, solved"
- name: Triage labeling - verify
# Only if moved into triage, the creator is bitnami-bot and it is a PR
add-labels: ${{ (needs.get-issue.outputs.author == 'bitnami-bot' && needs.get-issue.outputs.type != 'issue') && 'automated, auto-merge' || 'triage' }}
remove-labels: on-hold, in-progress, solved
- name: From Bitnami labeling
if: ${{ github.event.project_card.column_id == env.BITNAMI_COLUMN_ID }}
uses: andymckay/labeler@1.0.4
with:
add-labels: bitnami
remove-labels: on-hold, in-progress, triage, solved
- name: Verify labeling
# Only if moved into bitnami column and the PR is ready for review
if: |
github.event.project_card.column_id == env.TRIAGE_COLUMN_ID &&
needs.get-issue.outputs.creator == 'bitnami-bot' && needs.get-issue.outputs.type != 'issue'
github.event.project_card.column_id == env.BITNAMI_COLUMN_ID &&
needs.get-issue.outputs.type == 'pull_request' && needs.get-issue.outputs.draft == 'false'
uses: andymckay/labeler@1.0.4
with:
add-labels: verify
# Required to trigger CI workflow
repo-token: "${{ secrets.BITNAMI_BOT_TOKEN }}"
- name: From Bitnami labeling
# NOTE: This step has to be modified when a new column for automated PR is added
if: ${{ github.event.project_card.column_id == env.BITNAMI_COLUMN_ID }}
repo-token: ${{ secrets.BITNAMI_BOT_TOKEN }}
- name: Build Maintenance labeling
if: ${{ github.event.project_card.column_id == env.BUILD_MAINTENANCE_COLUMN_ID }}
uses: andymckay/labeler@1.0.4
with:
add-labels: ${{ needs.get-issue.outputs.creator == 'bitnami-bot' && 'review-required' || 'bitnami' }}
remove-labels: ${{ needs.get-issue.outputs.creator == 'bitnami-bot' && 'auto-merge' || 'on-hold, in-progress, solved' }}
add-labels: review-required
remove-labels: auto-merge
- name: On hold labeling
# Only if moved into on hold
if: ${{ github.event.project_card.column_id == env.ON_HOLD_COLUMN_ID }}
uses: andymckay/labeler@1.0.4
with:
add-labels: "on-hold"
remove-labels: "triage, in-progress, solved"
add-labels: on-hold
remove-labels: triage, in-progress, solved
- name: In progress labeling
# Only if moved into In progress
if: ${{ github.event.project_card.column_id == env.IN_PROGRESS_COLUMN_ID }}
uses: andymckay/labeler@1.0.4
with:
add-labels: "in-progress"
remove-labels: "on-hold, triage, solved"
add-labels: in-progress
remove-labels: on-hold, triage, solved
- name: Solved labeling
# Only if moved into Solved and the issue creator is not bitnami-bot
# Only if moved into Solved and the issue author is not bitnami-bot
if: |
github.event.project_card.column_id == env.SOLVED_COLUMN_ID &&
(needs.get-issue.outputs.creator != 'bitnami-bot')
(needs.get-issue.outputs.author != 'bitnami-bot')
uses: andymckay/labeler@1.0.4
with:
add-labels: "solved"
remove-labels: "in-progress, on-hold, triage"
add-labels: solved
# Triage is not on the list to know how many issues/PRs are solved
# directly on triage
remove-labels: in-progress, on-hold
assign-assignee-if-needed:
runs-on: ubuntu-latest
needs:
- get-issue
if: ${{ needs.get-issue.outputs.creator != 'bitnami-bot' }}
# The job shouldn't run for new PRs created by bitnami-bot
if: ${{ github.event.action != 'created' || needs.get-issue.outputs.author != 'bitnami-bot' || needs.get-issue.outputs.issue != 'pull_request'}}
steps:
- name: Repo checkout
uses: actions/checkout@v3
@@ -109,15 +120,14 @@ jobs:
uses: xom9ikk/dotenv@v1.0.2
with:
path: .github/workflows/
# NOTE: The assignment rules has to be changed when the new column for automated PR is added
- name: Assign to a person to work on it
# Assign when there is nobody assigned or the card is new
if: ${{ needs.get-issue.outputs.assignees == '[]' || github.event.action == 'created' }}
uses: pozil/auto-assign-issue@v1.9.0
with:
numOfAssignee: 1
teams: ${{ github.event.project_card.column_id == env.BITNAMI_COLUMN_ID && env.SUPPORT_TEAM_NAME || env.TRIAGE_TEAM_NAME }}
repo-token: "${{ secrets.BITNAMI_BOT_TOKEN }}"
teams: ${{ github.event.project_card.column_id == env.BITNAMI_COLUMN_ID && env.SUPPORT_TEAM_NAME || (github.event.project_card.column_id == env.BUILD_MAINTENANCE_COLUMN_ID && env.BUILD_MAINTAINERS_TEAM_NAME || env.TRIAGE_TEAM_NAME) }}
repo-token: ${{ secrets.BITNAMI_BOT_TOKEN }}
- name: Reassign when moved into 'In progress' from 'Triage'
# Reassigned when moved into In progress FROM Triage
if: |
@@ -129,4 +139,4 @@ jobs:
numOfAssignee: 1
removePreviousAssignees: true
teams: ${{ env.SUPPORT_TEAM_NAME }}
repo-token: "${{ secrets.BITNAMI_BOT_TOKEN }}"
repo-token: ${{ secrets.BITNAMI_BOT_TOKEN }}
+6 -2
View File
@@ -22,12 +22,16 @@ jobs:
uses: xom9ikk/dotenv@v1.0.2
with:
path: .github/workflows/
- name: Get author
id: get-issue
run: |
author="${{ github.event.issue != null && github.event.issue.user.login || github.event.pull_request.user.login }}"
echo "::set-output name=author::${author}"
- 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
# NOTE: This step has to be modified when the new column for automated PR is added
column-name: ${{ (github.actor == 'bitnami-bot' || (!contains(fromJson(env.BITNAMI_TEAM), github.actor))) && 'Triage' || 'From Bitnami' }}
column-name: ${{ (!contains(fromJson(env.BITNAMI_TEAM), step.get-issue.outputs.author)) && 'Triage' || 'From Bitnami' }}
token: "${{ secrets.BITNAMI_BOT_TOKEN }}"
issue-number: ${{ github.event_name != 'issues' && github.event.number || github.event.issue.number }}