Update core_auto_update.yml

This commit is contained in:
juewuy
2024-03-23 15:27:48 +08:00
committed by GitHub
parent 03e711a1ee
commit 575f1d5d4b

View File

@@ -9,22 +9,30 @@ jobs:
update_singboxp: update_singboxp:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '14'
- name: Auto update singbox_core_PuerNya to prerelease - name: Auto update singbox_core_PuerNya to prerelease
uses: actions/github-script@v7 uses: actions/github-script@v7
with: with:
script: | script: |
const { Octokit } = require("@octokit/core"); const { GitHub } = require('@actions/github');
const github = new GitHub(process.env.GITHUB_TOKEN);
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN }); const { data: { workflows } } = await github.actions.listRepoWorkflows({
const { data: { id } } = await octokit.request('GET /repos/{owner}/{repo}/actions/workflows', {
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo repo: context.repo.repo
}); });
await octokit.request('POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches', {
const targetWorkflow = workflows.find(workflow => workflow.name === 'update_singbox_core');
const workflowID = targetWorkflow.id;
await github.actions.createWorkflowDispatch({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
workflow_id: 'update_singbox_core.yaml', workflow_id: workflowID,
ref: 'dev', ref: 'dev',
inputs: { inputs: {
tag1: 'PuerNya/sing-box', tag1: 'PuerNya/sing-box',