[LTP] [PATCH 1/1] github: Add action to update wiki

Petr Vorel pvorel@suse.cz
Fri Dec 10 14:43:31 CET 2021


Suggested-by: Smitop <se@smitop.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi,

I have custom script for updating wiki, but I got fed up by running it.
I thought it'd be done with git remote hooks, but they're not supported.
Then I got hint from Smitop (most of the code is actually from him,
thanks!).

Tested on my fork:
https://github.com/pevik/ltp/runs/4477321979?check_suite_focus=true
https://github.com/pevik/ltp/wiki/Test-Writing-Guidelines#0-special-paragraph-for-testing

Next could be uploading metadata HTML and PDF to http://linux-test-project.github.io/.

Kind regards,
Petr

 .github/workflows/wiki-mirror.yml | 53 +++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 .github/workflows/wiki-mirror.yml

diff --git a/.github/workflows/wiki-mirror.yml b/.github/workflows/wiki-mirror.yml
new file mode 100644
index 000000000..44a3e9ed7
--- /dev/null
+++ b/.github/workflows/wiki-mirror.yml
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) Linux Test Project, 2021
+
+name: "Mirror doc to wiki"
+
+on:
+  push:
+    branches:
+      - master
+    paths:
+      - 'doc/**'
+
+jobs:
+  mirror:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout LTP
+        uses: actions/checkout@v2
+        with:
+          path: ltp
+
+      - name: Checkout LTP wiki
+        uses: actions/checkout@v2
+        with:
+          repository: "linux-test-project/ltp.wiki"
+          path: ltp.wiki
+
+      - name: Copy files, push
+        run: |
+          git config --global user.email "actions@github.com"
+          git config --global user.name "Wiki mirror"
+
+          dir="$GITHUB_WORKSPACE/ltp/doc/"
+          cd $dir
+          commit=$(git log --pretty=format:"%h (\"%s\")" -1 .)
+
+          cd $GITHUB_WORKSPACE/ltp.wiki
+
+          # Don't forget to update this list, keep it sorted
+          cp -v $dir/c-test-api.txt C-Test-API.asciidoc
+          cp -v $dir/c-test-tutorial-simple.txt C-Test-Case-Tutorial.asciidoc
+          cp -v $dir/library-api-writing-guidelines.txt LTP-Library-API-Writing-Guidelines.asciidoc
+          cp -v $dir/maintainer-patch-review-checklist.txt Maintainer-Patch-Review-Checklist.asciidoc
+          cp -v $dir/network-c-api.txt C-Test-Network-API.asciidoc
+          cp -v $dir/shell-test-api.txt Shell-Test-API.asciidoc
+          cp -v $dir/supported-kernel-libc-versions.txt Supported-kernel,-libc,-toolchain-versions.asciidoc
+          cp -v $dir/test-writing-guidelines.txt Test-Writing-Guidelines.asciidoc
+          cp -v $dir/user-guide.txt User-Guidelines.asciidoc
+
+          git add .
+          # only commit if there are changes
+          git diff-index --quiet HEAD -- || git commit -m "Update to $commit" .
+          git push
-- 
2.34.1



More information about the ltp mailing list