-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (118 loc) · 5.89 KB
/
item-opened.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Copyright Broadcom, Inc. All Rights Reserved.
# SPDX-License-Identifier: APACHE-2.0
# This workflow is built to manage the triage support by using GH issues.
name: '[Support] Organize triage'
on:
workflow_call:
secrets:
BITNAMI_SUPPORT_BOARD_TOKEN:
required: true
# Remove all permissions by default
permissions: {}
jobs:
# For any opened or reopened issue, should be sent into Triage
send_to_board:
name: Organize triage
runs-on: ubuntu-latest
# Please note that projects cards are created/moved with Bitnami Bot
permissions:
contents: read
steps:
- name: Repo checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 1
repository: bitnami/support
- name: Load .env file
uses: xom9ikk/dotenv@ac290ca23a42155a0cba1031d23afa46240116a9
- name: Get item info
id: get-item
run: |
author="${{ github.event.issue != null && github.event.issue.user.login || github.event.pull_request.user.login }}"
number="${{ github.event.issue != null && github.event.issue.number || github.event.pull_request.number }}"
type="${{ github.event.issue != null && 'issue' || 'pull_request' }}"
echo "author=${author}" >> $GITHUB_OUTPUT
echo "number=${number}" >> $GITHUB_OUTPUT
echo "type=${type}" >> $GITHUB_OUTPUT
- name: Add to board
id: add-to-project
uses: actions/add-to-project@244f685bbc3b7adfa8466e08b698b5577571133e
if: ${{steps.get-item.outputs.author != 'bitnami-bot' || steps.get-item.outputs.type != 'pull_request'}}
with:
# Support project
project-url: https://github.com/orgs/bitnami/projects/4
github-token: ${{ secrets.BITNAMI_SUPPORT_BOARD_TOKEN }}
- name: Add to column
uses: EndBug/project-fields@a843f1eac1a2772a9d475cfd4bb32d68225c558c
if: ${{steps.get-item.outputs.author != 'bitnami-bot' || steps.get-item.outputs.type != 'pull_request'}}
with:
project_url: https://github.com/orgs/bitnami/projects/4
github_token: ${{ secrets.BITNAMI_SUPPORT_BOARD_TOKEN }}
operation: set
fields: Status
values: ${{ (contains(fromJson(env.BITNAMI_TEAM), steps.get-item.outputs.author)) && 'From Bitnami' || 'Triage' }}
labeling:
name: Set labels
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
steps:
- name: Repo checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 1
repository: bitnami/support
- name: Load .env file
uses: xom9ikk/dotenv@ac290ca23a42155a0cba1031d23afa46240116a9
- name: Get item info
id: get-item
env:
GITHUB_TOKEN: ${{ secrets.BITNAMI_SUPPORT_BOARD_TOKEN }}
run: |
author="${{ github.event.issue != null && github.event.issue.user.login || github.event.pull_request.user.login }}"
number="${{ github.event.issue != null && github.event.issue.number || github.event.pull_request.number }}"
type="${{ github.event.issue != null && 'issue' || 'pull_request' }}"
repo_name="${{ github.event.repository.name }}"
[[ "${BITNAMI_TEAM}" == *"${author}"* ]] && group="support" || group="triage"
assignment=$(echo "$REPO_ASSIGNMENT" | jq -cr ".\"${repo_name}\" // .default")
assignment_team=$(echo "$assignment" | jq -cr ".\"${group}-teams\" // empty")
assignees=$(echo "$assignment" | jq -cr ".\"${group}-assignees\" // empty")
# If there is no assignees and the team is not empty
if [[ -n "$assignment_team" ]] && [[ -z "$assignees" ]]; then
assignees=$(gh api "/orgs/bitnami/teams/${assignment_team}/members" |jq -cr 'sort_by(.login)|map(.login)|join(",")')
fi
echo "author=${author}" >> $GITHUB_OUTPUT
echo "number=${number}" >> $GITHUB_OUTPUT
echo "type=${type}" >> $GITHUB_OUTPUT
echo "assignees=${assignees}" >> $GITHUB_OUTPUT
- name: From Bitnami labeling
uses: fmulero/labeler@f49bf680252fc8ac12cbebb6e0ed8ea19d0712da
if: ${{ steps.get-item.outputs.type != 'issue' && steps.get-item.outputs.author == 'bitnami-bot' }}
with:
add-labels: 'automated, auto-merge'
- name: Verify labeling
uses: fmulero/labeler@f49bf680252fc8ac12cbebb6e0ed8ea19d0712da
if: ${{ steps.get-item.outputs.type != 'issue' && contains(fromJson(env.BITNAMI_TEAM), steps.get-item.outputs.author) }}
with:
# Bitnami bot token is required to trigger CI workflows
# Not needed for charts repo since the changelog PR will automatically trigger a new workflow
repo-token: ${{ github.event.repository.name == 'charts' && github.token || secrets.BITNAMI_SUPPORT_BOARD_TOKEN}}
add-labels: verify
- name: Triage labeling
uses: fmulero/labeler@f49bf680252fc8ac12cbebb6e0ed8ea19d0712da
if: |
steps.get-item.outputs.type != 'issue' && steps.get-item.outputs.author != 'bitnami-bot' ||
steps.get-item.outputs.type == 'issue'
with:
add-labels: ${{ (contains(fromJson(env.BITNAMI_TEAM), steps.get-item.outputs.author)) && 'bitnami' || 'triage' }}
remove-labels: on-hold, in-progress, solved, ${{ (contains(fromJson(env.BITNAMI_TEAM), steps.get-item.outputs.author)) && 'triage' || 'bitnami' }}
- name: Assign issue
uses: pozil/auto-assign-issue@b787bcda4fa1620522e73e7a5fe0f3b57b03b6ad
if: ${{ steps.get-item.outputs.author != 'bitnami-bot' }}
with:
numOfAssignee: 1
assignees: ${{ steps.get-item.outputs.assignees }}
# If we have repos with only one assignees we allow selfAssignment
allowSelfAssign: ${{ steps.get-item.outputs.assignees == steps.get-item.outputs.author }}