Skip to content

Commit 881e829

Browse files
committed
Move report reference document generation into a separate action
1 parent fa7ecb7 commit 881e829

File tree

3 files changed

+86
-10
lines changed

3 files changed

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

scripts/copyReportsIntoResults.sh

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,4 @@ for report_source_folder in **/"${REPORTS_DIRECTORY}"; do
4141

4242
rm -rf "${reportTargetDirectory}"
4343
cp -Rp "${report_source_folder}" "${reportTargetDirectory}"
44-
done
45-
46-
# Generate JUPYTER_REPORTS.md containing a reference to all Jupyter Notebook Markdown reports in the "results" directory and its subdirectories.
47-
(cd "./../${RESULTS_DIRECTORY}" && exec "${SCRIPTS_DIR}/documentation/generateJupyterReportReference.sh")
48-
49-
# Generate CSV_REPORTS.md containing a reference to all CSV cypher query reports in the "results" directory and its subdirectories.
50-
(cd "./../${RESULTS_DIRECTORY}" && exec "${SCRIPTS_DIR}/documentation/generateCsvReportReference.sh")
51-
52-
# Generate IMAGES.md containing a reference to all PNG images in the "results" directory and its subdirectories.
53-
(cd "./../${RESULTS_DIRECTORY}" && exec "${SCRIPTS_DIR}/documentation/generateImageReference.sh")
44+
done
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
# Triggers the regeneration of all reference documentations for the reports inside the "results" directory.
4+
# The generation to the reference documentations is delegated to the dedicated scripts.
5+
6+
# Notice that this scripts needs to be executed within the "results" directory.
7+
8+
# Requires generateJupyterReportReference.sh, generateCsvReportReference.sh, generateImageReference.sh
9+
10+
# Fail on any error ("-e" = exit on first error, "-o pipefail" exist on errors within piped commands)
11+
set -o errexit -o pipefail
12+
13+
# Generate JUPYTER_REPORTS.md containing a reference to all Jupyter Notebook Markdown reports in the "results" directory and its subdirectories.
14+
source "${DOCUMENTATION_SCRIPT_DIR}/generateJupyterReportReference.sh"
15+
16+
# Generate CSV_REPORTS.md containing a reference to all CSV cypher query reports in the "results" directory and its subdirectories.
17+
source "${DOCUMENTATION_SCRIPT_DIR}/generateCsvReportReference.sh"
18+
19+
# Generate IMAGES.md containing a reference to all PNG images in the "results" directory and its subdirectories.
20+
source "${DOCUMENTATION_SCRIPT_DIR}/generateImageReference.sh"

0 commit comments

Comments
 (0)