This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR Add Remove Labels Based on user input | |
| on: | |
| pull_request_target: | |
| types: [synchronize] | |
| pull_request_review: | |
| types: [submitted, edited] | |
| pull_request_review_comment: | |
| types: [created, edited] | |
| issue_comment: | |
| types: [created, edited, deleted] | |
| # I don't believe the conditional is supported here | |
| # if: | | |
| # contains(github.event.comment.body, '/wip') || | |
| # contains(github.event.comment.body, '/verified') || | |
| # contains(github.event.comment.body, '/lgtm') || | |
| # contains(github.event.comment.body, '/hold') | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| issues: write | |
| jobs: | |
| add-remove-labels: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Acknowledge the request with thumbs up reaction | |
| if: ${{ github.event.comment }} | |
| uses: peter-evans/create-or-update-comment@v4 | |
| with: | |
| comment-id: ${{ github.event.comment.id }} | |
| reactions: '+1' | |
| # This currently fails with either the bot PAT or the standard github token secret | |
| # gh: Insufficient scopes for reacting to this Pull Request Review Comment. (HTTP 403) | |
| # {"message":"Insufficient scopes for reacting to this Pull Request Review Comment.","documentation_url":"https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-pull-request-review-comment","status":"403"} | |
| # It could work if we had a token with the proper permissions. | |
| # See https://github.com/peter-evans/create-or-update-comment/issues/392 for why the action above doesn't work. | |
| # Confirmed as a bug, see: https://github.com/github/docs/issues/36899 | |
| # - name: Acknowledge the review with thumbs up reaction | |
| # if: ${{ github.event.review }} | |
| # env: | |
| # GH_TOKEN: ${{ secrets.OPENDATAHUB_TESTS_BOT_PAT }} | |
| # REVIEW_COMMENT_ID: ${{ github.event.review.id }} | |
| # REPO_NAME: ${{ github.event.repository.name }} | |
| # REPO_OWNER: ${{ github.event.repository.owner.login }} | |
| # run: | | |
| # gh api \ | |
| # --method POST \ | |
| # -H "Accept: application/vnd.github+json" \ | |
| # -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| # /repos/$REPO_OWNER/$REPO_NAME/pulls/comments/$REVIEW_COMMENT_ID/reactions \ | |
| # -f "content=+1" | |
| - name: logging | |
| run: echo '${{ toJson(github.event) }}' | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Run add remove labels | |
| env: | |
| # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.OPENDATAHUB_TESTS_BOT_PAT }} | |
| GITHUB_PR_NUMBER: "${{ github.event.pull_request.number || github.event.issue.number }}" | |
| GITHUB_EVENT_ACTION: ${{ github.event.action }} | |
| GITHUB_EVENT_REVIEW_STATE: ${{ github.event.review.state }} | |
| GITHUB_EVENT_NAME: ${{ github.event_name }} | |
| COMMENT_BODY: ${{ github.event.comment.body }} | |
| REVIEW_COMMENT_BODY: ${{ github.event.review.body }} | |
| GITHUB_USER_LOGIN: ${{ github.event.sender.login }} | |
| ACTION: "add-remove-labels" | |
| run: uv run python .github/workflows/scripts/pr_workflow.py |