Skip to content

afdian-action

afdian-action #4562

Workflow file for this run

name: 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: release # 注意修改为你的分支, 例如: release
- 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"
assemblyReferences: "System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
usings: "System"
# 下方为 直接 push 到目标分支, 当然你也可以选择 Pull Request 方式
- name: Check for changes
id: verify-changed-files
run: |
if git diff --quiet; then
echo "No changes detected, skipping commit and push"
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "Changes detected, proceeding with commit and push"
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Commit files
if: steps.verify-changed-files.outputs.changed == 'true'
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 "[skip ci] afadian msg update" -a
- name: Push changes
if: steps.verify-changed-files.outputs.changed == 'true'
uses: ad-m/github-push-action@master # https://github.com/ad-m/github-push-action
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: release # 注意修改为你的分支, 例如: release