Skip to content

Commit

Permalink
add base pr comment
Browse files Browse the repository at this point in the history
  • Loading branch information
rnetser committed Nov 15, 2024
1 parent d49b814 commit 672654a
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/comment-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: 'Add Labels on PR Events'

on:
issue_comment:
types: [created]
pull_request_review:
types: [submitted]

jobs:
add-label:
runs-on: ubuntu-latest
steps:
- name: 'Checkout code'
uses: actions/checkout@v4

- name: 'Determine event type'
id: event-type
run: echo "::set-output name=event_type::${{ github.event_name }}"

- name: 'Extract Commentator Name'
if: ${{ steps.event-type.outputs.event_type == 'issue_comment' }}
id: extract-commentator
run: echo "::set-output name=commentator::${{ github.event.comment.user.login }}"

- name: 'Create or update label for comment'
if: ${{ steps.event-type.outputs.event_type == 'issue_comment' }}
uses: peter-evans/create-or-update-label@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: 'commented-by-${{ steps.extract-commentator.outputs.commentator }}'
color: 'FF5733' # Choose a color for the label

- name: 'Apply label to PR for comment'
if: ${{ steps.event-type.outputs.event_type == 'issue_comment' }}
uses: actions-ecosystem/action-add-labels@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
labels: 'commented-by-${{ steps.extract-commentator.outputs.commentator }}'

- name: 'Extract Reviewer Name'
if: ${{ steps.event-type.outputs.event_type == 'pull_request_review' && github.event.review.state == 'changes_requested' }}
id: extract-reviewer
run: echo "::set-output name=reviewer::${{ github.event.review.user.login }}"

- name: 'Create or update label for review'
if: ${{ steps.event-type.outputs.event_type == 'pull_request_review' && github.event.review.state == 'changes_requested' }}
uses: peter-evans/create-or-update-label@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: 'changes-requested-by-${{ steps.extract-reviewer.outputs.reviewer }}'
color: 'FF0000' # Choose a color for the label

- name: 'Apply label to PR for review'
if: ${{ steps.event-type.outputs.event_type == 'pull_request_review' && github.event.review.state == 'changes_requested' }}
uses: actions-ecosystem/action-add-labels@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
labels: 'changes-requested-by-${{ steps.extract-reviewer.outputs.reviewer }}'
File renamed without changes.

0 comments on commit 672654a

Please sign in to comment.