-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (26 loc) · 928 Bytes
/
index.js
File metadata and controls
32 lines (26 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const core = require('@actions/core');
const github = require('@actions/github');
const main = async () => {
try {
const owner = core.getInput('owner', { required: true });
const repo = core.getInput('repo', { required: true });
const branchName = core.getInput('branch_name', { required: true });
const token = core.getInput('token', { required: true });
const workflowName = core.getInput('workflow_name', {required: true})
const octokit = new github.getOctokit(token);
await octokit.request('POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches', {
owner: owner,
repo: repo,
workflow_id: workflowName,
ref: branchName,
inputs: {},
headers: {
'X-GitHub-Api-Version': '2022-11-28'
}
})
} catch (error) {
core.setFailed(error.message);
}
}
// Call the main function to run the action
main();