Skip to content

Commit

Permalink
feat: add jsDelivr API token to purge
Browse files Browse the repository at this point in the history
  • Loading branch information
piquark6046 committed Feb 7, 2024
1 parent c0672fe commit 637487a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ inputs:
description: 'The your branches that you want to purge cache existing in jsDelivr'
required: false
default: 'latest'
jdtoken:
description: 'The jsDelivr API token to purge cache existing in jsDelivr'
required: true

runs:
using: 'composite'
Expand All @@ -24,7 +27,8 @@ runs:
WORKFLOWREF: ${{ github.workflow_ref }}
CI_WORKSPACE_PATH: ${{ github.workspace }}
CI_ACTION_PATH: ${{ github.action_path }}
JSDELIVR_TOKEN: ${{ inputs.jdtoken }}
run: |
npm run ci -- --gh-token "$GITHUB_TOKEN" --repo "$REPO" --workflow-ref "$WORKFLOWREF" --branch "$BRANCHE" --ci-workspace-path "$CI_WORKSPACE_PATH" --ci-action-path "$CI_ACTION_PATH"
npm run ci -- --gh-token "$GITHUB_TOKEN" --repo "$REPO" --workflow-ref "$WORKFLOWREF" --branch "$BRANCHE" --ci-workspace-path "$CI_WORKSPACE_PATH" --ci-action-path "$CI_ACTION_PATH" --jd-token "$JSDELIVR_TOKEN"
shell: bash
working-directory: ${{ github.action_path }}
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Program.option('--debug', 'output extra debugging', false)
.option('--branch <BRANCH>', 'A GitHub branch. eg: master', '')
.option('--ci-workspace-path <PATH>', 'A path to the CI workspace.', '')
.option('--ci-action-path <PATH>', 'A path to the CI action.', '')
.option('--should-use-api <TRUE_OR_FALSE>', 'Should use GitHub API?', 'false')
.option('--jd-token <TOKEN>', 'jsDelivr token to purge', '')

// Initialize Input of the options and export them.
Program.parse()
Expand Down
2 changes: 2 additions & 0 deletions sources/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type ProgramOptionsRawType = {
branch: string;
ciWorkspacePath: string;
ciActionPath: string;
jdToken: string;
}

export type ProgramOptionsType = {
Expand All @@ -17,6 +18,7 @@ export type ProgramOptionsType = {
branch: string;
ciWorkspacePath: string;
ciActionPath: string;
jdToken: string;
}

export type CDNStatusResponseType = {
Expand Down

0 comments on commit 637487a

Please sign in to comment.