-
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.
feat(delete): add delete action (#3)
- Loading branch information
Showing
14 changed files
with
56,122 additions
and
10 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
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
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 @@ | ||
/** | ||
* Unit tests for the action's entrypoint, src/index.ts | ||
*/ | ||
import * as main from '../src/main' | ||
|
||
// Mock the action's entrypoint | ||
const runMock = jest.spyOn(main, 'runDelete').mockImplementation() | ||
|
||
describe('delete', () => { | ||
it('calls runDelete when imported', async () => { | ||
// eslint-disable-next-line @typescript-eslint/no-require-imports | ||
require('../src/delete') | ||
|
||
expect(runMock).toHaveBeenCalled() | ||
}) | ||
}) |
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,38 @@ | ||
# Google Drive Delete Action | ||
|
||
## Usage | ||
|
||
### Inputs | ||
|
||
| Name | Description | Required | | ||
| - | - | - | | ||
| `credentials` | Google API credentials in base64 format. | `true` | | ||
| `parent-folder-id` | The parent folder ID in Google Drive. | `true` | | ||
| `target-filepath` | The remote file path in Google Drive of the uploaded file relative to the given parent folder. Use parent folder root with source filename when not set. | `true` | | ||
|
||
### Outputs | ||
|
||
| Name | Description | | ||
| - | - | | ||
| `file-id` | The ID of the uploaded file. | | ||
|
||
## Examples | ||
|
||
```yaml | ||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Delete file from Google Drive | ||
id: gdrive-delete | ||
uses: bonitasoft/gdrive-action/delete@v1 | ||
with: | ||
credentials: ${{ secrets.GDRIVE_CREDENTIALS }} # credentials stored as a GitHub secret | ||
parent-folder-id: ${{ vars.GDRIVE_FOLDER_ID }} # folder id stored as a GitHub variable | ||
target-filepath: test/hello_1.txt | ||
|
||
- name: Print Output | ||
id: output | ||
run: echo "${{ steps.gdrive-upload.outputs.file-id }}" | ||
``` |
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,24 @@ | ||
name: 'gdrive-delete-action' | ||
description: 'GitHub Action that delete files from Google Drive.' | ||
author: 'Bonitasoft' | ||
|
||
inputs: | ||
credentials: | ||
description: 'Google API credentials in base64 format.' | ||
required: true | ||
parent-folder-id: | ||
description: 'The parent folder ID in Google Drive.' | ||
required: true | ||
target-filepath: | ||
required: true | ||
description: | ||
'The remote file path in Google Drive of the file to delete relative to the | ||
given parent folder.' | ||
|
||
outputs: | ||
file-id: | ||
description: 'The ID of the deleted file.' | ||
|
||
runs: | ||
using: node20 | ||
main: dist/index.js |
Oops, something went wrong.