mirror of
https://github.com/bitnami/charts.git
synced 2026-03-09 15:38:00 +08:00
[bitnami/charts] Add automatically asset label in PRs (#12683)
* [bitnami/charts] Add automatically asset label in PRs Signed-off-by: Fran Mulero <fmulero@vmware.com> * Human friendly name for send_to_board job in triage workflow Signed-off-by: Fran Mulero <fmulero@vmware.com> Signed-off-by: Fran Mulero <fmulero@vmware.com>
This commit is contained in:
46
.github/workflows/assign-labels.yml
vendored
Normal file
46
.github/workflows/assign-labels.yml
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
name: '[Support] Assign asset label'
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- opened
|
||||
permissions:
|
||||
pull-requests: write
|
||||
issues: write
|
||||
jobs:
|
||||
assign-label:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- id: get-asset
|
||||
name: Get modified assets
|
||||
run: |
|
||||
# Using the Github API to detect the files changed as git merge-base stops working when the branch is behind
|
||||
# and jitterbit/get-changed-files does not support pull_request_target
|
||||
URL="https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files"
|
||||
files_changed_data=$(curl -s --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -X GET -G "$URL")
|
||||
files_changed="$(echo $files_changed_data | jq -r '.[] | .filename')"
|
||||
# Adding || true to avoid "Process exited with code 1" errors
|
||||
assets=($(echo "$files_changed" | xargs dirname | sed -nr "s|bitnami/([^/]*)/.*|\1|p" | sort | uniq || true))
|
||||
|
||||
if [[ "${#assets[@]}" -ne "1" ]]; then
|
||||
echo "::set-output name=result::skip"
|
||||
echo "::set-output name=message::Label cannot be set, cannot infer a single label from: ${assets[@]}"
|
||||
echo "::set-output name=name::NONE"
|
||||
else
|
||||
echo "::set-output name=result::ok"
|
||||
echo "::set-output name=message::Adding label '${assets}'"
|
||||
echo "::set-output name=name::${assets}"
|
||||
fi
|
||||
- name: Show messages
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
if ("${{ steps.get-asset.outputs.result }}" != "ok" ) {
|
||||
core.warning("${{ steps.get-asset.outputs.message }}")
|
||||
} else {
|
||||
core.info("${{ steps.get-asset.outputs.message }}")
|
||||
}
|
||||
- name: Labeling
|
||||
if: ${{ steps.get-asset.outputs.result == 'ok' }}
|
||||
uses: andymckay/labeler@1.0.4
|
||||
with:
|
||||
add-labels: "${{ steps.get-asset.outputs.name }}"
|
||||
1
.github/workflows/triage.yml
vendored
1
.github/workflows/triage.yml
vendored
@@ -12,6 +12,7 @@ on:
|
||||
jobs:
|
||||
# For any opened or reopened issue, should be sent into Triage
|
||||
send_to_board:
|
||||
name: Organize triage
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Repo checkout
|
||||
|
||||
Reference in New Issue
Block a user