Skip to content

Commit

Permalink
Merge pull request #2 from devhatt/ajust-assign-author
Browse files Browse the repository at this point in the history
analize pr context
  • Loading branch information
PiluVitu authored Aug 20, 2024
2 parents d97357b + fde8376 commit 84a8d23
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/auto-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Auto-assign workflows

on:
workflow_call:
workflow_dispatch:

jobs:
assign-on-issue:
Expand Down Expand Up @@ -37,11 +38,22 @@ jobs:
assing-contributor-on-pr:
runs-on: ubuntu-latest
if: ${{github.event_name == 'pull_request'}}

steps:
- name: Check if pr has assignee
id: check
run: |
ASSIGNEES=$(curl -H "Authorization: token ${{secrets.PERSONAL_ACCESS_TOKEN}}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/assignees" | jq length)
echo "::set-output name=assignees::$ASSIGNEES"
shell: bash

- name: Checkout
if: ${{ steps.check.outputs.assignees == '0' }}
uses: actions/checkout@v4.1.7

- name: Assigna o criador do pr no proprio pr
if: ${{ steps.check.outputs.assignees == '0' }}
run: gh pr edit ${{ github.event.pull_request.number }} --add-assignee ${{ github.actor }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions .github/workflows/base-workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Base Actions

on:
issue_comment:
types: [created]
pull_request:

jobs:
assignes:
uses: devhatt/workflows/.github/workflows/auto-assign.yml@main
secrets: inherit

0 comments on commit 84a8d23

Please sign in to comment.