|
1 | 1 | name: Commit Results |
2 | | - |
3 | 2 | on: |
4 | 3 | workflow_call: |
5 | 4 | inputs: |
|
18 | 17 | type: string |
19 | 18 | default: "ci: Add automated results" |
20 | 19 | commit-directory: |
21 | | - description: "The directory to commit" |
| 20 | + description: "The directory where the artifacts will be downloaded and committed" |
22 | 21 | required: true |
23 | 22 | 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: "" |
24 | 28 | 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" |
26 | 30 | required: false |
27 | 31 | type: string |
28 | 32 | default: "" |
@@ -50,14 +54,24 @@ jobs: |
50 | 54 | with: |
51 | 55 | name: ${{ inputs.uploaded-artifact-name }} |
52 | 56 | 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 | + |
54 | 62 | - name: Display environment variable "github.event_name" |
55 | 63 | run: echo "github.event_name=${{ github.event_name }}" |
56 | 64 |
|
57 | 65 | - name: Assemble and display GIT_ADD_PATH |
58 | 66 | run: | |
59 | 67 | echo "GIT_ADD_PATH=${{ inputs.commit-directory }}${{ inputs.file-filter == '' && '/' || '' }}${{ inputs.file-filter }}" >> $GITHUB_ENV |
60 | 68 | 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 }}" |
61 | 75 |
|
62 | 76 | - name: Prepare commit of changes in `${{ inputs.commit-directory }}` |
63 | 77 | run: | |
|
66 | 80 | git config --local http.postBuffer 524288000 |
67 | 81 | git fetch origin |
68 | 82 | git status |
69 | | - git add ${{ env.GIT_ADD_PATH }} |
| 83 | + git add ${{ env.GIT_ADD_PATH }} ${{ env.SECOND_GIT_ADD_PATH }} |
70 | 84 | git status |
71 | 85 |
|
72 | 86 | - name: Commit and push changes in `${{ inputs.commit-directory }}` |
|
77 | 91 | git status |
78 | 92 | git rebase --strategy-option=theirs origin/main --verbose |
79 | 93 | git status |
80 | | - git add ${{ env.GIT_ADD_PATH }} |
| 94 | + git add ${{ env.GIT_ADD_PATH }} ${{ env.SECOND_GIT_ADD_PATH }} |
81 | 95 | git status |
82 | 96 | git push --verbose |
0 commit comments