mirror of
https://github.com/bitnami/containers.git
synced 2026-03-04 06:47:25 +08:00
133 lines
5.4 KiB
YAML
133 lines
5.4 KiB
YAML
# This workflow is built to manage the triage support by using GH issues.
|
|
name: '[Support] Cards movements'
|
|
on:
|
|
project_card:
|
|
types:
|
|
- created
|
|
- moved
|
|
|
|
permissions:
|
|
repository-projects: read
|
|
issues: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
get-issue:
|
|
runs-on: ubuntu-latest
|
|
name: Get issue info
|
|
outputs:
|
|
assignees: ${{ steps.get-issue-step.outputs.assignees }}
|
|
creator: ${{ steps.get-issue-step.outputs.creator }}
|
|
type: ${{ steps.get-issue-step.outputs.type }}
|
|
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')"
|
|
pull_request="$(echo $issue_info | jq -r '.pull_request')"
|
|
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=type::${type}"
|
|
label-card:
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- get-issue
|
|
steps:
|
|
- name: Repo checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 1
|
|
- name: Load .env file
|
|
uses: xom9ikk/dotenv@v1.0.2
|
|
with:
|
|
path: .github/workflows/
|
|
# Now handling the needed labeling
|
|
- name: Triage labeling
|
|
# Only if moved into triage
|
|
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
|
|
if: |
|
|
github.event.project_card.column_id == env.TRIAGE_COLUMN_ID &&
|
|
needs.get-issue.outputs.creator == 'bitnami-bot' && needs.get-issue.outputs.type != 'issue'
|
|
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 }}
|
|
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' }}
|
|
- 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"
|
|
- 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"
|
|
- name: Solved labeling
|
|
# Only if moved into Solved and the issue creator is not bitnami-bot
|
|
if: |
|
|
github.event.project_card.column_id == env.SOLVED_COLUMN_ID &&
|
|
(needs.get-issue.outputs.creator != 'bitnami-bot')
|
|
uses: andymckay/labeler@1.0.4
|
|
with:
|
|
add-labels: "solved"
|
|
remove-labels: "in-progress, on-hold, triage"
|
|
assign-assignee-if-needed:
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- get-issue
|
|
if: ${{ needs.get-issue.outputs.creator != 'bitnami-bot' }}
|
|
steps:
|
|
- name: Repo checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 1
|
|
- name: Load .env file
|
|
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 }}"
|
|
- name: Reassign when moved into 'In progress' from 'Triage'
|
|
# Reassigned when moved into In progress FROM Triage
|
|
if: |
|
|
github.event.action == 'moved' && needs.get-issue.outputs.assignees != '[]' &&
|
|
github.event.project_card.column_id == env.IN_PROGRESS_COLUMN_ID &&
|
|
github.event.changes.column_id.from == env.TRIAGE_COLUMN_ID
|
|
uses: pozil/auto-assign-issue@v1.9.0
|
|
with:
|
|
numOfAssignee: 1
|
|
removePreviousAssignees: true
|
|
teams: ${{ env.SUPPORT_TEAM_NAME }}
|
|
repo-token: "${{ secrets.BITNAMI_BOT_TOKEN }}"
|