Skip to content

Commit 664f586

Browse files
committed
fix(ci): restrict last_modified updates to FAQ files on master PRs
1 parent 58a7844 commit 664f586

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

.github/workflows/update-last-modified.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,18 @@ on:
44
pull_request:
55
branches:
66
- master
7-
- main
87
types:
98
- opened
109
- synchronize
1110
- reopened
1211
paths:
13-
- "_articles/**/*.md"
12+
- "_articles/faq/*.md"
1413

1514
permissions:
1615
contents: write
1716

1817
jobs:
19-
update-on-main-pr:
18+
update-on-master-pr:
2019
if: github.actor != 'github-actions[bot]' && github.event.pull_request.head.repo.full_name == github.repository
2120
runs-on: ubuntu-latest
2221
steps:
@@ -35,7 +34,7 @@ jobs:
3534
git fetch origin "${{ github.event.pull_request.base.ref }}"
3635
3736
git diff --name-only "origin/${{ github.event.pull_request.base.ref }}"...HEAD \
38-
| grep -E '^_articles/.+\.md$' \
37+
| grep -E '^_articles/faq/[^/]+\.md$' \
3938
| sort -u > changed_files.txt || true
4039
4140
count="$(wc -l < changed_files.txt | tr -d ' ')"
@@ -83,6 +82,9 @@ jobs:
8382
8483
git config user.name "github-actions[bot]"
8584
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
86-
git add _articles
85+
while IFS= read -r file; do
86+
[[ -f "$file" ]] || continue
87+
git add "$file"
88+
done < changed_files.txt
8789
git commit -m "chore: update last_modified timestamps"
8890
git push origin HEAD:${{ github.event.pull_request.head.ref }}

0 commit comments

Comments
 (0)