mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-28 07:06:56 +08:00
e7fc5b7b7e
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
101 lines
2.9 KiB
YAML
101 lines
2.9 KiB
YAML
name: NoneFlow
|
|
|
|
on:
|
|
issues:
|
|
types: [opened, reopened, edited]
|
|
pull_request_target:
|
|
types: [closed]
|
|
issue_comment:
|
|
types: [created]
|
|
pull_request_review:
|
|
types: [submitted]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.issue.number || github.run_id }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
plugin_test:
|
|
runs-on: ubuntu-latest
|
|
name: nonebot2 plugin test
|
|
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
|
|
)
|
|
)
|
|
permissions:
|
|
issues: read
|
|
outputs:
|
|
result: ${{ steps.plugin-test.outputs.RESULT }}
|
|
output: ${{ steps.plugin-test.outputs.OUTPUT }}
|
|
metadata: ${{ steps.plugin-test.outputs.METADATA }}
|
|
steps:
|
|
- name: Install Poetry
|
|
if: ${{ !startsWith(github.event_name, 'pull_request') }}
|
|
run: pipx install poetry
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.x"
|
|
|
|
- name: Test Plugin
|
|
id: plugin-test
|
|
run: |
|
|
curl -sSL https://github.com/nonebot/noneflow/releases/latest/download/plugin_test.py | python -
|
|
noneflow:
|
|
runs-on: ubuntu-latest
|
|
name: noneflow
|
|
needs: plugin_test
|
|
steps:
|
|
- name: Generate token
|
|
id: generate-token
|
|
uses: tibdex/github-app-token@v1
|
|
with:
|
|
app_id: ${{ secrets.APP_ID }}
|
|
private_key: ${{ secrets.APP_KEY }}
|
|
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ steps.generate-token.outputs.token }}
|
|
|
|
- name: Cache pre-commit hooks
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: .cache/.pre-commit
|
|
key: noneflow-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
|
|
|
|
- name: NoneFlow
|
|
uses: docker://ghcr.io/nonebot/noneflow:latest
|
|
with:
|
|
config: >
|
|
{
|
|
"base": "master",
|
|
"plugin_path": "website/static/plugins.json",
|
|
"bot_path": "website/static/bots.json",
|
|
"adapter_path": "website/static/adapters.json"
|
|
}
|
|
env:
|
|
PLUGIN_TEST_RESULT: ${{ needs.plugin_test.outputs.result }}
|
|
PLUGIN_TEST_OUTPUT: ${{ needs.plugin_test.outputs.output }}
|
|
PLUGIN_TEST_METADATA: ${{ needs.plugin_test.outputs.metadata }}
|
|
APP_ID: ${{ secrets.APP_ID }}
|
|
PRIVATE_KEY: ${{ secrets.APP_KEY }}
|
|
PRE_COMMIT_HOME: /github/workspace/.cache/.pre-commit
|
|
|
|
- name: Fix permission
|
|
run: sudo chown -R $(whoami):$(id -ng) .cache/.pre-commit
|