Skip to content

build(deps): bump actions/checkout from 5 to 6 in the actions group #111

build(deps): bump actions/checkout from 5 to 6 in the actions group

build(deps): bump actions/checkout from 5 to 6 in the actions group #111

Workflow file for this run

name: Auto Close PR on build.yml Change
on:
pull_request:
paths:
- '.github/workflows/build.yml'
- '.github/workflows/close-pr.yml'
jobs:
auto-close:
permissions:
pull-requests: write
contents: write
runs-on: ubuntu-latest
steps:
- name: Check out PR code
uses: actions/checkout@v6
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Fetch base branch
run: |
# Fetch the base branch from the upstream repository
git remote add upstream https://github.com/dabao1955/kernel_build_action
git fetch upstream main
- name: Check if .github/workflows/main.yml was changed
id: check_files
run: |
# Check for changes in main.yml between PR and base branch
if git diff --name-only HEAD upstream/${{ github.event.pull_request.base.ref }} | grep -q "^.github/workflows/build.yml$"; then
echo "file_changed=true" >> $GITHUB_ENV
else
echo "file_changed=false" >> $GITHUB_ENV
fi
- uses: actions/checkout@v6
with:
path: 1
- name: Close PR if build.yml changed
if: env.file_changed == 'true'
run: |
cd 1 && curl -X PATCH \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d '{"state": "closed", "body": "This pull request has been automatically closed because you cannot submit PRs while build.yml is changing."}' \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}"