public-image-mirror/.github/workflows/verify-pr.yml

37 lines
1.0 KiB
YAML

name: Verify PR
on:
pull_request_target:
branches: [main]
paths:
- 'mirror.txt'
- 'allows.txt'
permissions:
issues: write
pull-requests: write
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
verify-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Commit PR
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
wget -O pr.patch https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}.patch && \
git am -3 pr.patch &&
rm -rf pr.patch
- name: Verify allows.txt sort
run: |
./hack/verify-image-match.sh allows.txt || {
echo "Please run './hack/fmt-image-match.sh allows.txt'"
gh pr comment "${{ github.event.pull_request.number }}" --body '请运行 `./hack/fmt-image-match.sh allows.txt` 对内容进行排序'
exit 1
}