-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (74 loc) · 2.75 KB
/
docs.yaml
File metadata and controls
74 lines (74 loc) · 2.75 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Reusable Docs
on:
workflow_call:
inputs:
botEmail:
required: false
description: The email of the bot that will appear in the GitOps commit
default: dev.bot@parcellab.com
type: string
botName:
required: false
description: The name of the bot that will appear in the GitOps commit
default: parcellab-dev-bot
type: string
defaultBranch:
required: false
description: The default branch
default: main
type: string
docsRepo:
required: false
description: The repository within Github that holds the central documentation files
default: parcelLab/documentation
type: string
runner:
required: false
description: Runner type
default: ubuntu-latest
type: string
secrets:
repoAccessToken:
required: true
description: The Github token to perform operations cross-repo (not github.token!)
jobs:
jekyll:
if: github.ref == 'refs/heads/${{ inputs.defaultBranch }}'
runs-on: ${{ inputs.runner }}
steps:
- name: Load workflow variables
id: vars
run: |
# shellcheck disable=SC2086
echo "docs-push-folder=${{ github.workspace }}/remote/repos/${{ github.event.repository.name }}" >> $GITHUB_OUTPUT
- name: Checkout current git repository
uses: actions/checkout@v3
with:
path: this
- name: Checkout ${{ inputs.docsRepo }} git repository
uses: actions/checkout@v3
with:
path: remote
ref: main
repository: ${{ inputs.docsRepo }}
token: ${{ secrets.repoAccessToken }}
- name: Commit markdown files
continue-on-error: true
run: |
rm -rf ${{ steps.vars.outputs.docs-push-folder }}
mkdir -p ${{ steps.vars.outputs.docs-push-folder }}
cd ${{ steps.vars.outputs.docs-push-folder }}
git config --global user.email "${{ inputs.botEmail }}"
git config --global user.name "${{ inputs.botName }}"
rsync -am --prune-empty-dirs --include='*.md' --include='.assets/*' --include='*/' --exclude='*' ${{ github.workspace }}/this/${{ steps.vars.outputs.docs-push-folder }}
git add -v .
git commit -m "Update ${{ github.event.repository.name }} repo documentation"
- name: Push changes to ${{ inputs.docsRepo }} git repository
if: success()
uses: ad-m/github-push-action@4cc74773234f74829a8c21bc4d69dd4be9cfa599
with:
directory: ${{ steps.vars.outputs.docs-push-folder }}
repository: ${{ inputs.docsRepo }}
github_token: ${{ secrets.repoAccessToken }}
branch: ${{ inputs.defaultBranch }}
force: true