-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5b03f3e
Showing
10 changed files
with
669 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Test | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
run-action: | ||
name: Run action | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js 20.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
cache: "npm" | ||
cache-dependency-path: package-lock.json | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- name: Run my action | ||
uses: ./ | ||
with: | ||
GITPOD_TOKEN: ${{ secrets.GITPOD_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/node_modules | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM node:20 | ||
|
||
WORKDIR /action | ||
|
||
COPY . . | ||
|
||
RUN npm install | ||
RUN npm run build | ||
|
||
ENTRYPOINT ["node", "/action/src/main.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Gitpod Workspace Cleanup - GitHub Action | ||
|
||
This GitHub Action is designed to manage Gitpod workspaces. It automatically deletes workspaces that are stopped and do not have any uncommitted or untracked file changes. | ||
|
||
> [!NOTE] | ||
> `GITPOD_TOKEN`: Required. The access token for Gitpod API. [Learn more](https://www.gitpod.io/docs/configure/user-settings/access-tokens). | ||
## Usage | ||
|
||
[**Demo repository**](https://github.com/Siddhant-K-code/demo-delete-clean-workspaces) | ||
|
||
```yaml | ||
name: Delete clean Gitpod workspaces weekly | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 9 * * MON' # At 9 AM UTC, weekly only on Monday | ||
|
||
jobs: | ||
delete-clean-workspaces: | ||
name: Clean Gitpod workspaces weekly | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Delete clean Gitpod workspaces | ||
uses: Siddhant-K-code/delete-clean-workspaces@v1.0 | ||
with: | ||
GITPOD_TOKEN: ${{ secrets.GITPOD_PAT_TOKEN }} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: "Delete clean Gitpod workspaces" | ||
author: "Siddhant-K-code" | ||
description: "GitHub action to delete non-running, clean Gitpod workspaces." | ||
inputs: | ||
GITPOD_TOKEN: | ||
description: "Gitpod Personal Access token" | ||
required: true | ||
outputs: | ||
success: | ||
description: "true|false based on if the script worked" | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
branding: | ||
icon: "archive" | ||
color: "orange" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "delete-clean-workspaces", | ||
"version": "1.0.0", | ||
"description": "GitHub action designed to remove Gitpod workspaces that are not in a running state and do not contain any uncommitted or untracked file changes.", | ||
"main": "dist/main.js", | ||
"scripts": { | ||
"build": "npx tsc ./src/main.ts" | ||
}, | ||
"author": "Siddhant-K-code", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@actions/core": "^1.10.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.10.2", | ||
"axios": "^1.6.2", | ||
"typescript": "^5.3.2" | ||
} | ||
} |
Oops, something went wrong.