Skip to content

Commit 84a8d23

Browse files
authored
Merge pull request #2 from devhatt/ajust-assign-author
analize pr context
2 parents d97357b + fde8376 commit 84a8d23

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

.github/workflows/auto-assign.yml

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Auto-assign workflows
22

33
on:
44
workflow_call:
5+
workflow_dispatch:
56

67
jobs:
78
assign-on-issue:
@@ -37,11 +38,22 @@ jobs:
3738
assing-contributor-on-pr:
3839
runs-on: ubuntu-latest
3940
if: ${{github.event_name == 'pull_request'}}
41+
4042
steps:
43+
- name: Check if pr has assignee
44+
id: check
45+
run: |
46+
ASSIGNEES=$(curl -H "Authorization: token ${{secrets.PERSONAL_ACCESS_TOKEN}}" \
47+
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/assignees" | jq length)
48+
echo "::set-output name=assignees::$ASSIGNEES"
49+
shell: bash
50+
4151
- name: Checkout
52+
if: ${{ steps.check.outputs.assignees == '0' }}
4253
uses: actions/checkout@v4.1.7
4354

4455
- name: Assigna o criador do pr no proprio pr
56+
if: ${{ steps.check.outputs.assignees == '0' }}
4557
run: gh pr edit ${{ github.event.pull_request.number }} --add-assignee ${{ github.actor }}
4658
env:
4759
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/base-workflows.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Base Actions
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request:
7+
8+
jobs:
9+
assignes:
10+
uses: devhatt/workflows/.github/workflows/auto-assign.yml@main
11+
secrets: inherit

0 commit comments

Comments
 (0)