Skip to content

predictr-io/gcp-pubsub-delete-subscription

Repository files navigation

GCP Pub/Sub Delete Subscription Action

Delete Google Cloud Pub/Sub subscriptions.

Features

  • ✅ Delete Pub/Sub subscriptions by name
  • ✅ Simple and straightforward operation
  • ✅ Full validation and error handling

Usage

Basic Example

- name: Delete Pub/Sub Subscription
  uses: predictr-io/gcp-pubsub-delete-subscription@v1
  with:
    project-id: 'my-gcp-project'
    subscription-name: 'events-subscription'

Complete Example

- name: Authenticate to Google Cloud
  uses: google-github-actions/auth@v2
  with:
    credentials_json: ${{ secrets.GCP_CREDENTIALS }}

- name: Delete Pub/Sub Subscription
  uses: predictr-io/gcp-pubsub-delete-subscription@v1
  with:
    project-id: 'my-gcp-project'
    subscription-name: 'temporary-subscription'

In Cleanup Job

jobs:
  cleanup:
    runs-on: ubuntu-latest
    if: always()
    steps:
      - uses: google-github-actions/auth@v2
        with:
          credentials_json: ${{ secrets.GCP_CREDENTIALS }}

      - name: Delete Test Subscription
        uses: predictr-io/gcp-pubsub-delete-subscription@v1
        with:
          project-id: 'my-gcp-project'
          subscription-name: 'test-subscription-${{ github.run_id }}'

Inputs

Input Description Required Default
project-id GCP project ID Yes -
subscription-name Pub/Sub subscription name Yes -

Authentication

This action requires GCP authentication. Use the google-github-actions/auth action:

- uses: google-github-actions/auth@v2
  with:
    credentials_json: ${{ secrets.GCP_CREDENTIALS }}

Required GCP Permissions

The service account needs:

  • pubsub.subscriptions.delete

Or the role: roles/pubsub.editor

Notes

  • This operation cannot be undone
  • If the subscription doesn't exist, the action will fail
  • Deleting a subscription does not delete the topic

License

MIT

About

GitHub Action to delete Google Cloud Pub/Sub subscriptions

Resources

License

Stars

Watchers

Forks

Packages

No packages published