| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9a5ee5e commit 041bb54
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,50 @@ | |||
| 1 | + name: Label Flaky Test Issues | ||
| 2 | + | ||
| 3 | + on: | ||
| 4 | + issues: | ||
| 5 | + types: [opened, labeled] | ||
| 6 | + | ||
| 7 | + jobs: | ||
| 8 | + label: | ||
| 9 | + if: github.event.label.name == 'flaky-test' | ||
| 10 | + runs-on: ubuntu-latest | ||
| 11 | + permissions: | ||
| 12 | + issues: write | ||
| 13 | + steps: | ||
| 14 | + - name: Extract labels | ||
| 15 | + id: extract-labels | ||
| 16 | + env: | ||
| 17 | + BODY: ${{ github.event.issue.body }} | ||
| 18 | + run: | | ||
| 19 | + BODY="${BODY//$'\n'/'\n'}" | ||
| 20 | + | ||
| 21 | + declare -A platform2label | ||
| 22 | + | ||
| 23 | + platform2label["AIX"]="aix"; | ||
| 24 | + platform2label["FreeBSD"]="freebsd"; | ||
| 25 | + platform2label["Linux ARM64"]="linux"; | ||
| 26 | + platform2label["Linux ARMv7"]="arm"; | ||
| 27 | + platform2label["Linux PPC64LE"]="ppc"; | ||
| 28 | + platform2label["Linux s390x"]="s390"; | ||
| 29 | + platform2label["Linux x64"]="linux"; | ||
| 30 | + platform2label["macOS ARM64"]="macos"; | ||
| 31 | + platform2label["macOS x64"]="macos"; | ||
| 32 | + platform2label["SmartOS"]="smartos"; | ||
| 33 | + platform2label["Windows"]="windows"; | ||
| 34 | + | ||
| 35 | + # sed is cleaning up the edges | ||
| 36 | + PLATFORMS=$(echo $BODY | sed 's/^.*Platform\\n\\n//' | sed 's/\(, Other\)\?\\n\\n.*$//') 2> /dev/null | ||
| 37 | + readarray -d , -t list <<< "$PLATFORMS" | ||
| 38 | + labels= | ||
| 39 | + for row in "${list[@]}"; do \ | ||
| 40 | + platform=$(echo $row | xargs); \ | ||
| 41 | + labels="${labels}${platform2label[$platform]},"; \ | ||
| 42 | + done; | ||
| 43 | + | ||
| 44 | + echo "::set-output name=LABELS::${labels::-1}" | ||
| 45 | + | ||
| 46 | + - name: Add labels | ||
| 47 | + env: | ||
| 48 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| 49 | + NUMBER: ${{ github.event.issue.number }} | ||
| 50 | + run: gh issue edit "$NUMBER" --repo ${{ github.repository }} --add-label "${{ steps.extract-labels.outputs.LABELS }}" | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments