2023-04-08 00:07:39 +08:00
|
|
|
name: NoneFlow
|
2020-11-20 00:30:46 +08:00
|
|
|
|
|
|
|
on:
|
|
|
|
issues:
|
2020-11-20 16:39:52 +08:00
|
|
|
types: [opened, reopened, edited]
|
2022-03-25 18:24:35 +08:00
|
|
|
pull_request_target:
|
2020-11-20 00:30:46 +08:00
|
|
|
types: [closed]
|
2022-12-30 11:30:47 +08:00
|
|
|
issue_comment:
|
|
|
|
types: [created]
|
2023-04-08 00:07:39 +08:00
|
|
|
pull_request_review:
|
|
|
|
types: [submitted]
|
2020-11-20 00:30:46 +08:00
|
|
|
|
2023-01-04 12:48:10 +08:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.event.issue.number || github.run_id }}
|
2023-06-14 17:05:52 +08:00
|
|
|
cancel-in-progress: false
|
2023-01-04 12:48:10 +08:00
|
|
|
|
2020-11-20 00:30:46 +08:00
|
|
|
jobs:
|
2024-04-22 15:58:48 +08:00
|
|
|
reaction:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: reaction
|
|
|
|
if: |
|
|
|
|
(
|
|
|
|
github.event_name == 'issue_comment' &&
|
|
|
|
github.event.action == 'created'
|
|
|
|
) ||
|
|
|
|
(
|
|
|
|
github.event_name == 'issues' &&
|
|
|
|
github.event.action == 'opened'
|
|
|
|
)
|
|
|
|
steps:
|
|
|
|
- name: Generate token
|
|
|
|
id: generate-token
|
|
|
|
uses: tibdex/github-app-token@v2
|
|
|
|
with:
|
|
|
|
app_id: ${{ secrets.APP_ID }}
|
|
|
|
private_key: ${{ secrets.APP_KEY }}
|
|
|
|
|
|
|
|
- name: Reaction on issue
|
|
|
|
if: github.event_name == 'issues'
|
|
|
|
run: |
|
|
|
|
gh api --method POST /repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/reactions -f "content=rocket"
|
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
|
|
|
|
|
|
|
|
- name: Reaction on issue comment
|
|
|
|
if: github.event_name == 'issue_comment'
|
|
|
|
run: |
|
|
|
|
gh api --method POST /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions -f "content=rocket"
|
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
|
2022-12-30 11:30:47 +08:00
|
|
|
plugin_test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: nonebot2 plugin test
|
2023-04-08 22:29:58 +08:00
|
|
|
if: |
|
|
|
|
!(
|
|
|
|
(
|
|
|
|
github.event.pull_request &&
|
|
|
|
(
|
|
|
|
github.event.pull_request.head.repo.fork ||
|
|
|
|
!(
|
|
|
|
contains(github.event.pull_request.labels.*.name, 'Plugin') ||
|
|
|
|
contains(github.event.pull_request.labels.*.name, 'Adapter') ||
|
|
|
|
contains(github.event.pull_request.labels.*.name, 'Bot')
|
|
|
|
)
|
|
|
|
)
|
|
|
|
) ||
|
|
|
|
(
|
|
|
|
github.event_name == 'issue_comment' && github.event.issue.pull_request
|
|
|
|
)
|
|
|
|
)
|
2022-12-30 11:30:47 +08:00
|
|
|
permissions:
|
|
|
|
issues: read
|
|
|
|
outputs:
|
|
|
|
result: ${{ steps.plugin-test.outputs.RESULT }}
|
|
|
|
output: ${{ steps.plugin-test.outputs.OUTPUT }}
|
2023-06-11 23:48:37 +08:00
|
|
|
metadata: ${{ steps.plugin-test.outputs.METADATA }}
|
2022-12-30 11:30:47 +08:00
|
|
|
steps:
|
|
|
|
- name: Install Poetry
|
2023-01-04 12:48:10 +08:00
|
|
|
if: ${{ !startsWith(github.event_name, 'pull_request') }}
|
2022-12-30 11:30:47 +08:00
|
|
|
run: pipx install poetry
|
2023-04-04 09:48:31 +08:00
|
|
|
|
2022-12-30 11:30:47 +08:00
|
|
|
- name: Setup Python
|
2023-12-08 13:22:29 +08:00
|
|
|
uses: actions/setup-python@v5
|
2022-12-30 11:30:47 +08:00
|
|
|
with:
|
2023-09-02 10:43:48 +08:00
|
|
|
python-version: "3.x"
|
2023-04-04 09:48:31 +08:00
|
|
|
|
2022-12-30 11:30:47 +08:00
|
|
|
- name: Test Plugin
|
|
|
|
id: plugin-test
|
|
|
|
run: |
|
2023-04-08 00:07:39 +08:00
|
|
|
curl -sSL https://github.com/nonebot/noneflow/releases/latest/download/plugin_test.py | python -
|
|
|
|
noneflow:
|
2020-11-20 00:30:46 +08:00
|
|
|
runs-on: ubuntu-latest
|
2023-04-08 00:07:39 +08:00
|
|
|
name: noneflow
|
2022-12-30 11:30:47 +08:00
|
|
|
needs: plugin_test
|
2020-11-20 00:30:46 +08:00
|
|
|
steps:
|
2023-04-04 09:48:31 +08:00
|
|
|
- name: Generate token
|
|
|
|
id: generate-token
|
2023-09-11 12:52:59 +08:00
|
|
|
uses: tibdex/github-app-token@v2
|
2023-04-04 09:48:31 +08:00
|
|
|
with:
|
|
|
|
app_id: ${{ secrets.APP_ID }}
|
|
|
|
private_key: ${{ secrets.APP_KEY }}
|
|
|
|
|
2022-12-30 11:30:47 +08:00
|
|
|
- name: Checkout Code
|
2023-09-05 12:00:44 +08:00
|
|
|
uses: actions/checkout@v4
|
2022-01-20 13:35:58 +08:00
|
|
|
with:
|
2023-04-04 09:48:31 +08:00
|
|
|
token: ${{ steps.generate-token.outputs.token }}
|
|
|
|
|
2023-06-14 17:05:52 +08:00
|
|
|
- name: Cache pre-commit hooks
|
2024-01-18 13:58:14 +08:00
|
|
|
uses: actions/cache@v4
|
2023-06-14 17:05:52 +08:00
|
|
|
with:
|
|
|
|
path: .cache/.pre-commit
|
|
|
|
key: noneflow-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
|
|
|
|
|
2023-04-08 00:07:39 +08:00
|
|
|
- name: NoneFlow
|
|
|
|
uses: docker://ghcr.io/nonebot/noneflow:latest
|
2020-11-20 00:30:46 +08:00
|
|
|
with:
|
2022-01-04 20:23:21 +08:00
|
|
|
config: >
|
|
|
|
{
|
|
|
|
"base": "master",
|
2023-10-02 23:03:05 +08:00
|
|
|
"plugin_path": "assets/plugins.json",
|
|
|
|
"bot_path": "assets/bots.json",
|
|
|
|
"adapter_path": "assets/adapters.json"
|
2022-01-04 20:23:21 +08:00
|
|
|
}
|
2022-12-30 11:30:47 +08:00
|
|
|
env:
|
|
|
|
PLUGIN_TEST_RESULT: ${{ needs.plugin_test.outputs.result }}
|
|
|
|
PLUGIN_TEST_OUTPUT: ${{ needs.plugin_test.outputs.output }}
|
2023-06-11 23:48:37 +08:00
|
|
|
PLUGIN_TEST_METADATA: ${{ needs.plugin_test.outputs.metadata }}
|
2023-04-08 00:07:39 +08:00
|
|
|
APP_ID: ${{ secrets.APP_ID }}
|
|
|
|
PRIVATE_KEY: ${{ secrets.APP_KEY }}
|
2023-06-14 17:05:52 +08:00
|
|
|
PRE_COMMIT_HOME: /github/workspace/.cache/.pre-commit
|
|
|
|
|
|
|
|
- name: Fix permission
|
|
|
|
run: sudo chown -R $(whoami):$(id -ng) .cache/.pre-commit
|