継続届: thirofoo #3
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 Normalizer | |
on: | |
pull_request: | |
types: [opened] | |
branches: | |
- main | |
paths: | |
- "members/**/*.json" | |
- ".github/workflows/pr-normalizer.yaml" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
normalize-pr: | |
name: Normalize PR | |
runs-on: ubuntu-latest | |
if: github.repository == 'saitamau-maximum/members' | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: Is bot? | |
id: check_is_bot | |
run: | | |
if [ "${{ github.event.pull_request.user.login }}" == 'github-actions[bot]' ]; then | |
IS_BOT="true" | |
else | |
IS_BOT="false" | |
fi | |
echo "IS_BOT=$IS_BOT" >> $GITHUB_OUTPUT | |
echo "[DEBUG] IS_BOT: $IS_BOT" | |
- name: Is the latest diff is Added or Modified? | |
id: check_is_added | |
if: steps.check_is_bot.outputs.IS_BOT == 'false' | |
run: | | |
ADDED_LINE=$(git diff --name-only ${{ github.event.pull_request.base.sha }} origin/main | grep '^A' | wc -l) | |
if [ $ADDED_LINE -gt 0 ]; then | |
IS_ADDED="true" | |
else | |
IS_ADDED="false" | |
fi | |
echo "IS_ADDED=$IS_ADDED" >> $GITHUB_OUTPUT | |
echo "[DEBUG] IS_ADDED: $IS_ADDED" | |
- name: Update Pull Request's Title (Added) | |
if: steps.check_is_added.outputs.IS_ADDED == 'true' && steps.check_is_bot.outputs.IS_BOT == 'false' | |
run: | | |
gh pr edit ${{ github.event.pull_request.number }} --title "入部届: ${{ github.event.pull_request.user.login }}" | |
- name: Update Pull Request's Title (Modified) | |
if: steps.check_is_added.outputs.IS_ADDED == 'false' && steps.check_is_bot.outputs.IS_BOT == 'false' | |
run: | | |
gh pr edit ${{ github.event.pull_request.number }} --title "継続届: ${{ github.event.pull_request.user.login }}" |