Skip to content

Commit e71129b

Browse files
committed
cleanup-self-hosted-runner: use workflow commands for better mark-up
When logging output that we're deleting a VM, it should be marked a bit more prominently. Let's mark it as a warning: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-a-warning-message This marks it in red in the output. Conversely, we want to mention when we skipped the deletion, and to make those messages stick out a bit (but less than warnings), let's use: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-a-notice-message Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 3fb438c commit e71129b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.github/workflows/cleanup-self-hosted-runners.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,16 @@ jobs:
5252
vm_creation_time=$(TZ=UTC date -d "$vm_creation_time_string" +%s)
5353
5454
if [ "$one_hour_ago" -lt "$vm_creation_time" ]; then
55-
echo "The VM ${vm_name} was created less then 1 hour ago and shouldn't be deleted yet. Skipping."
55+
echo "::notice::The VM ${vm_name} was created less then 1 hour ago and shouldn't be deleted yet. Skipping."
5656
elif test true = "$(if test ! -f .cli-authenticated; then
5757
./gh-cli-auth-as-app.sh &&
5858
>.cli-authenticated # only authenticate once
5959
fi &&
6060
gh api repos/$GITHUB_REPOSITORY/actions/runners \
6161
--jq '.runners[] | select(.name == "'$vm_name'") | .busy')"; then
62-
echo "The VM ${vm_name} is still busy."
62+
echo "::notice::The VM ${vm_name} is still busy."
6363
else
64-
echo "The VM ${vm_name} was created more than 3 hours ago and wasn't deleted. Let's do that now."
64+
echo "::warning::The VM ${vm_name} was created more than 3 hours ago and wasn't deleted. Let's do that now."
6565
az vm delete -n "$vm_name" -g ${{ secrets.AZURE_RESOURCE_GROUP }} --yes
6666
az network nsg delete -n "$vm_name"-nsg -g ${{ secrets.AZURE_RESOURCE_GROUP }}
6767
az network vnet delete -n "$vm_name"-vnet -g ${{ secrets.AZURE_RESOURCE_GROUP }}

0 commit comments

Comments
 (0)