自动更新 爱发电 赞助列表 | GitHub Action仓库- GitHub: https://github.com/yiyungent/afdian-action介绍使用 GitHub Action
自动更新 爱发电 赞助列表, 无需再手动更新赞助列表效果见 Sponsors.md功能 自动更新 爱发电 赞助列表 支持 Razor 语法, 高度灵活 (编程式自定义模板), 可使用模板文件自定义样式风格。
使用1. 创建 模板文件 afdian-action.cshtml.github/afdian-action.cshtml此模板 可用 Razor 语法, 可自定义PS: 一个更美观完善的 afdian-action.cshtml
@{ var viewModel = (Afdian.Action.ViewModels.AfdianViewModel)@Model; } @for (int i = 0; i < viewModel.Sponsor.data.list.Count(); i++) { @{ var sponsorItem = viewModel.Sponsor.data.list[i]; } }
补充: 此模板 风格来自 https://github.com/CnGal/CnGalWebSite如需更多自定义, 见下方 自定义模板2. 修改 目标文件: 如: README.md添加如下 开始,结束标志
, 此标志中间将插入模板解析后的赞助列表##赞助者 感谢这些来自爱发电的赞助者: 2. 创建 afdian-action.yml
.github/workflows/afdian-action.ymlname: afdian-action on: schedule: # Run workflow automatically – cron: 0 * * * * # Runs every hour, on the hour workflow_dispatch: # Run workflow manually (without waiting for the cron to be called), through the Github Actions Workflow page directly jobs: build: runs-on: ubuntu-latest steps: – name: Checkout source uses: actions/checkout@v2 with: ref: main # 注意修改为你的分支, 例如: master – name: Afdian action uses: yiyungent/afdian-action@main with: # 在 Settings->Secrets 配置 AFDIAN_USERID, AFDIAN_TOKEN # 爱发电 user_id afdian_userId: ${{ secrets.AFDIAN_USERID }} # 爱发电 token afdian_token: ${{ secrets.AFDIAN_TOKEN }} # 默认为: .github/afdian-action.cshtml template_filePath: “.github/afdian-action.cshtml” # 默认为: README.md target_filePath: “README.md” # 可省, 高级选项: RazorEngine Complie, 在 cshtml 中需要 using 的 namespace, 多个用 ; 隔开 usings: “” # 可省, 高级选项: RazorEngine Complie, 在 cshtml 中需要添加的 系统引用, 多个用 ; 隔开 # 例如: assemblyReferences: “System.Collections, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” assemblyReferences: “” # 下方为 直接 push 到目标分支, 当然你也可以选择 Pull Request 方式 – name: Commit files run: | git config –local user.email “41898282+github-actions[bot]@users.noreply.github.com” git config –local user.name “github-actions[bot]” git commit -m “Add changes: 爱发电赞助” -a – name: Push changes uses: ad-m/github-push-action@master # https://github.com/ad-m/github-push-action with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: main # 注意修改为你的分支, 例如: master
如果你不想 直接 push, 那么也可以通过 Pull Request# 发起 Pull Request # Make changes to pull request here # https://github.com/peter-evans/create-pull-request – name: Create Pull Request uses: peter-evans/create-pull-request@v3 with: commit-message: “Update 爱发电 赞助” branch: afdian-action/update delete-branch: true branch-suffix: “short-commit-hash” title: [afdian-action] Update 赞助 body: “更新 爱发电 赞助” labels: | afdian-action automated pr
生成效果见 Sponsors.md自定义模板事实上, @Model.Order 值与爱发电官方 queryOrder 返回一致, @Model.Sponsor 值与爱发电官方 querySponsor 返回一致
Related Projectsyiyungent/Afdian.Sdk: 爱发电 非官方 .NET SDKDonateafdian-action is an MIT licensed open source project and completely free to use. However, the amount of effort needed to maintain and develop new features for the project is not sustainable without proper financial backing.
We accept donations through these channels:爱发电Authorafdian-action © yiyun, Released under the MIT License.
Authored and maintained by yiyun with help from contributors (list).GitHub @yiyungent Gitee @yiyungent
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
8. 精力有限,不少源码未能详细测试(解密),不能分辨部分源码是病毒还是误报,所以没有进行任何修改,大家使用前请进行甄别
丞旭猿论坛
暂无评论内容