Skip to main content

curl 触发 github actions

步骤前瞻

获取github access token

img

更改*.github.io/.github/workflows/*.yml

on: 
repository_dispatch:
types:
- webhook-1
- webhook-2

新建客户端仓库yml

name: Trigger Website Build

on:
push:
branches:
- main

jobs:
trigger-website-action:
runs-on: ubuntu-latest

steps:
- name: Trigger Website Build
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.ACCESS_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/json" \
https://api.github.com/repos/{{owner}}/{{repo}}/dispatches \
-d '{"event_type":"webhook-1","client_payload":{"unit":false,"integration":true}}'

配置action需要的密码

仓库页->settings->security->secrets and variables -> actions -> Secrets -> new repository secret