Skip to content

ci: add upstream folder change check #1

ci: add upstream folder change check

ci: add upstream folder change check #1

name: Check Upstream Changes
on:
pull_request:
paths:
- '**/upstream/**'
permissions:
contents: read
actions: read
jobs:
check-upstream-changes:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Fetch master branch
run: git fetch origin master
- name: Detect changed upstream paths
id: upstream_changes
run: |
changed=$(git diff-tree -r --no-commit-id --name-only origin/master..HEAD | grep '/upstream/' || true)
if [ -z "$changed" ]; then
echo "No upstream folders were modified."
echo "has_changes=false" >> "$GITHUB_OUTPUT"
else
echo "The following files inside upstream folders were modified:"
echo "$changed"
echo "has_changes=true" >> "$GITHUB_OUTPUT"
echo "changed_files<<EOF" >> "$GITHUB_OUTPUT"
echo "$changed" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
fi
- name: Warn about upstream changes
if: steps.upstream_changes.outputs.has_changes == 'true'
run: |
echo "::warning::This PR modifies files inside one or more 'upstream' folders."
echo "::warning::Changes to upstream manifests are usually wrong and reviewed carefully."
echo ""
echo "Changed upstream files:"
echo "${{ steps.upstream_changes.outputs.changed_files }}"