Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
First draft
- Loading branch information
1 parent
b8b3df6
commit d3d705842bf1b5a37ab2362b9cedf5959cdd5db9
Showing
13 changed files
with
479 additions
and
55 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
@@ -14,6 +14,7 @@ | ||
"project": "./tsconfig.eslint.json" | ||
}, | ||
"rules": { | ||
"@typescript-eslint/camelcase": ["off"] | ||
}, | ||
"env": { | ||
"node": 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
@@ -0,0 +1,252 @@ | ||
name: "examples" | ||
on: [push] | ||
|
||
jobs: | ||
# make sure the action works on a clean machines without building | ||
|
||
## Basic | ||
test_basic_success: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Test Basic Success | ||
conclusion: success | ||
|
||
test_basic_success_with_output: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Test Basic Success (Implicit) | ||
conclusion: success | ||
output: | ||
summary: Test was a success | ||
text_description: | | ||
This is a text description of the annotations and images | ||
With more stuff | ||
And more | ||
test_basic_failure: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Test Basic Failure | ||
conclusion: failure | ||
|
||
# Other codes | ||
test_basic_neutral: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Test 1 = Neutral | ||
conclusion: neutral | ||
|
||
test_basic_cancelled: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Test Basic Cancelled | ||
conclusion: cancelled | ||
|
||
test_basic_timed_out: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Test Basic Timed Out | ||
conclusion: timed_out | ||
|
||
test_basic_action_required: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Test Basic Action Required | ||
conclusion: action_required | ||
|
||
## Based on command | ||
test_with_annotation: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Test Advanced With Output | ||
conclusion: success | ||
|
||
## With annotations | ||
test_with_annotations: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Test With Annotations | ||
conclusion: success | ||
output: # output.summary is required with annotations! | ||
summary: Some warnings in README.md | ||
annotations: | ||
- path: README.md | ||
annotation_level: warning | ||
title: Spell Checker | ||
message: Check your spelling for 'banaas'. | ||
raw_details: Do you mean 'bananas' or 'banana'? | ||
start_line: 1 | ||
end_line: 2 | ||
|
||
test_with_annotations_from_run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- id: annotations | ||
run: | | ||
echo ::set-output name=value::{"path":"README.md","start_line":1,"end_line":2,"message":"Check your spelling for 'banaas'.","annotation_level":"warning"} | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Test With Annotations From Run | ||
conclusion: success | ||
output: # output.summary is required with annotations! | ||
summary: Some warnings in README.md | ||
annotations: ${{ steps.annotations.outputs.value }} | ||
|
||
## With images | ||
test_with_images: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Test With Images | ||
conclusion: success | ||
output: # output.summary is required with images! | ||
summary: Some cool pics | ||
images: | ||
- alt: Cool pic | ||
image_url: https://via.placeholder.com/150 | ||
caption: Cool description | ||
|
||
test_with_images_from_run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- id: images | ||
run: | | ||
echo ::set-output name=value::{"alt":"Cool pic","image_url":"https://via.placeholder.com/150","caption":"Cool description"} | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Test With Images From Run | ||
conclusion: success | ||
output: # output.summary is required with images! | ||
summary: Some warnings in README.md | ||
images: ${{ steps.images.outputs.value }} | ||
|
||
## With actions | ||
# TODO: HOW DO WE SET THE WEBHOOK! | ||
test_with_actions: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Test With Actions | ||
conclusion: success | ||
actions: | ||
- label: Click Me | ||
description: Click me to get free RAM | ||
identifier: sent_to_webhook | ||
|
||
test_with_actions_from_run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- id: actions | ||
run: | | ||
echo ::set-output name=value::{"label":"Click Me","description":"Click me to get free RAM","identifier":"sent_to_webhook"} | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Test With Actions From Run | ||
conclusion: success | ||
# output.summary is required with actions! | ||
output: | ||
summary: Some warnings in README.md | ||
actions: ${{ steps.actions.outputs.value }} | ||
|
||
## With init | ||
test_with_init: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Test With Init | ||
status: in_progress | ||
- run: sleep 30 | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
status: completed | ||
conclusion: failure | ||
|
||
test_with_init_implicit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Test With Init (Implicit) | ||
status: in_progress | ||
- run: sleep 30 | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
conclusion: failure | ||
|
||
## Based on job | ||
test_based_job_success: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: ./ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Test Based On Job (Success) | ||
conclusion: ${{ job }} | ||
|
||
test_based_job_failure: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- run: false | ||
- uses: ./ | ||
if: always() | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Test Based On Job (Failure) | ||
conclusion: ${{ job }} |
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
@@ -1,8 +1,8 @@ | ||
{ | ||
"printWidth": 80, | ||
"printWidth": 120, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": false, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"bracketSpacing": false, | ||
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
@@ -1,15 +1,15 @@ | ||
import * as process from 'process' | ||
import * as cp from 'child_process' | ||
import * as path from 'path' | ||
import * as process from 'process'; | ||
import * as cp from 'child_process'; | ||
import * as path from 'path'; | ||
|
||
// shows how the runner will run a javascript action with env / stdout protocol | ||
test('test runs', () => { | ||
process.env['TOKEN'] = 'ABC' | ||
const ip = path.join(__dirname, '..', 'lib', 'main.js') | ||
process.env['TOKEN'] = 'ABC'; | ||
const ip = path.join(__dirname, '..', 'lib', 'main.js'); | ||
const options: cp.ExecSyncOptions = { | ||
env: process.env, | ||
} | ||
console.log(cp.execSync(`node ${ip}`, options).toString()) | ||
}) | ||
}; | ||
console.log(cp.execSync(`node ${ip}`, options).toString()); | ||
}); | ||
|
||
// TODO: add more |
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.