|
43 | 43 | else |
44 | 44 | color=lightgrey; msg=Unknown |
45 | 45 | fi |
46 | | - echo '{ "schemaVersion": 1, "label": "Remediate Pipeline", "message": "'"$msg"'", "color": "color": "brightgreen" }' > $OUT_DIR/remediate.json |
| 46 | + echo '{ "schemaVersion": 1, "label": "Remediate Pipeline", "message": "'"$msg"'", "color": "brightgreen" }' > $OUT_DIR/remediate.json |
47 | 47 |
|
48 | 48 | # GPO pipeline badge |
49 | 49 | status=$(gh run list -R "${{ inputs.repo_name }}" --workflow="main_pipeline_validation_gpo.yml" --json status,conclusion --jq '.[0] | .status + ":" + .conclusion' || echo "unknown:unknown") |
|
54 | 54 | else |
55 | 55 | color=lightgrey; msg=Unknown |
56 | 56 | fi |
57 | | - echo '{ "schemaVersion": 1, "label": "GPO Pipeline", "message": "'"$msg"'", "color": "color": "brightgreen" }' > $OUT_DIR/gpo.json |
| 57 | + echo '{ "schemaVersion": 1, "label": "GPO Pipeline", "message": "'"$msg"'", "color": "brightgreen" }' > $OUT_DIR/gpo.json |
58 | 58 |
|
59 | 59 | # Pull requests |
60 | 60 | prs=$(gh pr list -R "${{ inputs.repo_name }}" --json number --jq 'length') |
@@ -100,40 +100,42 @@ jobs: |
100 | 100 | echo "Cloning self_hosted branch of github_windows_IaC..." |
101 | 101 | git clone --branch self_hosted https://x-access-token:${{ secrets.BADGE_PUSH_TOKEN }}@github.com/ansible-lockdown/github_windows_IaC.git target |
102 | 102 |
|
103 | | - echo "Preparing badge directory: badges/${{ inputs.repo_name }}" |
104 | | - mkdir -p target/badges/${{ inputs.repo_name }} |
| 103 | + repo_short=$(basename "${{ inputs.repo_name }}") |
| 104 | +
|
| 105 | + echo "Preparing badge directory: target/badges/$repo_short" |
| 106 | + mkdir -p target/badges/$repo_short |
105 | 107 |
|
106 | 108 | echo "Syncing badge files with rsync (only updated ones will be copied)..." |
107 | | - if [ -d "output/badges/${{ inputs.repo_name }}" ]; then |
108 | | - repo_short=$(basename "${{ inputs.repo_name }}") |
| 109 | + if [ -d "output/badges/$repo_short" ]; then |
109 | 110 | rsync -a --delete --checksum output/badges/$repo_short/ target/badges/$repo_short/ | tee sync_log.txt |
110 | 111 | else |
111 | | - echo "Warning: No badge output found in output/badges/${{ inputs.repo_name }}" |
| 112 | + echo "Warning: No badge output found in output/badges/$repo_short" |
112 | 113 | fi |
113 | 114 |
|
114 | 115 | echo "Files that were updated/copied/removed:" |
115 | 116 | cat sync_log.txt || echo "No rsync output available" |
116 | 117 |
|
117 | | - echo "Final contents of target/badges/${{ inputs.repo_name }}:" |
118 | | - ls -al target/badges/${{ inputs.repo_name }} || echo "Folder does not exist or is empty" |
| 118 | + echo "Final contents of target/badges/$repo_short:" |
| 119 | + ls -al target/badges/$repo_short || echo "Folder does not exist or is empty" |
119 | 120 |
|
120 | 121 | - name: Commit and push to self_hosted branch |
121 | 122 | run: | |
| 123 | + repo_short=$(basename "${{ inputs.repo_name }}") |
122 | 124 | cd target |
123 | 125 |
|
124 | 126 | echo "Running git status before commit:" |
125 | 127 | git status |
126 | 128 |
|
127 | 129 | echo "Adding changes to staging:" |
128 | | - git add badges/${{ inputs.repo_name }} |
| 130 | + git add badges/$repo_short |
129 | 131 |
|
130 | | - echo "Showing staged changes (git diff --cached):" |
131 | | - git diff --cached || echo "No staged changes diff" |
| 132 | + echo "Showing staged changes:" |
| 133 | + git diff --cached || true |
132 | 134 |
|
133 | 135 | if git diff --cached --quiet; then |
134 | 136 | echo "No changes detected – skipping commit." |
135 | 137 | else |
136 | 138 | echo "Changes detected – committing and pushing..." |
137 | | - git commit -m "Update PRIVATE badges for ${{ inputs.repo_name }}" |
| 139 | + git commit -m "Update PRIVATE badges for $repo_short" |
138 | 140 | git push origin self_hosted |
139 | 141 | fi |
0 commit comments