Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a TypeScript version of the Action #124

Merged
merged 47 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
48a8b24
Add initial JS setup
lucperkins Apr 21, 2024
c624023
Add initial index.ts logic
lucperkins Apr 21, 2024
6ecf39c
Add logic for determinate push binary URL
lucperkins Apr 21, 2024
df04e6f
Finish first pass at TypeScript-ifying the Action
lucperkins Apr 21, 2024
11937f9
Handle rolling minor as a number
lucperkins Apr 21, 2024
e0d369f
Fix name of module in tsup config
lucperkins Apr 21, 2024
e53e6fe
Turn on camel case checking
lucperkins Apr 21, 2024
3ac2082
Fix Boolean setting logic
lucperkins Apr 21, 2024
9d16bd9
Fix error handling logic
lucperkins Apr 21, 2024
82d4904
Undo formatting changes in src
lucperkins Apr 21, 2024
f62fc37
Merge remote-tracking branch 'origin/main' into detsys-ts
lucperkins Apr 21, 2024
4e72993
Add TS-specific logic to Actions
lucperkins Apr 21, 2024
77db23c
Remove unused dependencies in package.json
lucperkins Apr 21, 2024
f8f98eb
Regenerate dist
lucperkins Apr 21, 2024
9636388
Require Nix to be installed
lucperkins Apr 22, 2024
48e96f8
Require org name match only when not mirroring
lucperkins Apr 22, 2024
da469aa
Set all Boolean env vars to string equivalents
lucperkins Apr 22, 2024
f845d1c
Use setFailed instead of throwing errors
lucperkins Apr 22, 2024
0f28bc8
Regenerate dist
lucperkins Apr 22, 2024
cd12e95
Small fix for dev shell
lucperkins Apr 22, 2024
a2dd4ca
Update flake inputs
lucperkins Apr 22, 2024
e1741a2
Revert "Update flake inputs"
lucperkins Apr 22, 2024
91f3fd7
Revert "Small fix for dev shell"
lucperkins Apr 22, 2024
3dc8d8d
Update configuration names in README and action.yml
lucperkins Apr 23, 2024
c351a79
Make available options display a little nicer
lucperkins Apr 23, 2024
71b21a9
Add confirmation output on success
lucperkins Apr 23, 2024
28476f7
Regenerate dist
lucperkins Apr 23, 2024
69d3bd6
Reinstate flakehub-push-* options in action.yaml
lucperkins Apr 23, 2024
e07afbd
Fix source binary logic
lucperkins Apr 23, 2024
010c6d7
Provide better variable names for flake name checking logic
lucperkins Apr 23, 2024
79635ff
Set a default for include-output-paths
lucperkins Apr 23, 2024
307a57f
Remove default from flakehub-push-branch input
lucperkins Apr 23, 2024
4698f00
Switch default for include-output-paths
lucperkins Apr 23, 2024
9717b8b
Update fetch style to gh-env-style
lucperkins Apr 23, 2024
8c74c07
Set visibility via flag
lucperkins Apr 23, 2024
6c6d20e
Opt against nullish coalescing
lucperkins Apr 23, 2024
2552ef3
Turn on strict null checks
lucperkins Apr 23, 2024
83999e5
Add test scaffolding
lucperkins Apr 23, 2024
1c149c4
Revert "Add test scaffolding"
lucperkins Apr 23, 2024
b53080c
Pass name value to flakehub-push as-is
lucperkins Apr 23, 2024
a5416fb
Fix ternary logic
lucperkins Apr 23, 2024
95bf4c0
Regenerate dist
lucperkins Apr 23, 2024
ddb3b31
Remove redundant getters
lucperkins Apr 23, 2024
aa1e86a
Fix issue with extra-labels and extra-tags
lucperkins Apr 23, 2024
cdb5b91
Pass visibility setting to the CLI
lucperkins Apr 23, 2024
0721f9f
Make execution environment determination sync rather than async
lucperkins Apr 23, 2024
993d141
Comment out FLAKEHUB_PUSH_VISIBILITY environment variable handling
lucperkins Apr 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading