diff --git a/.github/workflows/request-labeler.yml b/.github/workflows/request-labeler.yml new file mode 100644 index 00000000..6a9f45d7 --- /dev/null +++ b/.github/workflows/request-labeler.yml @@ -0,0 +1,35 @@ +name: "Instance Request Labeler" +on: + issues: + types: + - reopened + - opened + +permissions: + issues: write + contents: read + +jobs: + labeler: + runs-on: ubuntu-latest + if: contains(github.event.pull_request.labels.*.name, 'instance:requested') + steps: + - name: Issue Forms Body Parser + id: parse + uses: zentered/issue-forms-body-parser@v2.0.0 + + - name: Extract issue fields + id: extract + run: | + instance_flavor = ${{ toJSON(steps.parse.outputs.data) }} | \ + jq .instance-flavor.text + echo "instance_flavor [$instance_flavor]" + echo "instance_flavor=$instance_flavor" >> $GITHUB_OUTPUT + + - name: Add flavor label + run: gh issue edit "$NUMBER" --add-label "$LABELS" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.issue.number }} + LABELS: flavor:${{ steps.extract.outputs.instance_flavor }}