name: Delete Package on Tag Deletion
on:
release:
types: [deleted]
jobs:
delete-package:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Delete package version
run: |
# Get the package name from your package.json
PACKAGE_NAME="azure-mcp"
VERSION=${GITHUB_EVENT_REF#v} # Remove 'v' prefix if present
# Delete the package version using GitHub API
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/user/packages/npm/${PACKAGE_NAME}/versions/${VERSION}"