-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
1,348 additions
and
112 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module.exports = { | ||
env: { | ||
es6: true | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended' | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
'project': 'tsconfig.json', | ||
'sourceType': 'module' | ||
}, | ||
plugins: [ | ||
'@typescript-eslint' | ||
], | ||
rules: { | ||
'no-trailing-spaces': 'error', | ||
'no-console': 'off', | ||
|
||
'@typescript-eslint/semi': ['error', 'never'], | ||
'@typescript-eslint/indent': ['error', 2], | ||
'@typescript-eslint/member-delimiter-style': 'off', | ||
'@typescript-eslint/no-explicit-any': 'warn', | ||
'@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': 'next|res|req' }], | ||
|
||
'func-call-spacing': 'off', | ||
'@typescript-eslint/func-call-spacing': 'error', | ||
|
||
'quotes': 'off', | ||
'@typescript-eslint/quotes': ['error', 'single'], | ||
|
||
'comma-spacing': 'off', | ||
'@typescript-eslint/comma-spacing': ['error'] | ||
} | ||
}; |
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,15 @@ | ||
name: Message Echo 1 | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
message: | ||
required: true | ||
description: "Message to echo" | ||
|
||
jobs: | ||
hello: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Echo message | ||
run: echo '${{ github.event.inputs.message }}' |
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,16 @@ | ||
name: Message Echo 2 | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
message: | ||
required: false | ||
default: "this is echo 2" | ||
description: "Message to echo" | ||
|
||
jobs: | ||
hello: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Echo message | ||
run: echo '${{ github.event.inputs.message }}' |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
}, | ||
"eslint.format.enable": true, | ||
"[typescript]": { | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint" | ||
} | ||
} |
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,21 +1,62 @@ | ||
# Workflow Dispatch Action | ||
# GitHub Action for Dispatching Workflows | ||
|
||
This action triggers another GitHub Actions workflow, via the `workflow_dispatch` event | ||
This action triggers another GitHub Actions workflow, using the `workflow_dispatch` event. | ||
The workflow must be configured for this event type e.g. `on: [workflow_dispatch]` | ||
|
||
This allows you to chain workflows, the classic use case is have a CI build workflow, trigger a CD release/deploy workflow when it completes. Allowing you to maintain separate workflows for CI and CD, and pass data between them as required. | ||
|
||
For details of `workflow_dispatch` see [this blog post introducing this type of event trigger](https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/) | ||
|
||
Note. The GitHub UI will report flows triggered by this action as "manually triggered" even though they have been run programmatically via another workflow and the API | ||
|
||
## Inputs | ||
### `workflow` | ||
**Required.** The name of the workflow to trigger and run. | ||
|
||
### `workflow-id` | ||
### `token` | ||
|
||
**Required** The id of thw workflow to trgger and run. | ||
**Required.** A GitHub access token (PAT) with write access to the repo in question. **NOTE.** The automatically provided token e.g. `${{ secrets.GITHUB_TOKEN }}` can not be used, GitHub prevents this token from being able to fire the `workflow_dispatch` and `repository_dispatch` event. [The reasons are explained in the docs](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token). | ||
|
||
## Outputs | ||
The solution is to manually create a PAT and store it as a secret e.g. `${{ secrets.PERSONAL_TOKEN }}` | ||
|
||
### `time` | ||
### `inputs` | ||
**Optional.** The inputs to pass to the workflow (if any are configured), this must be a JSON encoded string, e.g. `{ "myInput": "foobar" }` | ||
|
||
The time we greeted you. | ||
### `ref` | ||
**Optional.** The Git reference used with the triggered workflow run. The reference can be a branch, tag, or a commit SHA. If omitted the context ref of the triggering workflow is used | ||
|
||
## Example usage | ||
### `repo` | ||
**Optional.** The default behavior is to trigger workflows in the same repo as the triggering workflow, if you wish to trigger in another GitHub repo "externally", then provide the owner + repo name with slash between them e.g. `microsoft/vscode` | ||
|
||
uses: actions/hello-world-javascript-action@v1 | ||
with: | ||
who-to-greet: 'Mona the Octocat' | ||
|
||
## Outputs | ||
None | ||
|
||
|
||
## Example usage | ||
```yaml | ||
- name: Invoke workflow without inputs | ||
uses: benc-uk/workflow-dispatch@v1 | ||
with: | ||
workflow: My Workflow | ||
token: ${{ secrets.PERSONAL_TOKEN }} | ||
``` | ||
```yaml | ||
- name: Invoke workflow with inputs | ||
uses: benc-uk/workflow-dispatch@v1 | ||
with: | ||
workflow: Another Workflow | ||
token: ${{ secrets.PERSONAL_TOKEN }} | ||
inputs: '{ "message": "blah blah", "debug": true }' | ||
``` | ||
```yaml | ||
- name: Invoke workflow in another repo with inputs | ||
uses: benc-uk/workflow-dispatch@v1 | ||
with: | ||
workflow: Some Workflow | ||
repo: benc-uk/example | ||
token: ${{ secrets.PERSONAL_TOKEN }} | ||
inputs: '{ "message": "blah blah", "debug": true }' | ||
``` |
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
Oops, something went wrong.