幸运的是,我们身处 AI 时代,许多曾经遥不可及的想法,如今有了实现的可能。前不久,在访问星日语的博客时,他为 Stellar 主题开发的获取最新评论功能给了我灵感。我茅塞顿开:何不借助 AI 的力量,将我的动态友链项目彻底重构,并打造成一个可复用的 GitHub Workflow 呢?这样一来,至少能解决那个配置和更新繁琐的最大痛点。
# Controls when the workflow will run on: issues: # 新增(打开)/关闭/重新打开/设置标签/移除标签 types: [opened, closed, reopened, labeled, unlabeled] # 手动触发 workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" reachability-checker: # The type of runner that the job will run on runs-on:ubuntu-latest permissions: contents:write issues:write # Steps represent a sequence of tasks that will be executed as part of the job steps: -name:Checkoutrepository uses:actions/checkout@v4 # 检查链接状态 -name:CheckReachability uses:xaoxuu/links-checker@main env: GITHUB_TOKEN:${{secrets.GITHUB_TOKEN}} with: checker:'reachability' unreachable_label:'失联' exclude_issue_with_labels:'审核中, 白名单, 缺少互动, 缺少文章'# 具有哪些标签的issue不进行检查 # 检查完毕后重新生成一下JSON -name:Generatedata.json uses:xaoxuu/issues2json@main env: GITHUB_TOKEN:${{secrets.GITHUB_TOKEN}} with: data_version:'v2' data_path:'/v2/data.json' sort:'posts-desc'# created-desc/created-asc/updated-desc/updated-asc/version-desc/posts-desc exclude_issue_with_labels:'审核中, 缺少互动, 缺少文章, 风险网站'# 具有哪些标签的issue不生成到JSON中 hide_labels:'白名单'# 这些标签不显示在前端页面 -name:SetupGitConfig run:| git config --global user.name 'github-actions[bot]' git config --global user.email 'github-actions[bot]@users.noreply.github.com' -name:CommitandPushtooutputbranch run:| git fetch origin output || true git checkout -B output git add --all git commit -m "Update data from issues" || echo "No changes to commit" git push -f origin output