-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for summary output (#35)
This PR adds support for [job summary](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary) output. If enabled via the `GITHUB_STEP_SUMMARY` env var, it will write any summary output to the designated file path. A few other housecleaning items were included: - Add the expanded list of available GitHub environment variables to reference in `.env.example` - Move feature information to separate files in `docs/` - Add more tests :) - Add support for `toWin32Path`, `toPlatformPath`, and `toPosixPath` - Add docs on supported `actions/toolkit` packages/functions -
- Loading branch information
Showing
24 changed files
with
1,228 additions
and
60 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 |
---|---|---|
@@ -1,9 +1,58 @@ | ||
# Do not commit your actual .env file to Git! This may contain secrets or other | ||
# private information. | ||
|
||
# Enable/disable step debug logging (default: `false`). For local debugging, it | ||
# may be useful to set it to `true`. | ||
ACTIONS_STEP_DEBUG=true | ||
|
||
# GitHub Actions inputs should follow `INPUT_<name>` format (case-insensitive). | ||
INPUT_milliseconds=2400 | ||
|
||
# Enable/disable step debug logging. Normally this is false by default, but for | ||
# the purpose of debugging, it is set to true here. | ||
ACTIONS_STEP_DEBUG=true | ||
# GitHub Actions default environment variables. These are set for every run of a | ||
# workflow and can be used in your actions. Setting the value here will override | ||
# any value set by the local-action tool. | ||
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables | ||
|
||
# CI="true" | ||
# GITHUB_ACTION="" | ||
# GITHUB_ACTION_PATH="" | ||
# GITHUB_ACTION_REPOSITORY="" | ||
# GITHUB_ACTIONS="" | ||
# GITHUB_ACTOR="mona" | ||
# GITHUB_ACTOR_ID="123456789" | ||
# GITHUB_API_URL="" | ||
# GITHUB_BASE_REF="" | ||
# GITHUB_ENV="" | ||
# GITHUB_EVENT_NAME="" | ||
# GITHUB_EVENT_PATH="" | ||
# GITHUB_GRAPHQL_URL="" | ||
# GITHUB_HEAD_REF="" | ||
# GITHUB_JOB="" | ||
# GITHUB_OUTPUT="" | ||
# GITHUB_PATH="" | ||
# GITHUB_REF="" | ||
# GITHUB_REF_NAME="" | ||
# GITHUB_REF_PROTECTED="" | ||
# GITHUB_REF_TYPE="" | ||
# GITHUB_REPOSITORY="" | ||
# GITHUB_REPOSITORY_ID="" | ||
# GITHUB_REPOSITORY_OWNER="" | ||
# GITHUB_REPOSITORY_OWNER_ID="" | ||
# GITHUB_RETENTION_DAYS="" | ||
# GITHUB_RUN_ATTEMPT="" | ||
# GITHUB_RUN_ID="" | ||
# GITHUB_RUN_NUMBER="" | ||
# GITHUB_SERVER_URL="" | ||
# GITHUB_SHA="" | ||
# GITHUB_STEP_SUMMARY="" | ||
# GITHUB_TRIGGERING_ACTOR="" | ||
# GITHUB_WORKFLOW="" | ||
# GITHUB_WORKFLOW_REF="" | ||
# GITHUB_WORKFLOW_SHA="" | ||
# GITHUB_WORKSPACE="" | ||
# RUNNER_ARCH="" | ||
# RUNNER_DEBUG="" | ||
# RUNNER_NAME="" | ||
# RUNNER_OS="" | ||
# RUNNER_TEMP="" | ||
# RUNNER_TOOL_CACHE="" |
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
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
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,7 +1,8 @@ | ||
/* eslint-disable @typescript-eslint/require-await */ | ||
|
||
import { setFailed } from '@actions/core' | ||
import { setFailed, summary } from '@actions/core' | ||
|
||
export async function run(): Promise<void> { | ||
summary.addRaw('TypeScript Action Failed!') | ||
await summary.write() | ||
|
||
setFailed('TypeScript Action Failed!') | ||
} |
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,5 +1,3 @@ | ||
/* eslint-disable @typescript-eslint/require-await */ | ||
|
||
export async function run(): Promise<void> { | ||
return | ||
return Promise.resolve() | ||
} |
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,9 +1,12 @@ | ||
/* eslint-disable @typescript-eslint/require-await */ | ||
|
||
import { getInput, info, setOutput } from '@actions/core' | ||
import { getInput, info, setOutput, summary } from '@actions/core' | ||
|
||
export async function run(): Promise<void> { | ||
const myInput: string = getInput('myInput') | ||
|
||
setOutput('myOutput', myInput) | ||
|
||
summary.addRaw('TypeScript Action Succeeded!') | ||
await summary.write() | ||
|
||
info('TypeScript Action Succeeded!') | ||
} |
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,19 +1,67 @@ | ||
const addPath = jest.fn() | ||
const debug = jest.fn() | ||
const endGroup = jest.fn() | ||
const error = jest.fn() | ||
const exportVariable = jest.fn() | ||
const getBooleanInput = jest.fn() | ||
const getIDToken = jest.fn() | ||
const getInput = jest.fn() | ||
const getMultilineInput = jest.fn() | ||
const getState = jest.fn() | ||
const group = jest.fn() | ||
const info = jest.fn() | ||
const isDebug = jest.fn() | ||
const notice = jest.fn() | ||
const saveState = jest.fn() | ||
const setCommandEcho = jest.fn() | ||
const setFailed = jest.fn() | ||
const setOutput = jest.fn() | ||
const setSecret = jest.fn() | ||
const startGroup = jest.fn() | ||
const warning = jest.fn() | ||
|
||
const summary = {} | ||
summary['filePath'] = jest.fn().mockReturnValue(summary) | ||
summary['wrap'] = jest.fn().mockReturnValue(summary) | ||
summary['write'] = jest.fn().mockReturnValue(summary) | ||
summary['clear'] = jest.fn().mockReturnValue(summary) | ||
summary['stringify'] = jest.fn().mockReturnValue(summary) | ||
summary['isEmptyBuffer'] = jest.fn().mockReturnValue(summary) | ||
summary['emptyBuffer'] = jest.fn().mockReturnValue(summary) | ||
summary['addRaw'] = jest.fn().mockReturnValue(summary) | ||
summary['addEOL'] = jest.fn().mockReturnValue(summary) | ||
summary['addCodeBlock'] = jest.fn().mockReturnValue(summary) | ||
summary['addList'] = jest.fn().mockReturnValue(summary) | ||
summary['addTable'] = jest.fn().mockReturnValue(summary) | ||
summary['addDetails'] = jest.fn().mockReturnValue(summary) | ||
summary['addImage'] = jest.fn().mockReturnValue(summary) | ||
summary['addHeading'] = jest.fn().mockReturnValue(summary) | ||
summary['addSeparator'] = jest.fn().mockReturnValue(summary) | ||
summary['addBreak'] = jest.fn().mockReturnValue(summary) | ||
summary['addQuote'] = jest.fn().mockReturnValue(summary) | ||
summary['addLink'] = jest.fn().mockReturnValue(summary) | ||
|
||
export { | ||
addPath, | ||
debug, | ||
endGroup, | ||
error, | ||
exportVariable, | ||
getBooleanInput, | ||
getIDToken, | ||
getInput, | ||
getMultilineInput, | ||
getState, | ||
group, | ||
info, | ||
isDebug, | ||
notice, | ||
saveState, | ||
setCommandEcho, | ||
setFailed, | ||
setOutput, | ||
setSecret, | ||
startGroup, | ||
summary, | ||
warning | ||
} |
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.