Skip to content

Commit

Permalink
Some issues reassigned when they are moved to solved or other columns (
Browse files Browse the repository at this point in the history
…#21)

* Fix some issues regarding to labeling and assignment

Signed-off-by: Fran Mulero <[email protected]>

* Typo

Signed-off-by: Fran Mulero <[email protected]>

* Set assignable labels in config

Signed-off-by: Fran Mulero <[email protected]>

* Set assign-to-team-member property to the bitnami label

Signed-off-by: Fran Mulero <[email protected]>

* Add new config to README file

Signed-off-by: Fran Mulero <[email protected]>

---------

Signed-off-by: Fran Mulero <[email protected]>
  • Loading branch information
fmulero authored Dec 1, 2023
1 parent 03f600e commit 489e886
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
BITNAMI_TEAM='["Akinorev","CeliaGMqrz","ClaaudiaGarcia","FlorinTataru","FraPazGal","Javirln","Mauraza","agarcia-oss","alemorcuq","alexherp","alvneiayu","andresbono","antgamdia","aoterolorenzo","beltran-rubo","bitnami-bot","carlossm","carrodher","castelblanque","corico44","cscazorla","dani8art","dariver","dcristobalhMad","dgomezleon","fevisera","fjagugar","fmulero","gdelgadot","gfichtenholt","gongomgra","javsalgar","jbianquetti-nami","jiparis","joancafom","jotadrilo","jotamartos","juamedgod","juan131","kaysavps","mdhont","migruiz4","mpermar","pablogalegoc","ppbaena","rafariossaa","rloporp","rogelio-o","tompizmor","xoanteis","zubero"]'
LABEL_MAPPING='{"in-progress":{"column":"In progress","labels-to-remove":["triage","on-hold","solved"]},"triage":{"column":"Triage","labels-to-remove":["in-progress","on-hold","solved"]},"on-hold":{"column":"On hold","labels-to-remove":["in-progress","triage","solved"]},"pending":{"column":"Pending","labels-to-remove":[]},"solved":{"column":"Solved","labels-to-remove":["in-progress"]},"bitnami":{"column":"From Bitnami","labels-to-remove":["in-progress"]}}'
LABEL_MAPPING='{"in-progress":{"assign-to-team-member":true,"remove-previous-assignees":true,"column":"In progress","labels-to-remove":["triage","on-hold","solved"]},"triage":{"assign-to-team-member":true,"column":"Triage","labels-to-remove":["in-progress","on-hold","solved"]},"on-hold":{"column":"On hold","labels-to-remove":["in-progress","triage","solved"]},"pending":{"column":"Pending","labels-to-remove":[]},"solved":{"column":"Solved","labels-to-remove":["in-progress"]},"bitnami":{"assign-to-team-member":true,"column":"From Bitnami","labels-to-remove":["in-progress"]}}'
REPO_ASSIGNMENT='{"charts":{"triage-teams":"charts-triage","support-teams":"charts-support"},"containers":{"triage-teams":"containers-triage","support-teams":"containers-support"},"vms":{"triage-teams":"vms-triage","support-teams":"vms-support"},"vulndb":{"triage-assignees":"gongomgra,juan131","support-assignees":"gongomgra,juan131"},"readme-generator-for-helm":{"triage-assignees":"fmulero","support-assignees":"fmulero"},"minideb":{"triage-teams":"containers-triage","support-teams":"containers-support"},"wait-for-port":{"triage-teams":"containers-triage","support-teams":"containers-support"},"render-template":{"triage-teams":"containers-triage","support-teams":"containers-support"},"ini-file":{"triage-teams":"containers-triage","support-teams":"containers-support"},"gonit":{"triage-teams":"containers-triage","support-teams":"containers-support"},"bndiagnostic":{"triage-teams":"vms-triage","support-teams":"vms-support"},"bncert":{"triage-teams":"vms-triage","support-teams":"vms-support"},"healthcheck-tools":{"triage-teams":"vms-triage","support-teams":"vms-support"},"default":{"triage-assignees":"fmulero","support-assignees":"fmulero"}}'
9 changes: 6 additions & 3 deletions .github/workflows/item-labeled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
outputs:
label-mapping: ${{ steps.get-info.outputs.label-mapping }}
label-keys: ${{ steps.get-info.outputs.label-keys }}
assignable-label-keys: ${{ steps.get-info.outputs.assignable-label-keys }}
author: ${{ steps.get-info.outputs.author }}
assignees: ${{ steps.get-info.outputs.assignees }}
steps:
Expand All @@ -44,9 +45,11 @@ jobs:
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
label_keys=$(echo "$LABEL_MAPPING"| jq -cr 'keys')
label_keys=$(echo "$LABEL_MAPPING" | jq -cr 'keys')
assignable_label_keys=$(echo "$LABEL_MAPPING" | jq -cr '[to_entries[] | select(.value."assign-to-team-member"==true) | .key])
echo "author=${author}" >> $GITHUB_OUTPUT
echo "label-keys=${label_keys}" >> $GITHUB_OUTPUT
echo "assignable-label-keys=${assignable_label_keys}" >> $GITHUB_OUTPUT
echo "label-mapping=${LABEL_MAPPING}" >> $GITHUB_OUTPUT
echo "assignees=${assignees}" >> $GITHUB_OUTPUT
# For any opened or reopened issue, should be sent into Triage
Expand Down Expand Up @@ -82,13 +85,13 @@ jobs:
issues: write
if : |
github.event.action == 'labeled' && github.actor != 'bitnami-bot' &&
contains(fromJson(needs.get-info.outputs.label-keys),github.event.label.name)
contains(fromJson(needs.get-info.outputs.assignable_label_keys),github.event.label.name)
steps:
- name: Assign issue/PR
uses: pozil/auto-assign-issue@edee9537367a8fbc625d27f9e10aa8bad47b8723
with:
numOfAssignee: 1
removePreviousAssignees: ${{ github.event.label.name == 'in-progress' }}
removePreviousAssignees: ${{ fromJson(needs.get-info.outputs.label-mapping)[github.event.label.name].remove-previous-assignees }}
assignees: ${{ needs.get-info.outputs.assignees }}
# If we have repos with only one assignees we allow selfAssignment
allowSelfAssign: ${{ needs.get-info.outputs.assignees == needs.get-info.outputs.author }}
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ The [`.env` file](.env) plays an important role here. It has the following infor
```json
"triage": {
"column": "Triage",
"assign-to-team-member": true,
"remove-previous-assignees": false,
"labels-to-remove": [
"in-progress",
"on-hold",
Expand Down

0 comments on commit 489e886

Please sign in to comment.