Skip to content

Commit 98bf30d

Browse files
committed
test: add last_modified workflow and sample doc change
1 parent fffd10c commit 98bf30d

2 files changed

Lines changed: 88 additions & 1 deletion

File tree

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Update last_modified
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types:
8+
- opened
9+
- synchronize
10+
- reopened
11+
paths:
12+
- "_articles/**/*.md"
13+
14+
permissions:
15+
contents: write
16+
17+
jobs:
18+
update-on-main-pr:
19+
if: github.actor != 'github-actions[bot]' && github.event.pull_request.head.repo.full_name == github.repository
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout PR head branch
23+
uses: actions/checkout@v4
24+
with:
25+
ref: ${{ github.event.pull_request.head.ref }}
26+
fetch-depth: 0
27+
28+
- name: Collect target files
29+
id: targets
30+
shell: bash
31+
run: |
32+
set -euo pipefail
33+
34+
git fetch origin "${{ github.event.pull_request.base.ref }}"
35+
36+
git diff --name-only "origin/${{ github.event.pull_request.base.ref }}"...HEAD \
37+
| grep -E '^_articles/.+\.md$' \
38+
| sort -u > changed_files.txt || true
39+
40+
count="$(wc -l < changed_files.txt | tr -d ' ')"
41+
echo "count=$count" >> "$GITHUB_OUTPUT"
42+
43+
- name: Update front matter
44+
if: steps.targets.outputs.count != '0'
45+
shell: bash
46+
run: |
47+
set -euo pipefail
48+
timestamp="$(date '+%Y-%m-%d %H:%M:%S %z')"
49+
50+
while IFS= read -r file; do
51+
[[ -f "$file" ]] || continue
52+
53+
TS="$timestamp" perl -0777 -i -pe '
54+
BEGIN { $ts = $ENV{"TS"}; }
55+
56+
s{\A---\R(.*?)\R---(?:\R|$)}{
57+
my $fm = $1;
58+
59+
if ($fm =~ /^last_modified:.*$/m) {
60+
$fm =~ s/^last_modified:.*$/last_modified: $ts/m;
61+
} elsif ($fm =~ /^date:.*$/m) {
62+
$fm =~ s/^(date:.*)$/$1\nlast_modified: $ts/m;
63+
} else {
64+
$fm .= "\nlast_modified: $ts";
65+
}
66+
67+
"---\n$fm\n---\n";
68+
}es;
69+
' "$file"
70+
done < changed_files.txt
71+
72+
- name: Commit and push to PR branch
73+
if: steps.targets.outputs.count != '0'
74+
shell: bash
75+
run: |
76+
set -euo pipefail
77+
78+
if git diff --quiet; then
79+
echo "No timestamp updates needed."
80+
exit 0
81+
fi
82+
83+
git config user.name "github-actions[bot]"
84+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
85+
git add _articles
86+
git commit -m "chore: update last_modified timestamps"
87+
git push origin HEAD:${{ github.event.pull_request.head.ref }}

_articles/faq/failed-to-load-resource.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ You get an error message that says **"Failed to load resource: net::ERR_CERT_DAT
2222

2323
By default, "127.0.0.1" is used for service connection. "127.0.0.1" uses a self-signed SSL certificate without an expiry date. It is installed to your system so that the browser can trust it. If your environment requires high level security, self-signed certificates may not be accepted. Moreover, it is not easy to install the self-signed certificate for systems like Chrome OS.
2424

25-
In this case, we provide a domain, "local.dynamsoft.com", which points to "127.0.0.1". It has a VeriSign’ed certificate that has an expiry date. The most recent expired "local.dynamsoft.com" certificate expired on <font color=red>2025 November 20th</font>, and the latest certificate will expire on <font color=red>2026 November 21st</font>.
25+
In this case, we provide a domain, "local.dynamsoft.com", which points to "127.0.0.1". It has a VeriSign-signed certificate that has an expiry date. The most recent expired "local.dynamsoft.com" certificate expired on <font color=red>2025 November 20th</font>, and the latest certificate will expire on <font color=red>2026 November 21st</font>.
2626

2727
> [!NOTE]
2828
> All official third-party certificates come with an expiry date (generally one year). If `local.dynamsoft.com` is used, the certificate needs to be updated each year.

0 commit comments

Comments
 (0)