-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added functionality to run a workflow * Fixed 'show all workflow' script * Added workflow running functionality via API
- Loading branch information
Md. Sabbir Alam
authored
Mar 19, 2021
1 parent
7056907
commit 8936829
Showing
4 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// @description Open all workflows | ||
if (options.repos) { | ||
open(options.repos.url + '/actions') | ||
open(options.repos.html_url + '/actions') | ||
} else { | ||
notify('Repository not found', 'error', 3000) | ||
} |
28 changes: 28 additions & 0 deletions
28
src/actions/orgs/option/repos/option/workflows/option/run.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// @description Run the workflow | ||
import { accessToken } from '../../../../../../../utils/constants' | ||
|
||
if (options.repos) { | ||
let ref = prompt('Please insert the git ref for this action?') | ||
if (!ref) { | ||
ref = 'master' | ||
} | ||
|
||
if (options.workflows) { | ||
const url = `${options.workflows.url}/dispatches` | ||
const payload = JSON.stringify({ | ||
ref: ref, | ||
}) | ||
const header = { | ||
Authorization: 'token ' + accessToken, | ||
} | ||
const response = httpPost(url, payload, header) | ||
|
||
if (response.response === '' && response.status === 204) { | ||
notify('Workflow started successfully!', 'success', 3000) | ||
} else { | ||
notify(JSON.stringify(response), 'error', 3000) | ||
} | ||
} | ||
} else { | ||
notify('Repository not found', 'error', 3000) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters