diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 0d202d68a..d9f9e5684 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -15,7 +15,8 @@ jobs: triage: runs-on: ubuntu-latest env: - NUMBER: ${{ github.event.issue.number }} + ISSUE_NUMBER: ${{ github.event.issue.number }} + PR_NUMBER: ${{ github.event.pull_request.number }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Get token @@ -29,7 +30,9 @@ jobs: "members": "read" } - name: Add agent-python label - run: gh issue edit "$NUMBER" --add-label "agent-python" + run: | + test -n "$ISSUE_NUMBER" && gh issue edit "$ISSUE_NUMBER" --add-label "agent-python" + test -n "$PR_NUMBER" && gh pr edit "$PR_NUMBER" --add-label "agent-python" - id: is_elastic_member uses: elastic/oblt-actions/github/is-member-of@v1 with: @@ -38,4 +41,6 @@ jobs: github-token: ${{ steps.get_token.outputs.token }} - name: Add community and triage labels if: contains(steps.is_elastic_member.outputs.result, 'false') && github.actor != 'dependabot[bot]' && github.actor != 'elastic-observability-automation[bot]' - run: gh issue edit "$NUMBER" --add-label "community,triage" + run: | + test -n "$ISSUE_NUMBER" && gh issue edit "$ISSUE_NUMBER" --add-label "community,triage" + test -n "$PR_NUMBER" && gh pr edit "$PR_NUMBER" --add-label "community,triage"