Skip to content

🐜 Study: 도넛과 λ§‰λŒ€ κ·Έλž˜ν”„ #36

🐜 Study: 도넛과 λ§‰λŒ€ κ·Έλž˜ν”„

🐜 Study: 도넛과 λ§‰λŒ€ κ·Έλž˜ν”„ #36

Workflow file for this run

name: Algoritm PR File Mover
on:
pull_request:
types: [ "closed" ]
branches: [ "main" ]
jobs:
file-mover:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@master
with:
fetch-depth: 0
- name: Get PR Infos
run: |
algorithm=$((curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels | \
jq '.[] | select(.name=="Algorithm") .name') || echo '')
echo "IS_ALGORITHM=$algorithm" >> $GITHUB_ENV
echo "PR_AUTHOR=$(jq --raw-output .pull_request.user.login $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
- name: Move Files
if: ${{ env.IS_ALGORITHM && github.event.pull_request.merged }}
run: |
git config --global user.email "bug60t@gmail.com"
git config --global user.name "bugs-bot"
git config --global core.quotepath off
mkdir -p $PR_AUTHOR
files=$(git diff --name-only HEAD^..HEAD | grep -v "^$PR_AUTHOR")
echo "$files" | tr '\n' '\0' | xargs -0 -I {} mv "{}" $PR_AUTHOR/
git add -A && git commit --amend --no-edit --allow-empty
git push --force-with-lease