Skip to content

Commit 800d93e

Browse files
authored
PR for testing solutions for issues accessing TS action (#4)
* use action path * try self-referencing * Update action.yml * Update action.yml * Update action.yml * rm glob pattern * Update action.yml * Update action.yml * Update action.yml * Update action.yml * Update action.yml * remove composite action * update README.md * Fix typo
1 parent 3332619 commit 800d93e

File tree

8 files changed

+51
-71
lines changed

8 files changed

+51
-71
lines changed

.github/workflows/ci.yml

+17-4
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,23 @@ jobs:
4545
runs-on: ubuntu-latest
4646

4747
steps:
48-
- name: Checkout
49-
id: checkout
48+
- name: Checkout repository
5049
uses: actions/checkout@v4
50+
with:
51+
fetch-depth: 0
52+
53+
- name: Get changed files
54+
uses: Khan/actions@get-changed-files-v1
55+
id: changed
5156

52-
- name: Test Local Action
53-
id: test-action
57+
- name: Filter out files that don't need a changeset
58+
uses: Khan/actions@filter-files-v0
59+
id: match
60+
with:
61+
changed-files: ${{ steps.changed.outputs.files }}
62+
invert: true
63+
64+
- name: Verify changeset entries
5465
uses: ./
66+
with:
67+
changed_files: ${{ steps.match.outputs.filtered }}

README.md

+26-9
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,9 @@
55
![CI](https://github.com/actions/typescript-action/actions/workflows/ci.yml/badge.svg)
66

77
This action validates that there is a changeset entry for each package that has
8-
been changed.
9-
10-
This repository has two action files:
11-
12-
| File | Description |
13-
| ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
14-
| [`./action.yml`](./action.yml) | This composite action calls on other Khan actions to prepare a list of changed files. |
15-
| [`./actions/verify-per-package/action.yml`](./actions/verify-per-package/action.yml) | This ts action contains its logic to [`./src/main.ts`](./src/main.ts). It checks for packages corresponding to changed files, then determines if there is a match for each in changesets. |
8+
been changed for a given list of files. It is intended to be used in a workflow
9+
with other actions from the [Khan/actions](https://github.com/Khan/actions)
10+
repo.
1611

1712
## When Making Changes
1813

@@ -41,5 +36,27 @@ steps:
4136

4237
- name: Verify Changeset Per Package
4338
id: changeset-per-package
44-
uses: Khan/changeset-per-package@v1 # Commit with the `v1` tag
39+
uses: Khan/[email protected]
40+
41+
steps:
42+
- name: Checkout with history
43+
uses: actions/checkout@v4
44+
with:
45+
fetch-depth: 0 # This is necessary! Checks out the history so that we can
46+
# get the changset entries diff.
47+
48+
- name: Get changed files
49+
uses: Khan/actions@get-changed-files-v1
50+
id: changed
51+
52+
- name: Filter out files that don't need changeset
53+
uses: Khan/actions@filter-files-v0
54+
id: match
55+
with:
56+
changed-files: ${{ steps.changed.outputs.files }}
57+
58+
- name: Verify changeset entries
59+
uses: Khan/[email protected]
60+
with:
61+
changed_files: ${{ steps.match.outputs.filtered }}
4562
```

action.yml

+5-43
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,10 @@ description: 'Fail if there is not a valid changeset entry for each package.'
33
author: 'Ned Redmond'
44

55
inputs:
6-
exclude_files_and_dirs:
7-
description:
8-
list of comma-separated paths (files or directories ending in /) that
9-
don't need a changeset when changed. Default .github/
10-
required: false
11-
default: .github/
12-
exclude_extensions:
13-
description:
14-
a list of comma-separated extensions that don't need a changeset when
15-
changed. Default <empty>
16-
required: false
17-
default: ''
18-
exclude_globs:
19-
description:
20-
a list of comma-separated globs (using picomatch syntax) that don't need a
21-
changeset when changed. Default <empty>
22-
required: false
23-
default: ''
6+
changed_files:
7+
description: list of changed files
8+
required: true
249

2510
runs:
26-
using: 'composite'
27-
steps:
28-
- name: Checkout repository
29-
uses: actions/checkout@v4
30-
with:
31-
fetch-depth: 0
32-
33-
- name: Get changed files
34-
uses: Khan/actions@get-changed-files-v1
35-
id: changed
36-
37-
- name: Filter out files that don't need a changeset
38-
uses: Khan/actions@filter-files-v0
39-
id: match
40-
with:
41-
changed-files: ${{ steps.changed.outputs.files }}
42-
invert: true
43-
files: ${{ inputs.exclude_files_and_dirs }}
44-
extensions: ${{ inputs.exclude_extensions }}
45-
globs: ${{ inputs.exclude_globs }}
46-
47-
- name: Veryify changeset entries
48-
uses: ./actions/verify-per-package
49-
with:
50-
changed_files: ${{ steps.match.outputs.filtered }}
11+
using: node20
12+
main: dist/index.js

actions/verify-per-package/action.yml

-12
This file was deleted.
File renamed without changes.
File renamed without changes.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"format:write": "prettier --write **/*.ts",
3030
"format:check": "prettier --check **/*.ts",
3131
"lint": "npx eslint . -c ./.github/linters/.eslintrc.yml",
32-
"package": "ncc build src/index.ts -o actions/verify-per-package/dist --license licenses.txt",
32+
"package": "ncc build src/index.ts --license licenses.txt",
3333
"package:watch": "yarn package -- --watch",
3434
"test": "(jest && make-coverage-badge --output-path ./badges/coverage.svg) || make-coverage-badge --output-path ./badges/coverage.svg",
3535
"all": "yarn format:write && yarn lint && yarn test && yarn package"

tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
"moduleResolution": "NodeNext",
88
"baseUrl": "./",
99
"sourceMap": true,
10-
"outDir": "./dist",
10+
"outDir": "dist",
1111
"noImplicitAny": true,
1212
"esModuleInterop": true,
1313
"forceConsistentCasingInFileNames": true,
1414
"strict": true,
1515
"skipLibCheck": true,
1616
"newLine": "lf"
1717
},
18-
"exclude": ["./dist", "./node_modules", "./__tests__", "./coverage"]
18+
"exclude": ["dist", "./node_modules", "./__tests__", "./coverage"]
1919
}

0 commit comments

Comments
 (0)