Skip to content

Commit

Permalink
Merge pull request #124 from DeterminateSystems/detsys-ts
Browse files Browse the repository at this point in the history
Provide a TypeScript version of the Action
  • Loading branch information
lucperkins authored Apr 23, 2024
2 parents 75dd778 + 993d141 commit 7f4cf85
Show file tree
Hide file tree
Showing 23 changed files with 98,762 additions and 139 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# https://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

73 changes: 73 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"plugins": ["@typescript-eslint"],
"extends": ["plugin:github/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"settings": {
"import/resolver": {
"typescript": {}
}
},
"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",
{
"argsIgnorePattern": "^_"
}
],
"@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": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"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-floating-promises": "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
}
}
32 changes: 32 additions & 0 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: TypeScript-based Action

on:
pull_request:
push:
branches: [main]

jobs:
check-dist-up-to-date:
name: Check the dist/ folder is up to date
runs-on: ubuntu-22.04
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Install pnpm dependencies
run: nix develop --command pnpm install
- name: Check formatting
run: nix develop --command pnpm run check-fmt
- name: Run ESLint
run: nix develop --command pnpm run lint
- name: Build bundle
run: nix develop --command pnpm run build
- name: Package as Node.js runnable
run: nix develop --command pnpm run package
- name: Check git status
run: git status --porcelain=v1
- name: Ensure no staged changes
run: git diff --exit-code
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3

- uses: DeterminateSystems/nix-installer-action@main

- uses: DeterminateSystems/magic-nix-cache-action@main

- uses: DeterminateSystems/flake-checker-action@main
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/production-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,27 @@ jobs:
runs-on: UbuntuLatest32Cores128G
timeout-minutes: 5
if: |
(github.event.action == 'labeled' && github.event.label.name == 'production test')
|| (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'production test'))
(github.event.action == 'labeled' && github.event.label.name == 'production test')
|| (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'production test'))
permissions:
id-token: write # In order to request a JWT for AWS auth
contents: read # Specifying id-token wiped this out, so manually specify that this action is allowed to checkout this private repo
steps:
- uses: actions/checkout@v3

- uses: DeterminateSystems/nix-installer-action@main

- uses: DeterminateSystems/magic-nix-cache-action@main

- uses: actions/download-artifact@v3
with:
name: flakehub-push-X64-Linux
path: flakehub-push-X64-Linux

- name: Production test
if: |
(github.event.action == 'labeled' && github.event.label.name == 'production test')
|| (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'production test'))
(github.event.action == 'labeled' && github.event.label.name == 'production test')
|| (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'production test'))
uses: ./
with:
visibility: "hidden"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
(github.event.action == 'labeled' && github.event.label.name == 'upload to s3')
|| (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'upload to s3'))
)
release:
needs: build

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target
/result
/.direnv/
/.direnv/
/node_modules
10 changes: 3 additions & 7 deletions .graphqlrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"schema": [
"src/graphql/github_schema.graphql"
],
"documents": [
"src/graphql/query/*.graphql"
]
}
"schema": ["src/graphql/github_schema.graphql"],
"documents": ["src/graphql/query/*.graphql"]
}
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/dist
/src
pnpm-lock.yaml
Loading

0 comments on commit 7f4cf85

Please sign in to comment.