Skip to content

Commit 5e44003

Browse files
authored
Merge pull request #11 from JohT/feature/provide-current-folder-for-every-analysis-project
Copy new analysis results into the "latest" folder of the project
2 parents e194a7e + 34326fd commit 5e44003

File tree

7 files changed

+35
-1718
lines changed

7 files changed

+35
-1718
lines changed

.github/workflows/internal-commit-results.yml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Commit Results
2-
32
on:
43
workflow_call:
54
inputs:
@@ -18,9 +17,19 @@ on:
1817
type: string
1918
default: "ci: Add automated results"
2019
commit-directory:
21-
description: "The directory to commit"
20+
description: "The directory where the artifacts will be downloaded and committed"
2221
required: true
2322
type: string
23+
second-commit-directory:
24+
description: "An optional second directory where the same files will be copied and committed"
25+
required: false
26+
type: string
27+
default: ""
28+
file-filter:
29+
description: "A filter to apply to files in the commit-directory when staging them with git add. Example: *.md"
30+
required: false
31+
type: string
32+
default: ""
2433
uploaded-artifact-name:
2534
description: "The name of the uploaded artifact"
2635
required: true
@@ -45,18 +54,35 @@ jobs:
4554
with:
4655
name: ${{ inputs.uploaded-artifact-name }}
4756
path: ${{ inputs.commit-directory }}
48-
57+
58+
- name: Copy artifacts into the second directory
59+
if: inputs.second-commit-directory != ''
60+
run: rm -rf ${{ inputs.second-commit-directory }} && cp -r ${{ inputs.commit-directory }} ${{ inputs.second-commit-directory }}
61+
4962
- name: Display environment variable "github.event_name"
5063
run: echo "github.event_name=${{ github.event_name }}"
5164

65+
66+
- name: Assemble GIT_ADD_PATH
67+
run: echo "GIT_ADD_PATH=${{ inputs.commit-directory }}${{ inputs.file-filter != '' && '/' || '' }}${{ inputs.file-filter }}" >> $GITHUB_ENV
68+
- name: Display GIT_ADD_PATH
69+
run: echo "GIT_ADD_PATH=${{ env.GIT_ADD_PATH }}"
70+
71+
- name: Assemble SECOND_GIT_ADD_PATH
72+
if: inputs.second-commit-directory != ''
73+
run: echo "SECOND_GIT_ADD_PATH=${{ inputs.second-commit-directory }}${{ inputs.file-filter != '' && '/' || '' }}${{ inputs.file-filter }}" >> $GITHUB_ENV
74+
- name: Display SECOND_GIT_ADD_PATH
75+
if: inputs.second-commit-directory != ''
76+
run: echo "SECOND_GIT_ADD_PATH=${{ env.SECOND_GIT_ADD_PATH }}"
77+
5278
- name: Prepare commit of changes in `${{ inputs.commit-directory }}`
5379
run: |
5480
git config --global user.name '${{ inputs.commit-author-name }}'
5581
git config --global user.email '${{ inputs.commit-author-email }}'
5682
git config --local http.postBuffer 524288000
5783
git fetch origin
5884
git status
59-
git add ${{ inputs.commit-directory }}
85+
git add ${{ env.GIT_ADD_PATH }} ${{ env.SECOND_GIT_ADD_PATH }}
6086
git status
6187
6288
- name: Commit and push changes in `${{ inputs.commit-directory }}`
@@ -67,6 +93,6 @@ jobs:
6793
git status
6894
git rebase --strategy-option=theirs origin/main --verbose
6995
git status
70-
git add ${{ inputs.commit-directory }}
96+
git add ${{ env.GIT_ADD_PATH }} ${{ env.SECOND_GIT_ADD_PATH }}
7197
git status
7298
git push --verbose

.github/workflows/internal-report-reference-documentation.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ jobs:
7070
commit-author-name: "${{ github.event.repository.name }} Continuous Integration"
7171
commit-author-email: "7671054+JohT@users.noreply.github.com"
7272
commit-message: "Automated code structure analysis results (CI)"
73-
commit-directory: "./analysis-results/*.md"
73+
commit-directory: "./analysis-results"
74+
file-filter: "*.md"
7475
uploaded-artifact-name: ${{ needs.generate-report-reference-documentation.outputs.documentation-upload-name }}
7576
secrets:
7677
repository-commit-token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}

.github/workflows/java-code-analysis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ jobs:
136136
commit-author-email: "7671054+JohT@users.noreply.github.com"
137137
commit-message: "Automated code structure analysis results (CI)"
138138
commit-directory: "analysis-results/${{ needs.prepare-code-to-analyze.outputs.project-name }}/${{ needs.prepare-code-to-analyze.outputs.analysis-name }}"
139+
second-commit-directory: "analysis-results/${{ needs.prepare-code-to-analyze.outputs.project-name }}/latest"
139140
uploaded-artifact-name: ${{ needs.analyze-code-graph.outputs.uploaded-analysis-results }}
140141
secrets:
141142
repository-commit-token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}

.github/workflows/typescript-code-analysis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ jobs:
108108
commit-author-email: "7671054+JohT@users.noreply.github.com"
109109
commit-message: "Automated code structure analysis results (CI)"
110110
commit-directory: "analysis-results/${{ needs.prepare-code-to-analyze.outputs.project-name }}/${{ needs.prepare-code-to-analyze.outputs.analysis-name }}"
111+
second-commit-directory: "analysis-results/${{ needs.prepare-code-to-analyze.outputs.project-name }}/latest"
111112
uploaded-artifact-name: ${{ needs.analyze-code-graph.outputs.uploaded-analysis-results }}
112113
secrets:
113114
repository-commit-token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}

0 commit comments

Comments
 (0)