Skip to content

Commit

Permalink
Update dependencies and release 2.0.0 (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
grant0417 committed Mar 6, 2024
1 parent 74f2609 commit 8cdbba8
Show file tree
Hide file tree
Showing 25 changed files with 8,795 additions and 10,151 deletions.
110 changes: 56 additions & 54 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,55 +1,57 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": ["warn", {"allowExpressions": true}],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
"accessibility": "no-public"
}
],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}
14 changes: 7 additions & 7 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ on:
branches:
- main
paths-ignore:
- '**.md'
- "**.md"
pull_request:
paths-ignore:
- '**.md'
- "**.md"
workflow_dispatch:

jobs:
check-dist:
if: startsWith(github.head_ref, 'auto-update') == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set Node.js 16.x
uses: actions/setup-node@v3
- name: Set Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x

- name: Install dependencies
run: npm ci
Expand All @@ -46,7 +46,7 @@ jobs:
id: diff

# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: 'build-test'
name: "build-test"
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- main
- 'releases/*'
- "releases/*"
workflow_dispatch:

jobs:
Expand All @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Create Autocomplete PR'
- name: "Create Autocomplete PR"
id: simple-spec
uses: ./
with:
Expand All @@ -31,22 +31,22 @@ jobs:
integration: commander
repo-name: push-to-fig-autocomplete-action
repo-org: withfig
pr-body: 'Integration test (simple-spec)'
pr-body: "Integration test (simple-spec)"
diff-based-versioning: false
- name: Close Pull Request
uses: peter-evans/close-pull@v2
with:
token: ${{ secrets.FIG_BOT_TOKEN }}
pull-request-number: ${{ steps.simple-spec.outputs.pr-number }}
comment: 'Closing created PR'
comment: "Closing created PR"
delete-branch: true

test-diff-based-versioning:
if: startsWith(github.head_ref, 'auto-update') == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Create Autocomplete PR'
- name: "Create Autocomplete PR"
id: diff-based-versioning
uses: ./
with:
Expand All @@ -56,13 +56,13 @@ jobs:
integration: commander
repo-name: push-to-fig-autocomplete-action
repo-org: withfig
pr-body: 'Integration test (diff-based-versioning)'
pr-body: "Integration test (diff-based-versioning)"
diff-based-versioning: true
new-spec-version: 1.1.0
- name: Close Pull Request
uses: peter-evans/close-pull@v2
with:
token: ${{ secrets.FIG_BOT_TOKEN }}
pull-request-number: ${{ steps.diff-based-versioning.outputs.pr-number }}
comment: 'Closing created PR'
comment: "Closing created PR"
delete-branch: true
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ Thumbs.db

# Ignore built ts files
__tests__/runner/*
lib/**/*
lib/**/*
10 changes: 0 additions & 10 deletions .prettierrc.json

This file was deleted.

10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

## Change action.yml

The action.yml defines the inputs and output for your action.
Expand All @@ -16,9 +15,9 @@ import * as core from '@actions/core';
...

async function run() {
try {
try {
...
}
}
catch (error) {
core.setFailed(error.message);
}
Expand All @@ -31,9 +30,10 @@ See the [toolkit documentation](https://github.com/actions/toolkit/blob/master/R

## Publish to a distribution branch

Actions are run from GitHub repos so we will checkin the packed dist folder.
Actions are run from GitHub repos so we will checkin the packed dist folder.

Then run [ncc](https://github.com/zeit/ncc) and push the results:

```bash
$ npm run package
$ git add dist
Expand All @@ -43,7 +43,7 @@ $ git push origin releases/v1

Note: We recommend using the `--license` option for ncc, which will create a license file for all of the production node modules used in your project.

Your action is now published! :rocket:
Your action is now published! :rocket:

See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)

Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
<a href="https://github.com/actions/typescript-action/actions"><img alt="typescript-action status" src="https://github.com/actions/typescript-action/workflows/build-test/badge.svg"></a>
</p>


## Usage

```yml
name: 'Publish version'
name: "Publish version"
on:
push:
tags:
- 'v*'
tags:
- "v*"
workflow_dispatch:

jobs:
Expand All @@ -22,7 +21,8 @@ jobs:
- name: Generate the spec
run:
## Execute commands to generate the spec through some official or third party integration
- name: Create Autocomplete PR
- name:
Create Autocomplete PR
## Create the autocomplete PR using this action
uses: withfig/publish-to-fig-autocomplete@v1
with:
Expand All @@ -44,9 +44,10 @@ jobs:
- `pr-body`: set a custom PR body description

We also provide support for third party autocomplete repos via the following inputs:

- `repo-org`: name of the organization/user that stores the third party autocomplete repository (default: `withfig`)
- `repo-name`: name of the third party autocomplete repository (default: `autocomplete`)
- `diff-based-versioning`: use new diff-based versioning (default: false) (__requires__: `new-spec-version` to be set if `diff-based-versioning` is true)
- `diff-based-versioning`: use new diff-based versioning (default: false) (**requires**: `new-spec-version` to be set if `diff-based-versioning` is true)
- `new-spec-version`: the new spec version (only required when using diff-based-versioning)
- `use-minor-base`: create a new version file per each minor version (only used with diff-based-versioning) (default: `false`)

Expand Down
40 changes: 20 additions & 20 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
name: 'Update Fig Autocomplete spec'
description: 'Action to automatically open a new PR to the withfig/autocomplete repo'
author: 'Fig'
name: "Update Fig Autocomplete spec"
description: "Action to automatically open a new PR to the withfig/autocomplete repo"
author: "Fig"
inputs:
token:
description: 'GitHub access token'
description: "GitHub access token"
default: ${{ github.token }}
autocomplete-spec-name:
required: true
description: 'The spec name in the autocomplete repo. Do not include extension and do not include src/ at the beginning'
description: "The spec name in the autocomplete repo. Do not include extension and do not include src/ at the beginning"
spec-path:
required: true
description: 'The path to the spec in the actual repo'
description: "The path to the spec in the actual repo"
integration:
description: 'The official Fig integration name used to autogenerate the spec'
description: "The official Fig integration name used to autogenerate the spec"
pr-body:
description: 'The created PR description'
description: "The created PR description"
diff-based-versioning:
description: 'Use new diff-based versioning'
default: false
description: "Use new diff-based versioning"
default: "false"
# Diff based versioning params
new-spec-version:
description: 'The new spec version (only required when using diff-based-versioning)'
description: "The new spec version (only required when using diff-based-versioning)"
use-minor-base:
descripttion: 'Create a new version file per each minor version'
default: false
description: "Create a new version file per each minor version"
default: "false"
# Optional params
repo-org:
description: 'The name of the organization that contains the repo in which to create the PR'
default: 'withfig'
repo-name:
description: 'The name of the repo in which to create the PR'
default: 'autocomplete'
description: "The name of the organization that contains the repo in which to create the PR"
default: "withfig"
repo-name:
description: "The name of the repo in which to create the PR"
default: "autocomplete"
runs:
using: 'node16'
main: 'dist/index.js'
using: "node20"
main: "dist/index.js"
1,658 changes: 1,649 additions & 9 deletions dist/index.js

Large diffs are not rendered by default.

Loading

0 comments on commit 8cdbba8

Please sign in to comment.