Skip to content

fix(labels): Simplify and fix creation of repository labels #4

fix(labels): Simplify and fix creation of repository labels

fix(labels): Simplify and fix creation of repository labels #4

Workflow file for this run

name: Update repository labels
on:
push:
branches:
- main
paths:
- ".github/workflows/labels.yml"
workflow_dispatch:
jobs:
create-labels:
runs-on: ubuntu-latest
permissions:
issues: write
env:
LABELS_JSON: |
[
{"name": "flavor:g3.xl", "color": "D93F0B", "description": "GPU instance (32 CPUs, 125 GB RAM, A100 GPU)"},
{"name": "flavor:m3.xl", "color": "D93F0B", "description": "General-purpose instance (32 CPUs, 125 GB RAM)"},
{"name": "request:approved", "color": "027210", "description": "Instance has been approved for creation and is being provisioned"},
{"name": "status:active", "color": "CFD3D7", "description": "The server is active."},
{"name": "status:build", "color": "CFD3D7", "description": "The server has not yet finished the original build process."},
{"name": "status:deleted", "color": "CFD3D7", "description": "The server is deleted."},
{"name": "status:error", "color": "CFD3D7", "description": "The server is in error."},
{"name": "status:hard_reboot", "color": "CFD3D7", "description": "The server is hard rebooting."},
{"name": "status:migrating", "color": "CFD3D7", "description": "The server is migrating."},
{"name": "status:password", "color": "CFD3D7", "description": "The password is being reset on the server."},
{"name": "status:paused", "color": "CFD3D7", "description": "The server is paused."},
{"name": "status:reboot", "color": "CFD3D7", "description": "The server is in a soft reboot state. A reboot command was passed to the operating system."},
{"name": "status:rebuild", "color": "CFD3D7", "description": "The server is currently being rebuilt from an image."},
{"name": "status:rescue", "color": "CFD3D7", "description": "The server is in rescue mode."},
{"name": "status:resize", "color": "CFD3D7", "description": "Server is performing the differential copy of data that changed during its initial copy."},
{"name": "status:revert_resize", "color": "CFD3D7", "description": "The resize or migration of a server failed for some reason."},
{"name": "status:shelved", "color": "CFD3D7", "description": "The server is in shelved state."},
{"name": "status:shelved_offloaded", "color": "CFD3D7", "description": "The shelved server is offloaded (removed from the compute host)."},
{"name": "status:shutoff", "color": "CFD3D7", "description": "The server was powered down by the user, either using OpenStack or from within the server."},
{"name": "status:soft_deleted", "color": "CFD3D7", "description": "The server is marked as deleted but will remain in the cloud for some configurable amount of time."},
{"name": "status:suspended", "color": "CFD3D7", "description": "The server is suspended, either by request or necessity."},
{"name": "status:unknown", "color": "CFD3D7", "description": "The state of the server is unknown."},
{"name": "status:verify_resize", "color": "CFD3D7", "description": "System is awaiting confirmation that the server is operational after a move or resize."},
{"name": "timeout:4hrs", "color": "5319E7", "description": "Duration in hours after which the instance will be stopped"}
]
steps:
- name: Create or Update Labels
run: |
echo $LABELS_JSON | jq -r '.[] | [.name, .color, .description] | @tsv' | \
while IFS=$'\t' read -r name color description; do
gh label create "${name}" --color "${color}" --description "${description}" --force
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}