Skip to content

Commit

Permalink
Implement composite architecture (#1)
Browse files Browse the repository at this point in the history
* make composite to call other actions

* adjust linters

* adjust node version

* stub setFailed and skip text linter (who wants that)

* fix path

* change vercel output dir

* add dist

* change path format

* Update action.yml
  • Loading branch information
nedredmond committed Sep 21, 2023
1 parent 04b8182 commit bddfe84
Show file tree
Hide file tree
Showing 16 changed files with 12,812 additions and 24 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
4 changes: 4 additions & 0 deletions .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ MD004:
# Ordered list item prefix
MD029:
style: one

# Line length
MD013:
line_length: 120
2 changes: 1 addition & 1 deletion .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
cache: yarn

- name: Install Dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
id: setup-node
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
cache: yarn

- name: Install Dependencies
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
id: setup-node
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
cache: yarn

- name: Install Dependencies
Expand All @@ -42,3 +42,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TYPESCRIPT_DEFAULT_STYLE: prettier
VALIDATE_JSCPD: false
VALIDATE_NATURAL_LANGUAGE: false
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Create a JavaScript Action Using TypeScript

![Test Coverage](badges/coverage.svg)
[![GitHub Super-Linter](https://github.com/actions/typescript-action/actions/workflows/linter.yml/badge.svg)](https://github.com/super-linter/super-linter)
![CI](https://github.com/actions/typescript-action/actions/workflows/ci.yml/badge.svg)

Expand Down
4 changes: 3 additions & 1 deletion __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import * as utils from '../src/utils'

// Mock the GitHub Actions core library
const infoMock = jest.spyOn(core, 'info')
const setFailedMock = jest.spyOn(core, 'setFailed')
const setFailedMock = jest
.spyOn(core, 'setFailed')
.mockImplementation(console.debug)
const inputMock = jest
.spyOn(core, 'getInput')
.mockImplementation((name: string): string => {
Expand Down
13 changes: 10 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ author: 'Ned Redmond'

inputs:
changed_files:
description: list of changed files
description: JSON list of changed files
required: true

runs:
using: node20
main: dist/index.js
using: 'composite'
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Veryify changeset entries
uses: ./actions/verify-per-package
with:
changed_files: ${{ inputs.changed_files }}
12 changes: 12 additions & 0 deletions actions/verify-per-package/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 'Ensure there is a valid changeset entry for each package'
description: 'Fail if there is not a valid changeset entry for each package.'
author: 'Ned Redmond'

inputs:
changed_files:
description: list of changed files
required: true

runs:
using: node20
main: dist/index.js
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"format:write": "prettier --write **/*.ts",
"format:check": "prettier --check **/*.ts",
"lint": "npx eslint . -c ./.github/linters/.eslintrc.yml",
"package": "ncc build src/index.ts --license licenses.txt",
"package": "ncc build src/index.ts --out sub-actions/verify-per-package/dist --license licenses.txt",
"package:watch": "yarn package -- --watch",
"test": "(jest && make-coverage-badge --output-path ./badges/coverage.svg) || make-coverage-badge --output-path ./badges/coverage.svg",
"all": "yarn format:write && yarn lint && yarn test && yarn package"
Expand Down Expand Up @@ -70,6 +70,7 @@
"@actions/github": "^5.1.1"
},
"devDependencies": {
"@changesets/cli": "^2.26.2",
"@types/jest": "^29.5.5",
"@types/node": "^20.6.3",
"@typescript-eslint/eslint-plugin": "^6.7.2",
Expand Down
Loading

0 comments on commit bddfe84

Please sign in to comment.