Skip to content

Commit

Permalink
chore: update default host
Browse files Browse the repository at this point in the history
  • Loading branch information
yanglbme committed Dec 6, 2021
1 parent 492a772 commit b89d42b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ CordCloud 帐号自动续命。可配置 workflow 的触发条件为 `schedule`

## 入参

| 参数 | 描述 | 是否必传 | 默认值 | 示例 |
| -------- | -------------- | -------- | ---------------------------------------------------------- | ------------------------ |
| `email` | CordCloud 邮箱 || | ${{ secrets.CC_EMAIL }} |
| `passwd` | CordCloud 密码 || | ${{ secrets.CC_PASSWD }} |
| `host` | CordCloud 站点 || cordcloud.site,cordcloud.one,<br>cordcloud.biz,c-cloud.xyz | |
| 参数 | 描述 | 是否必传 | 默认值 | 示例 |
| -------- | -------------- | -------- | -------------------------------------------------------- | ------------------------ |
| `email` | CordCloud 邮箱 || | ${{ secrets.CC_EMAIL }} |
| `passwd` | CordCloud 密码 || | ${{ secrets.CC_PASSWD }} |
| `host` | CordCloud 站点 || cordcloud.us,cordcloud.one,<br>cordcloud.biz,c-cloud.xyz | |

注:`host` 支持以英文逗号分隔传入多个站点,CordCloud Action 会依次尝试每个站点,成功即停止。

Expand Down Expand Up @@ -77,15 +77,15 @@ Run yanglbme/cordcloud-action@main
with:
email: ***
passwd: ***
host: cordcloud.site,cordcloud.biz,c-cloud.xyz
host: cordcloud.us,cordcloud.biz,c-cloud.xyz
/usr/bin/docker run --name e284907234b909e5834e1eada54639a7313ce5_05bbe4 --label e28490 --workdir /github/workspace --rm -e INPUT_EMAIL -e INPUT_PASSWD -e INPUT_HOST -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/reading/reading":"/github/workspace" e28490:7234b909e5834e1eada54639a7313ce5
欢迎使用 CordCloud Action ❤
📕 入门指南: https://github.com/marketplace/actions/cordcloud-action
📣 由 Yang Libin 维护: https://github.com/yanglbme
[2021-11-27 08:28:34] 当前尝试 host:cordcloud.site
Warning: host:cordcloud.site, 错误信息:HTTPSConnectionPool(host='cordcloud.site', port=443): Max retries exceeded with url: /auth/login (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7ff7f990c4c0>, 'Connection to cordcloud.site timed out. (connect timeout=6)'))
[2021-11-27 08:28:34] 当前尝试 host:cordcloud.us
Warning: host:cordcloud.us, 错误信息:HTTPSConnectionPool(host='cordcloud.us', port=443): Max retries exceeded with url: /auth/login (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7ff7f990c4c0>, 'Connection to cordcloud.us timed out. (connect timeout=6)'))
[2021-11-27 08:28:40] 当前尝试 host:cordcloud.biz
[2021-11-27 08:28:41] 帐号登录成功,结果:{'ret': 1, 'msg': '欢迎回来'}
[2021-11-27 08:28:41] 帐号续命成功,结果:{'msg': '获得了 275 MB流量.', 'ret': 1}
Expand Down
24 changes: 12 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
name: 'CordCloud Action'
description: 'GitHub Action for CordCloud'
author: 'yanglbme'
name: "CordCloud Action"
description: "GitHub Action for CordCloud"
author: "yanglbme"
branding:
icon: 'check-circle'
color: 'gray-dark'
icon: "check-circle"
color: "gray-dark"
inputs:
email:
description: 'your cordcloud email'
description: "your cordcloud email"
required: true
passwd:
description: 'your cordcloud password'
description: "your cordcloud password"
required: true
host:
description: 'base host'
description: "base host"
required: false
default: 'cordcloud.site,cordcloud.one,cordcloud.biz,c-cloud.xyz'
default: "cordcloud.us,cordcloud.one,cordcloud.biz,c-cloud.xyz"
outputs:
result:
description: 'The result of api'
description: "The result of api"
runs:
using: 'docker'
image: 'Dockerfile'
using: "docker"
image: "Dockerfile"
5 changes: 3 additions & 2 deletions app/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class Action:
def __init__(self, email: str, passwd: str, code: str = '', host: str = 'cordcloud.site'):
def __init__(self, email: str, passwd: str, code: str = '', host: str = 'cordcloud.us'):
self.email = email
self.passwd = passwd
self.code = code
Expand All @@ -23,7 +23,8 @@ def login(self):
'passwd': self.passwd,
'code': self.code
}
res = self.session.post(login_url, data=form_data, timeout=self.timeout).json()
res = self.session.post(login_url, data=form_data,
timeout=self.timeout).json()
if res['ret'] != 1:
raise Exception(f'[{now()}] CordCloud 帐号登录异常,错误日志:{res}')
core.info(f'[{now()}] 帐号登录成功,结果:{res}')
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# 获取输入
email = core.get_input('email', required=True)
passwd = core.get_input('passwd', required=True)
host = core.get_input('host') or 'cordcloud.site,cordcloud.one,cordcloud.biz,c-cloud.xyz'
host = core.get_input('host') or 'cordcloud.us,cordcloud.one,cordcloud.biz,c-cloud.xyz'

# host 预处理:切分、过滤空值
hosts = [h for h in host.split(',') if h]
Expand Down

0 comments on commit b89d42b

Please sign in to comment.