[EGON] Week14 Solutions #438
Workflow file for this run
This file contains 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: π€ Automation | |
on: | |
pull_request_target: | |
types: [opened, reopened] | |
jobs: | |
assign-author: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: toshimaru/auto-author-assign@v2.1.0 | |
label-lang: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- uses: actions/labeler@v5 | |
with: | |
repo-token: ${{ github.token }} | |
assign-reviewer: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get previous PR author and assign as reviewer | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: | | |
current_repo=${{ github.repository }} | |
current_pr_num=${{ github.event.number }} | |
# μ΄μ PR μ€μμ νμ¬ PR μμ±μμ λ€λ₯Έ μμ±μ μ°ΎκΈ° | |
previous_pr_author=$(gh pr list --repo $current_repo \ | |
--state all \ | |
--search "created:<${{ github.event.pull_request.created_at }} sort:created-desc -author:${{ github.actor }}" \ | |
--limit 3 \ | |
--json number,author \ | |
--jq "map(select(.number < $current_pr_num))[0].author.login") | |
if [ -n "$previous_pr_author" ]; then | |
gh pr edit $current_pr_num --repo $current_repo --add-reviewer $previous_pr_author | |
else | |
echo "β No previous PR author found to assign as reviewer" | |
exit 1 | |
fi |