Skip to content

Commit 1c7ad66

Browse files
committed
Add GitHub actions to generate documentation
1 parent 8fda886 commit 1c7ad66

File tree

3 files changed

+174
-0
lines changed

3 files changed

+174
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Generate cypher reference documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- '**/*.cypher' # Only run when cypher files changed
9+
- '.github/workflows/cypher-reference-documentation.yml' # or when this file was changed
10+
pull_request:
11+
branches:
12+
- main
13+
paths:
14+
- '**/*.cypher' # Only run when cypher files changed
15+
- '.github/workflows/cypher-reference-documentation.yml' # or when this file was changed
16+
17+
jobs:
18+
reports:
19+
runs-on: ubuntu-latest
20+
env:
21+
CI_COMMIT_MESSAGE: Automated cypher reference document generation (CI)
22+
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Continuous Integration
23+
24+
steps:
25+
- name: Checkout git repository
26+
uses: actions/checkout@v3
27+
with:
28+
token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
29+
30+
- name: Generate cypher reference document
31+
working-directory: cypher
32+
run: |
33+
./../scripts/generateCypherReference.sh
34+
35+
- name: Archive generated cypher reference document
36+
uses: actions/upload-artifact@v3
37+
with:
38+
name: cypher-reference-document
39+
path: ./cypher/CYPHER.md
40+
if-no-files-found: error
41+
retention-days: 5
42+
43+
- name: Use git to detect changes in the regenerated document and set generated_document_changed
44+
run: git diff-index --quiet HEAD || echo "generated_document_changed=true" >> $GITHUB_ENV
45+
46+
- name: Display generated_document_changed
47+
run: echo "generated_document_changed=${{ env.generated_document_changed}}"
48+
49+
- name: Commit generated cypher reference document if there were changes
50+
# Only run when a pull request gets merged or a commit is pushed to the main branch.
51+
# And only run when the generated document changed to avoid an empty commit or an error while committing.
52+
if: github.event_name == 'push' && env.generated_document_changed
53+
run: |
54+
git config --global user.name '${{ env.CI_COMMIT_AUTHOR }}'
55+
git config --global user.email '[email protected]'
56+
git add ./cypher/CYPHER.md
57+
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
58+
git push
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Generate environment variables reference documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- '**/*.sh' # Only run when script files changed
9+
- '.github/workflows/environment-variables-reference-documentation.yml' # or when this file was changed
10+
pull_request:
11+
branches:
12+
- main
13+
paths:
14+
- '**/*.sh' # Only run when script files changed
15+
- '.github/workflows/environment-variables-reference-documentation.yml' # or when this file was changed
16+
17+
jobs:
18+
reports:
19+
runs-on: ubuntu-latest
20+
env:
21+
CI_COMMIT_MESSAGE: Automated environment variables documentation generation (CI)
22+
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Continuous Integration
23+
24+
steps:
25+
- name: Checkout git repository
26+
uses: actions/checkout@v3
27+
with:
28+
token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
29+
30+
- name: Generate environment variables reference document
31+
working-directory: scripts
32+
run: |
33+
./generateEnvironmentVariablesReference.sh
34+
35+
- name: Archive generated environment variables reference document
36+
uses: actions/upload-artifact@v3
37+
with:
38+
name: environment-variables-reference-document
39+
path: ./scripts/ENVIRONMENT_VARIABLES.md
40+
if-no-files-found: error
41+
retention-days: 5
42+
43+
- name: Use git to detect changes in the regenerated document and set generated_document_changed
44+
run: git diff-index --quiet HEAD || echo "generated_document_changed=true" >> $GITHUB_ENV
45+
46+
- name: Display generated_document_changed
47+
run: echo "generated_document_changed=${{ env.generated_document_changed}}"
48+
49+
- name: Commit generated environment variables reference document if there were changes
50+
# Only run when a pull request gets merged or a commit is pushed to the main branch.
51+
# And only run when the generated document changed to avoid an empty commit or an error while committing.
52+
if: github.event_name == 'push' && env.generated_document_changed
53+
run: |
54+
git config --global user.name '${{ env.CI_COMMIT_AUTHOR }}'
55+
git config --global user.email '[email protected]'
56+
git add ./scripts/ENVIRONMENT_VARIABLES.md
57+
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
58+
git push
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Generate scripts reference documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- '**/*.sh' # Only run when script files changed
9+
- '.github/workflows/scripts-reference-documentation.yml' # or when this file was changed
10+
pull_request:
11+
branches:
12+
- main
13+
paths:
14+
- '**/*.sh' # Only run when script files changed
15+
- '.github/workflows/scripts-reference-documentation.yml' # or when this file was changed
16+
17+
jobs:
18+
reports:
19+
runs-on: ubuntu-latest
20+
env:
21+
CI_COMMIT_MESSAGE: Automated scripts reference document generation (CI)
22+
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Continuous Integration
23+
24+
steps:
25+
- name: Checkout git repository
26+
uses: actions/checkout@v3
27+
with:
28+
token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
29+
30+
- name: Generate scripts reference document
31+
working-directory: scripts
32+
run: |
33+
./generateScriptReference.sh
34+
35+
- name: Archive generated scripts reference document
36+
uses: actions/upload-artifact@v3
37+
with:
38+
name: scripts-reference-document
39+
path: ./scripts/SCRIPTS.md
40+
if-no-files-found: error
41+
retention-days: 5
42+
43+
- name: Use git to detect changes in the regenerated document and set generated_document_changed
44+
run: git diff-index --quiet HEAD || echo "generated_document_changed=true" >> $GITHUB_ENV
45+
46+
- name: Display generated_document_changed
47+
run: echo "generated_document_changed=${{ env.generated_document_changed}}"
48+
49+
- name: Commit generated scripts reference document if there were changes
50+
# Only run when a pull request gets merged or a commit is pushed to the main branch.
51+
# And only run when the generated document changed to avoid an empty commit or an error while committing.
52+
if: github.event_name == 'push' && env.generated_document_changed
53+
run: |
54+
git config --global user.name '${{ env.CI_COMMIT_AUTHOR }}'
55+
git config --global user.email '[email protected]'
56+
git add ./scripts/SCRIPTS.md
57+
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
58+
git push

0 commit comments

Comments
 (0)