forked from linux-test-project/ltp
-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (38 loc) · 1.14 KB
/
wiki-mirror.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) Linux Test Project, 2021
name: "Mirror doc to wiki"
on:
push:
branches:
- master
permissions: {}
jobs:
mirror:
permissions:
contents: write # for git push
runs-on: ubuntu-latest
if: ${{ github.repository == 'linux-test-project/ltp' }}
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 "[email protected]"
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 add new extensions
cp -v $dir/*.asciidoc .
git add .
# only commit if there are changes
git diff-index --quiet HEAD -- || git commit -m "Update to $commit" .
git push