Skip to content

Commit 8241533

Browse files
update workflows
1 parent 06d8643 commit 8241533

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

.github/workflows/android-ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ on:
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

.github/workflows/android-test-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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 }}

0 commit comments

Comments
 (0)