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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,22 +9,30 @@ jobs:
update_singboxp:
runs-on: ubuntu-latest
steps:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '14'
- name: Auto update singbox_core_PuerNya to prerelease
uses: actions/github-script@v7
with:
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: { id } } = await octokit.request('GET /repos/{owner}/{repo}/actions/workflows', {
const { data: { workflows } } = await github.actions.listRepoWorkflows({
owner: context.repo.owner,
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,
repo: context.repo.repo,
workflow_id: 'update_singbox_core.yaml',
workflow_id: workflowID,
ref: 'dev',
inputs: {
tag1: 'PuerNya/sing-box',