Skip to content

Commit 5cc99c3

Browse files
authored
Merge pull request #6 from urcomputeringpal/use-input
Use input for script path
2 parents be05a9f + 6253f26 commit 5cc99c3

File tree

4 files changed

+223
-47
lines changed

4 files changed

+223
-47
lines changed

.github/package-lock.json

Lines changed: 208 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "ts-actions",
3-
"version": "1.0.0",
4-
"description": "TypeScript actions for the GitHub workflow",
2+
"name": "github-script-ts",
3+
"version": "0.0.1",
4+
"description": "A GitHub workflow for Typescript actions",
55
"private": true,
66
"scripts": {
77
"format": "prettier --write src",
@@ -11,9 +11,10 @@
1111
"integration": "./test.sh"
1212
},
1313
"dependencies": {
14-
"@actions/core": "1.9.1",
15-
"@actions/github": "5.0.0",
16-
"@octokit/rest": "18.12.0"
14+
"github-script": "https://github.com/actions/github-script/archive/refs/tags/v6.4.1.tar.gz",
15+
"@actions/core": "1.10.0",
16+
"@actions/github": "5.1.1",
17+
"@octokit/rest": "19.0.7"
1718
},
1819
"devDependencies": {
1920
"@types/jest": "29.5.1",

.github/src/__mocks__/core.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ export const error: jest.MockedFunction<typeof core.error> = jest.fn();
2121
export const warning: jest.MockedFunction<typeof core.warning> = jest.fn();
2222
export const getIDToken: jest.MockedFunction<typeof core.getIDToken> = jest.fn();
2323
export const notice: jest.MockedFunction<typeof core.notice> = jest.fn();
24+
export const summary: jest.MockedFunction<any> = jest.fn();
25+
export const markdownSummary: jest.MockedFunction<any> = jest.fn();
26+
export const toPosixPath: jest.MockedFunction<typeof core.toPosixPath> = jest.fn();
27+
export const toWin32Path: jest.MockedFunction<typeof core.toWin32Path> = jest.fn();
28+
export const toPlatformPath: jest.MockedFunction<typeof core.toPlatformPath> = jest.fn();
2429
export declare enum ExitCode {
2530
/**
2631
* A code indicating that the action was successful

action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ inputs:
99
default: ./.github
1010
required: true
1111
build:
12-
description: Build command
12+
description: Build command. This command is expected to generate output in the `dist` directory.
1313
default: npm run build
1414
function:
1515
description: "Name of the function to call"
@@ -87,7 +87,7 @@ runs:
8787
path: |
8888
${{ inputs.path }}/dist
8989
key: |
90-
github-script-ts-build-${{ runner.os }}-${{ hashFiles(format('{0}/{1}', inputs.path, 'src/*.ts')) }}
90+
github-script-ts-build-${{ runner.os }}-${{ hashFiles(format('{0}/{1}', inputs.path, 'package-lock.json')) }}-${{ hashFiles(format('{0}/{1}', inputs.path, '**/*.ts')) }}
9191
9292
- name: Build
9393
if: inputs.function == '' && steps.build-cache.outputs.cache-hit != 'true'
@@ -111,5 +111,5 @@ runs:
111111
previews: ${{ inputs.previews }}
112112
retry-exempt-status-codes: ${{ inputs.retry-exempt-status-codes }}
113113
script: |
114-
const { ${{ env.FUNCTION_NAME }} } = await import('${{ github.workspace }}/.github/dist/index.js')
114+
const { ${{ env.FUNCTION_NAME }} } = await import('${{ github.workspace }}/${{ inputs.path }}/dist/index.js')
115115
return await ${{ env.FUNCTION_NAME }}({github, context, core});

0 commit comments

Comments
 (0)