|
| 1 | +# Distributed under the OSI-approved BSD 3-Clause License. |
| 2 | +# See accompanying file LICENSE-BSD for details. |
| 3 | + |
| 4 | +name: ci-issue-labeler |
| 5 | +on: |
| 6 | + issues: |
| 7 | + types: |
| 8 | + - opened |
| 9 | + |
| 10 | +jobs: |
| 11 | + precondition: |
| 12 | + runs-on: ${{ vars.RUNNER }} |
| 13 | + steps: |
| 14 | + - name: Print Contexts/Inputs/Variables/Secrets |
| 15 | + shell: bash |
| 16 | + run: | |
| 17 | + echo "[Contexts]" |
| 18 | + echo "github.job = ${{ github.job }}" |
| 19 | + echo "github.ref = ${{ github.ref }}" |
| 20 | + echo "github.ref_name = ${{ github.ref_name }}" |
| 21 | + echo "github.event_name = ${{ github.event_name }}" |
| 22 | + echo "github.event.action = ${{ github.event.action }}" |
| 23 | + echo "github.event.issue.title = ${{ github.event.issue.title }}" |
| 24 | + echo "github.event.issue.html_url = ${{ github.event.issue.html_url }}" |
| 25 | + echo "[Inputs]" |
| 26 | + echo "[Variables]" |
| 27 | + echo "vars.RUNNER = ${{ vars.RUNNER }}" |
| 28 | + echo "[Secrets]" |
| 29 | + echo "secrets.ACTOR_GITHUB_TOKEN = ${{ secrets.ACTOR_GITHUB_TOKEN }}" |
| 30 | + - name: Check Required Variables |
| 31 | + shell: bash |
| 32 | + run: | |
| 33 | + REQUIRED_VARIABLES_EXIST=true |
| 34 | + if [[ -z "${{ vars.RUNNER }}" ]]; then |
| 35 | + echo "vars.RUNNER is missing." |
| 36 | + REQUIRED_VARIABLES_EXIST=false |
| 37 | + fi |
| 38 | + if [[ "${REQUIRED_VARIABLES_EXIST}" == "false" ]]; then |
| 39 | + echo "Error: Some variables are missing." >&2 |
| 40 | + exit 1 |
| 41 | + fi |
| 42 | + - name: Check Required Secrets |
| 43 | + shell: bash |
| 44 | + run: | |
| 45 | + REQUIRED_SECRETS_EXIST=true |
| 46 | + if [[ -z "${{ secrets.ACTOR_GITHUB_TOKEN }}" ]]; then |
| 47 | + echo "secrets.ACTOR_GITHUB_TOKEN is missing." |
| 48 | + REQUIRED_SECRETS_EXIST=false |
| 49 | + fi |
| 50 | + if [[ "${REQUIRED_SECRETS_EXIST}" == "false" ]]; then |
| 51 | + echo "Error: Some secrets are missing." >&2 |
| 52 | + exit 1 |
| 53 | + fi |
| 54 | +
|
| 55 | + issue-labeler: |
| 56 | + needs: [ 'precondition' ] |
| 57 | + runs-on: ${{ vars.RUNNER }} |
| 58 | + permissions: |
| 59 | + contents: read |
| 60 | + issues: write |
| 61 | + steps: |
| 62 | + - name: Checkout to '${{ github.ref }}' |
| 63 | + uses: actions/checkout@v4 |
| 64 | + with: |
| 65 | + ref: ${{ github.ref }} |
| 66 | + token: ${{ secrets.ACTOR_GITHUB_TOKEN }} |
| 67 | + fetch-depth: 0 |
| 68 | + |
| 69 | + - name: Parse 'project_request.yml' issue form |
| 70 | + id: parse-proj-req |
| 71 | + uses: stefanbuck/github-issue-parser@v3 |
| 72 | + with: |
| 73 | + template-path: .github/ISSUE_TEMPLATE/project_request.yml |
| 74 | + |
| 75 | + - name: Set labels based on 'generator' field for 'project_request.yml' issue form |
| 76 | + uses: redhat-plumbers-in-action/advanced-issue-labeler@v2 |
| 77 | + with: |
| 78 | + issue-form: ${{ steps.parse-proj-req.outputs.jsonString }} |
| 79 | + section: generator |
| 80 | + token: ${{ secrets.ACTOR_GITHUB_TOKEN }} |
0 commit comments