kubectl gs login
should assist user when using --cluster-admin
by mistake
#969
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Add appropriate labels to issue | |
on: | |
issues: | |
types: [assigned] | |
jobs: | |
build_user_list: | |
name: Get yaml config of GS users | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get user-mapping | |
run: | | |
mkdir -p artifacts | |
wget --header "Authorization: token ${{ secrets.ISSUE_AUTOMATION }}" \ | |
-O artifacts/users.yaml \ | |
https://raw.githubusercontent.com/giantswarm/github/main/tools/issue-automation/user-mapping.yaml | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: users | |
path: artifacts/users.yaml | |
retention-days: 1 | |
add_label: | |
name: Add team label when assigned | |
runs-on: ubuntu-latest | |
needs: build_user_list | |
steps: | |
- uses: actions/download-artifact@v3 | |
id: download-users | |
with: | |
name: users | |
- name: Find team label based on user names | |
run: | | |
event_assignee=$(cat $GITHUB_EVENT_PATH | jq -r .assignee.login | tr '[:upper:]' '[:lower:]') | |
echo "Issue assigned to: ${event_assignee}" | |
TEAMS=$(cat ${{steps.download-users.outputs.download-path}}/users.yaml | tr '[:upper:]' '[:lower:]' | yq ".${event_assignee}.teams" -o csv | tr ',' ' ') | |
echo "LABEL<<EOF" >> $GITHUB_ENV | |
for team in ${TEAMS}; do | |
echo "Team: ${team} | Label: team/${team}" | |
echo "team/${team}" >> $GITHUB_ENV | |
done | |
echo "EOF" >> $GITHUB_ENV | |
- name: Apply label to issue | |
if: ${{ env.LABEL != '' }} | |
uses: actions-ecosystem/action-add-labels@v1 | |
with: | |
github_token: ${{ secrets.ISSUE_AUTOMATION }} | |
labels: | | |
${{ env.LABEL }} |