Pixel change #15
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 on Specific File Change | |
on: | |
pull_request: | |
types: | |
- synchronize | |
jobs: | |
auto_merge: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Check for changes | |
id: check_changes | |
run: | | |
# Define the file path you're interested in | |
FILE_PATH="src/data/pixel.ts" | |
# Get the list of changed files in the PR | |
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }}) | |
# Check if the file of interest is in the changed files list | |
if [ "$CHANGED_FILES" = "$FILE_PATH" ]; then | |
echo "Only the specific file changed. Merging PR..." | |
echo "::set-output name=merge::true" | |
else | |
echo "Other files changed. No action needed." | |
echo "::set-output name=merge::false" | |
fi | |
- name: Merge PR | |
if: steps.check_changes.outputs.merge == 'true' | |
run: | | |
# Merge the pull request | |
# You'll need to customize this command based on your branch and merge strategy | |
git merge ${{ github.sha }} | |
git push origin HEAD:refs/heads/main |