Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/weak-cooks-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"delete-deployments": major
---

feat: delete-deployments initial release
45 changes: 45 additions & 0 deletions actions/delete-deployments/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# delete-deployments

> Deletes the spammy deployment notifications added to PRs

## Inputs

| Name | Description | Required | Default |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | -------- | -------------------------- |
| `github-token` | GitHub token to use for authentication | Yes | `${{ github.token }}` |
| `environment` | The environment to filter deployments by | No | — |
| `ref` | The ref to filter deployments by | Yes | — |
| `dry-run` | Whether to actually delete deployments or not | No | — |
| `num-of-pages` | Number of pages (100 per page) to fetch deployments from. Set to `all` to fetch all deployments. Must be "all" or a number greater than 0. | No | `all` |
| `starting-page` | Page to start fetching deployments from. Only valid if `num-of-pages` is set to a number. Must be greater than or equal to 0. | No | — |
| `repository` | Owner and repository name to delete deployments from (e.g., `smartcontractkit/chainlink`). Defaults to the current repository. | No | `${{ github.repository }}` |

## Example Usage

```yaml
name: Cleanup integration deployments
on:
workflow_dispatch:
schedule:
# every 10 mins
- cron: "*/10 * * * *"

jobs:
cleanup:
name: Clean up integration environment deployments
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Clean up integration environment
uses: smartcontractkit/.github/actions/delete-deployments@delete-deployments/v1
with:
environment: integration
# Delete 300 deployments at a time
num-of-pages: 3
# We start with page 2 because usually the first 200 deployments are still active, so we cannot delete them
starting-page: 2
```
44 changes: 44 additions & 0 deletions actions/delete-deployments/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: delete-deployments
description: "Deletes the spammy deployment notifications added to PRs"

inputs:
github-token:
description: "GitHub token to use for authentication"
default: ${{ github.token }}
required: true

environment:
description: The environment to filter deployments by
required: false

ref:
required: true
description: The ref to filter deployments by

dry-run:
required: false
description: Whether to actually delete deployments or not

num-of-pages:
required: false
description:
The number of pages (of 100 per page) to fetch deployments from, set to
'all' to fetch all deployments
default: "all"

starting-page:
required: false
description:
The page to start fetching deployments from, only valid if num-of-pages is
set to a number

repository:
required: false
description:
The owner and repository name to delete deployments from, defaults to the
current repository, ex. 'smartcontractkit/chainlink'
default: ${{ github.repository }}

runs:
using: "node20"
main: "dist/index.js"
Loading
Loading