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
0 commit comments