Skip to content

Commit

Permalink
build: add workflow to label flaky-test platform
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelGSS committed Jul 29, 2022
1 parent 803a7b2 commit 2d416dc
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/label-flaky-test-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Label Flaky Test Issues

on:
issues:
types: [opened, labeled]

jobs:
label:
if: github.event.label.name == 'flaky-test'
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Extract labels
id: extract-labels
env:
BODY: "${{ github.event.issue.body }}"
run: |
BODY="${BODY//$'\n'/'\n'}"
declare -A platform2label
platform2label["AIX"]="aix";
platform2label["FreeBSD"]="freebsd";
platform2label["Linux ARM64"]="linux";
platform2label["Linux ARMv7"]="arm";
platform2label["Linux PPC64LE"]="ppc";
platform2label["Linux s390x"]="s390";
platform2label["Linux x64"]="linux";
platform2label["macOS ARM64"]="macos";
platform2label["macOS x64"]="macos";
platform2label["SmartOS"]="smartos";
platform2label["Windows"]="windows";
# sed is cleaning up the edges
PLATFORMS=$(echo $BODY | sed 's/^.*Platform\\n\\n//' | sed 's/\(, Other\)\?\\n\\n.*$//') 2> /dev/null
readarray -d , -t list <<< "$PLATFORMS"
labels=
for row in "${list[@]}"; do \
platform=$(echo $row | xargs); \
labels="${labels},${platform2label[$platform]}"; \
done;
echo "::set-output name=LABELS::${labels}"
- name: Add labels
uses: andymckay/labeler@master
with:
add-labels: "${{ steps.extract-labels.outputs.LABELS }}"

0 comments on commit 2d416dc

Please sign in to comment.