chore(deps): update npm #744
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: Pull Request Title Modifier | |
on: | |
pull_request: | |
paths-ignore: | |
- src/** | |
- static/** | |
- tailwind.config.* | |
- package.json | |
env: | |
PREFIX: infra | |
jobs: | |
pr-title-modifier: | |
name: PR Title Modifier | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.user.login != 'renovate[bot]' && github.event.pull_request.user.login != 'emeraldstudio-bot' | |
permissions: | |
pull-requests: write | |
steps: | |
- name: 📂 Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
fetch-depth: 2 | |
- name: 📋 Count all changed files for this commit | |
id: infra-changed-files | |
run: | | |
count=$(git diff --name-only HEAD^ HEAD | grep -E '.github/|.husky/|.gitignore|LICENSE|README.md' | wc -l) | |
if [ $count -gt 0 ]; then | |
echo "$count infrastructure files changed in the last commit" | |
echo "infra_changes=true" >> $GITHUB_OUTPUT | |
else | |
echo "No infrastructure files changed in the last commit" | |
echo "infra_changes=false" >> $GITHUB_OUTPUT | |
fi | |
- name: 📝 Modify PR Title | |
if: steps.infra-changed-files.outputs.infra_changes == 'true' | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
current_title=$(gh pr view --json title --jq '.title') | |
if [[ $current_title != "${{ env.PREFIX }}: "* ]]; then | |
gh pr edit --title "${{ env.PREFIX }}: $current_title" | |
fi |