alp*_*aca 6 github github-actions
我使用 GitHub Actions 并想在本地测试它。我正在使用这个工具,它工作正常。 https://github.com/nektos/act
我可以提供一个 event.json 用于本地测试,但是创建一个真正的事件负载真的很难。
有没有办法获得真正的事件有效载荷?例如,我从控制台在我的存储库上创建拉取请求,并获取该事件有效负载 json。
要获取事件数据,您可以使用 GitHub 操作将事件打印到日志中。
# change this to the event type you want to get the data for
on:
pull_request:
types: [opened, closed, reopened]
jobs:
printJob:
name: Print event
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
echo "$GITHUB_CONTEXT"
Run Code Online (Sandbox Code Playgroud)
或者,您可以在文档中找到示例事件数据:https : //docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#webhook-payload-example-30
| 归档时间: |
|
| 查看次数: |
1312 次 |
| 最近记录: |