You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ba79116
Browse filesBrowse the repository at this point in the historyBrowse files
NEW_BADGE="[)](https://github.com/Audionut/Upload-Assistant/actions/workflows/test-run.yaml?query=branch%3Amaster)"
165
+
# Replace the old master badge line or insert if not present
166
+
if grep -q '\[!\[Test run (Master Branch)\](https://img.shields.io/github/actions/workflow/status/Audionut/Upload-Assistant/test-run.yaml?branch=master&label=Test%20run%20(Master%20Branch' README.md; then
167
+
sed -i "s|\[!\[Test run (Master Branch)\](https://img.shields.io/github/actions/workflow/status/Audionut/Upload-Assistant/test-run.yaml?branch=master&label=Test%20run%20(Master%20Branch[^\)]*)\)](https://github.com/Audionut/Upload-Assistant/actions/workflows/test-run.yaml)|$NEW_BADGE|" README.md
git commit -m "Update master branch badge with latest run date [skip ci]" || echo "No changes to commit"
175
+
git push
176
+
177
+
- name: Update README badge for latest tag
178
+
if: github.event_name == 'release'
179
+
run: |
180
+
TAG_NAME="${{ github.event.release.tag_name }}"
181
+
DATE_STR=$(date -u "+%Y-%m-%d %H:%M UTC")
182
+
# Escape special characters for sed
183
+
ESCAPED_TAG=$(printf '%s\n' "$TAG_NAME" | sed 's/[][\.*^$/]/\\&/g')
184
+
# Build the new badge markdown
185
+
NEW_BADGE="[)](https://github.com/Audionut/Upload-Assistant/actions/workflows/test-run.yaml?query=branch%3A${TAG_NAME})"
186
+
# Replace the old badge line (matching previous tag) or insert if not present
187
+
if grep -qE '\[!\[Test run \([^)]+\)\]\(https://img\.shields\.io/github/actions/workflow/status/Audionut/Upload-Assistant/test-run\.yaml\?branch=[^)]+&label=Test%20run%20\([^)]+\)\)\]\(https://github\.com/Audionut/Upload-Assistant/actions/workflows/test-run\.yaml\?query=branch%3A[^)]+\)' README.md; then
188
+
sed -i "s|\[!\[Test run ([^)]*)\](https://img.shields.io/github/actions/workflow/status/Audionut/Upload-Assistant/test-run.yaml?branch=[^&]*&label=Test%20run%20([^)]*))](https://github.com/Audionut/Upload-Assistant/actions/workflows/test-run.yaml?query=branch%3A[^)]*)|$NEW_BADGE|" README.md
0 commit comments