Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
wuhan005 committed Mar 6, 2024
0 parents commit 796e668
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM python:3.9.1

WORKDIR /app

COPY . .

RUN pip install -r requirements.txt

CMD [ "python", "/app/main.py" ]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# aliyun-dcdn-refresh
22 changes: 22 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 'Aliyun DCDN Refresh'
description: 'Refresh DCDN at once.'
branding:
icon: 'upload'
color: 'blue'
inputs:
AccessKeyId:
description: 'Aliyun access key id'
required: true
AccessKeySecret:
description: 'Aliyun access key secret'
required: true
ObjectPath:
description: 'Object to refresh'
required: true
runs:
using: 'docker'
image: 'Dockerfile'
env:
ACCESS_KEY_ID: ${{ inputs.AccessKeyId }}
ACCESS_KEY_SECRET: ${{ inputs.AccessKeySecret }}
OBJECT_PATH: ${{ inputs.ObjectPath }}
20 changes: 20 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import os
from alibabacloud_tea_openapi.models import Config
from alibabacloud_dcdn20180115.client import Client as Client
from alibabacloud_dcdn20180115 import models as models

if __name__ == '__main__':
config = Config(
access_key_id=os.getenv('ACCESS_KEY_ID'),
access_key_secret=os.getenv('ACCESS_KEY_SECRET')
)
config.endpoint = 'dcdn.aliyuncs.com'

client = Client(config)
request = models.RefreshDcdnObjectCachesRequest()
request.force = True
request.object_path = os.getenv('OBJECT_PATH')
request.object_type = 'Directory'

response = client.refresh_dcdn_object_caches(request)
print(response)
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alibabacloud_dcdn20180115==2.2.0

0 comments on commit 796e668

Please # to comment.