-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
47 lines (45 loc) · 1.81 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: 'Purge cache existing in jsDelivr Network'
author: 'PiQuark6046 and contributors'
description: 'Clone your GitHub repo into jsDelivr Network to enhance transmission speed'
inputs:
branches:
description: 'The your branches that you want to purge cache existing in jsDelivr'
required: false
default: 'latest'
runs:
using: 'composite'
steps:
- name: Install npm packages
run: |
npm i
shell: bash
working-directory: ${{ github.action_path }}
- name: Check if size of the repo exceeds the runner's hardware capacity
id: check_size
env:
GITHUB_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
CI_WORKSPACE_PATH: ${{ github.workspace }}
run: |
npm run calc-repo-size -- --gh-token "$GITHUB_TOKEN" --repo "$REPO" --ci-workspace-path "$CI_WORKSPACE_PATH"
shell: bash
working-directory: ${{ github.action_path }}
- name: Clone repo into github.workspace
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.repository.default_branch }}
if: ${{ steps.check_size.outputs.should_api != 'true' }}
- name: Run program
env:
GITHUB_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
BRANCHE: ${{ inputs.branches }}
WORKFLOWREF: ${{ github.workflow_ref }}
CI_WORKSPACE_PATH: ${{ github.workspace }}
CI_ACTION_PATH: ${{ github.action_path }}
SHOULD_USE_API: ${{ steps.check_size.outputs.should_use_api }}
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" --should-use-api "$SHOULD_USE_API"
shell: bash
working-directory: ${{ github.action_path }}