summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorBigCoke233 <hi@guhub.cn>2026-01-05 21:24:09 +0800
committerBigCoke233 <hi@guhub.cn>2026-01-05 21:24:09 +0800
commit77b00d6e97fefc9acf36e466e554796e20ff4d2c (patch)
tree12f1b0a6e8d634e14a7bb89310c83884053e05eb /.github
parent0c381c07be472a234d29e67828daa1abc65350a1 (diff)
chore: add workflow to fetch webmentions
Former-commit-id: ee9d9e9c1ab950b481a5f325bef38da2d962a928
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/fetch-webmentions.yml52
1 files changed, 52 insertions, 0 deletions
diff --git a/.github/workflows/fetch-webmentions.yml b/.github/workflows/fetch-webmentions.yml
new file mode 100644
index 00000000..19856cd5
--- /dev/null
+++ b/.github/workflows/fetch-webmentions.yml
@@ -0,0 +1,52 @@
+name: Fetch Webmentions
+
+on:
+ schedule:
+ - cron: "*/30 * * * *" # every 30 minutes
+ workflow_dispatch:
+
+jobs:
+ fetch:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Fetch webmentions
+ env:
+ TOKEN: ${{ secrets.WEBMENTION_IO_TOKEN }}
+ DOMAIN: ${{ secrets.WEBMENTION_IO_DOMAIN }}
+ run: |
+ mkdir -p data
+
+ curl -s "https://webmention.io/api/mentions.jf2?domain=$DOMAIN&token=$TOKEN" \
+ | jq '
+ .children
+ | sort_by(."wm-target")
+ | group_by(."wm-target")
+ | map({
+ (.[0]."wm-target"):
+ map({
+ type: ."wm-property",
+ author: .author,
+ url: .url,
+ source: ."wm-source",
+ published: .published,
+ received: ."wm-received"
+ })
+ })
+ | add
+ ' > data/webmentions.json
+
+ - name: Commit if changed
+ run: |
+ if git diff --quiet; then
+ echo "No changes"
+ exit 0
+ fi
+
+ git config user.name "github-actions"
+ git config user.email "github-actions@github.com"
+ git add data/webmentions.json
+ git commit -m "chore: update webmentions"
+ git push