[Feat] refresh token으로 로그인 상태 유지 #23
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: PR Size Labeler | |
on: | |
pull_request: | |
types: [ opened, synchronize, reopened ] | |
jobs: | |
size-label: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Count Lines | |
id: count | |
run: | | |
git fetch origin ${{ github.base_ref }} | |
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-branch | |
# Calculate total changes from base to latest PR head | |
CHANGED_LINES=$(git diff --numstat origin/${{ github.base_ref }}..pr-branch | awk '{sum += $1 + $2} END {print sum}') | |
echo "changed_lines=$CHANGED_LINES" >> $GITHUB_OUTPUT | |
- name: Update size label | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const changedLines = parseInt(process.env.CHANGED_LINES); | |
const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number | |
}); | |
for (const label of currentLabels) { | |
if (label.name.startsWith('size/')) { | |
await github.rest.issues.removeLabel({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
name: label.name | |
}); | |
} | |
} | |
let sizeLabel = ''; | |
if (changedLines >= 1000) { | |
sizeLabel = 'size/XXL'; | |
} else if (changedLines >= 500) { | |
sizeLabel = 'size/XL'; | |
} else if (changedLines >= 100) { | |
sizeLabel = 'size/L'; | |
} else if (changedLines >= 30) { | |
sizeLabel = 'size/M'; | |
} else if (changedLines >= 10) { | |
sizeLabel = 'size/S'; | |
} else { | |
sizeLabel = 'size/XS'; | |
} | |
await github.rest.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
labels: [sizeLabel] | |
}); | |
env: | |
CHANGED_LINES: ${{ steps.count.outputs.changed_lines }} |