Skip to content

GitHub

  • 修改 Languages

创建 .gitattributes 文件,示例意味忽略 web/ 目录下的所有文件

ignore
web/** linguist-vendored
  • 删除 Contributors 记录

在确保没有该用户的 commit 记录后,随便修改掉默认分支的名称,然后再改回来

  • 利用 Action 发布 releases
yml
on:
  push:
    tags:
      - 'v*.*.*'

permissions:
  contents: write

- uses: softprops/action-gh-release@v2
  env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  with:
    files: dist/*
  • 利用 Action 发布 ghpage
yml
permissions:
  pages: write
  id-token: write

environment:
  name: github-pages
  url: ${{ steps.deployment.outputs.page_url }}

- uses: actions/upload-pages-artifact@v3
  with:
    path: '.'

- id: deployment
  uses: actions/deploy-pages@v4
  • 下载存档

仓库分支存档的下载链接 github.com/USER/REPO/archive/refs/heads/BRANCH.tar.gz

Release 最新版本的下载链接 github.com/USER/REPO/releases/latest/download/ASSETS.tar.gz

  • 删除仓库的 deployments 记录

将所有部署标记为非活动状态,然后一次删除 100 个部署

REPO="OWNER_NAME/REPO_NAME"
for ID in $(gh api --method GET "/repos/$REPO/deployments?per_page=100" | jq -r ".[] | .id")
do
    gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" --method POST /repos/$REPO/deployments/$ID/statuses -f "state=inactive"
    gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" --method DELETE /repos/$REPO/deployments/$ID
done