File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed
Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 66 - ' **/*.md'
77 - ' .github/workflows/android-test-ci.yml'
88 - ' .github/workflows/codeql-analysis.yml'
9+ - ' .github/workflows/close-empty-xml.yml'
910 - ' .github/workflows/stale.yml'
1011 pull_request :
1112 paths-ignore :
1213 - ' **/*.md'
1314 - ' .github/workflows/android-test-ci.yml'
1415 - ' .github/workflows/codeql-analysis.yml'
16+ - ' .github/workflows/close-empty-xml.yml'
1517 - ' .github/workflows/stale.yml'
1618 workflow_dispatch : {}
1719
Original file line number Diff line number Diff line change 77 - ' **/*.md'
88 - ' .github/workflows/android-ci.yml'
99 - ' .github/workflows/codeql-analysis.yml'
10+ - ' .github/workflows/close-empty-xml.yml'
1011 - ' .github/workflows/stale.yml'
1112 workflow_dispatch : {}
1213
Original file line number Diff line number Diff line change 1+ name : Close Empty Translation PRs
2+
3+ on :
4+ pull_request :
5+ types : [opened, synchronize]
6+
7+ jobs :
8+ check-xml-content :
9+ runs-on : ubuntu-latest
10+ steps :
11+ - name : Checkout PR branch
12+ uses : actions/checkout@v3
13+ - name : Fetch base branch
14+ run : |
15+ git fetch origin ${{ github.event.pull_request.base.ref }}
16+ - name : List changed XML files
17+ id : list_files
18+ run : |
19+ FILES=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }}...HEAD | grep '\.xml$' || true)
20+ echo "Changed XML files:"
21+ echo "$FILES"
22+ echo "files=$FILES" >> $GITHUB_OUTPUT
23+ - name : Check for meaningful XML content
24+ run : |
25+ EMPTY=true
26+ for file in ${{ steps.list_files.outputs.files }}; do
27+ if grep -q '<string' "$file"; then
28+ EMPTY=false
29+ break
30+ fi
31+ done
32+ if $EMPTY; then
33+ echo "No meaningful XML content found. Closing PR."
34+ gh pr close ${{ github.event.pull_request.number }} --comment "Closed: No meaningful translation content in XML files."
35+ else
36+ echo "Meaningful content found. PR stays open."
37+ env :
38+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments