diff --git a/pages/case.md b/pages/case.md index 5d747df..b58794d 100644 --- a/pages/case.md +++ b/pages/case.md @@ -4,17 +4,51 @@ layout: default # 案例分享 -- 五子棋 -- 节假日 - 翻译助手 +- 节假日 +- 五子棋 +- 跨仓库使用 --- -## 案例分享 [五子棋](https://github.com/frostming/frostming) -基于创建 `issue` 触发 Github Actions 更新 `README.md` +## 案例分享 翻译助手 - +基于 `issue` 的内容,识别中文,自动翻译成英文。 + + +
+ +
+ +```yaml +name: 'issue-translator' +on: + issue_comment: + types: [created] + issues: + types: [opened] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: usthe/issues-translate-action@v2.7 + with: + IS_MODIFY_TITLE: true + CUSTOM_BOT_NOTE: Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿 + BOT_GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} +``` + +
+ +
+ + + +
+ +
--- @@ -257,11 +291,113 @@ jobs: --- -## 案例分享 贪吃蛇 +## 案例分享 [五子棋](https://github.com/frostming/frostming) -## 案例分享 翻译助手 +基于创建 `issue` 触发 Github Actions 更新 `README.md` + +
-> 衍生出自动回复机器人?自动评审机器人? +
+ +```yaml +name: "Gomoku" + +on: + issues: + types: [opened] + +jobs: + move: + runs-on: ubuntu-latest + if: startsWith(github.event.issue.title, 'gomoku|') + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Cache PIP + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-py38 + + - name: Install Dependencies + run: | + pip install -r requirements.txt + - name: Play + env: + REPO: ${{ github.repository }} + ISSUE_TITLE: ${{ github.event.issue.title }} + PLAYER: ${{ github.event.issue.user.login }} + ISSUE_NUMBER: ${{ github.event.issue.number }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + python -m chess.runner + + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} +``` + +
+ +
+ + + +
+ +
+ + +--- + +## 案例分享 跨仓库使用 + +`Laravel` 的 `workflows`,统一托管到 [.github](https://github.com/laravel/.github) 下维护。 + + +
+ +
+ + + +
+ +
+ +[`laravel/framework`](https://github.com/laravel/framework/blob/10.x/.github/workflows/pull-requests.yml) + + +```yaml +name: pull requests + +on: + pull_request_target: + types: [opened] + +permissions: + pull-requests: write + +jobs: + uneditable: + uses: laravel/.github/.github/workflows/pull-requests.yml@main +``` + +
+ + +
+ +--- ## [Quarto](https://quarto.org/) - 闲聊机器人 diff --git a/public/assets/images/case-2.png b/public/assets/images/case-2.png new file mode 100644 index 0000000..9f4506f Binary files /dev/null and b/public/assets/images/case-2.png differ diff --git a/public/assets/images/case-3.png b/public/assets/images/case-3.png new file mode 100644 index 0000000..cfdb1ca Binary files /dev/null and b/public/assets/images/case-3.png differ