Skip to content

Commit 4d3cfb9

Browse files
committed
Copy and commit new analysis results into the "latest" folder
1 parent 2dc7443 commit 4d3cfb9

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

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

Lines changed: 20 additions & 6 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,11 +17,16 @@ 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: ""
2428
file-filter:
25-
description: "Will be appended to the commit-directory to filter files when staging them with git add. Example: *.md"
29+
description: "A filter to apply to files in the commit-directory when staging them with git add. Example: *.md"
2630
required: false
2731
type: string
2832
default: ""
@@ -50,14 +54,24 @@ jobs:
5054
with:
5155
name: ${{ inputs.uploaded-artifact-name }}
5256
path: ${{ inputs.commit-directory }}
53-
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+
5462
- name: Display environment variable "github.event_name"
5563
run: echo "github.event_name=${{ github.event_name }}"
5664

5765
- name: Assemble and display GIT_ADD_PATH
5866
run: |
5967
echo "GIT_ADD_PATH=${{ inputs.commit-directory }}${{ inputs.file-filter == '' && '/' || '' }}${{ inputs.file-filter }}" >> $GITHUB_ENV
6068
echo "GIT_ADD_PATH=${{ env.GIT_ADD_PATH }}"
69+
70+
- name: Assemble and display SECOND_GIT_ADD_PATH
71+
if: inputs.second-commit-directory != ''
72+
run: |
73+
echo "SECOND_GIT_ADD_PATH=${{ inputs.second-commit-directory }}${{ inputs.file-filter == '' && '/' || '' }}${{ inputs.file-filter }}" >> $GITHUB_ENV
74+
echo "SECOND_GIT_ADD_PATH=${{ env.SECOND_GIT_ADD_PATH }}"
6175
6276
- name: Prepare commit of changes in `${{ inputs.commit-directory }}`
6377
run: |
@@ -66,7 +80,7 @@ jobs:
6680
git config --local http.postBuffer 524288000
6781
git fetch origin
6882
git status
69-
git add ${{ env.GIT_ADD_PATH }}
83+
git add ${{ env.GIT_ADD_PATH }} ${{ env.SECOND_GIT_ADD_PATH }}
7084
git status
7185
7286
- name: Commit and push changes in `${{ inputs.commit-directory }}`
@@ -77,6 +91,6 @@ jobs:
7791
git status
7892
git rebase --strategy-option=theirs origin/main --verbose
7993
git status
80-
git add ${{ env.GIT_ADD_PATH }}
94+
git add ${{ env.GIT_ADD_PATH }} ${{ env.SECOND_GIT_ADD_PATH }}
8195
git status
8296
git push --verbose

.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)