Update README.md #2
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: Auto Merge README Changes | |
on: | |
pull_request_target: | |
types: [opened, synchronize, reopened] | |
paths: | |
- 'README.md' | |
permissions: | |
contents: write | |
pull-requests: write | |
issues: write | |
actions: write | |
jobs: | |
auto-merge: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Check if PR only modifies README.md | |
id: check_files | |
run: | | |
base_sha="${{ github.event.pull_request.base.sha }}" | |
head_sha="${{ github.event.pull_request.head.sha }}" | |
files_changed=$(git diff --name-only $base_sha $head_sha) | |
if [ "$files_changed" == "README.md" ]; then | |
echo "only_readme=true" >> $GITHUB_OUTPUT | |
else | |
echo "only_readme=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Auto-merge PR | |
if: steps.check_files.outputs.only_readme == 'true' | |
run: | | |
gh pr merge --auto --merge "${{ github.event.pull_request.number }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |