Skip to content

Commit

Permalink
chore: remove default files and configs
Browse files Browse the repository at this point in the history
  • Loading branch information
nejdetkadir committed Oct 8, 2023
1 parent 08994f9 commit 9b47e15
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 185 deletions.
4 changes: 2 additions & 2 deletions .github/linters/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ rules:
'no-console': 'off',
'no-unused-vars': 'off',
'prettier/prettier': 'error',
'semi': 'off',
'semi': 'error',
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-ts-comment': 'error',
Expand Down Expand Up @@ -76,7 +76,7 @@ rules:
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/restrict-plus-operands': 'error',
'@typescript-eslint/semi': ['error', 'never'],
'@typescript-eslint/semi': 'error',
'@typescript-eslint/space-before-function-paren': 'off',
'@typescript-eslint/type-annotation-spacing': 'error',
'@typescript-eslint/unbound-method': 'error'
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"semi": true,
"singleQuote": true,
"quoteProps": "as-needed",
"jsxSingleQuote": false,
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ There are a few things to keep in mind when writing your action code:
In `main.ts`, you will see that the action is run in an `async` function.

```javascript
import * as core from '@actions/core'
import * as core from '@actions/core';
//...

async function run() {
try {
//...
} catch (error) {
core.setFailed(error.message)
core.setFailed(error.message);
}
}
```
Expand Down
12 changes: 6 additions & 6 deletions __tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
* Unit tests for the action's entrypoint, src/index.ts
*/

import * as main from '../src/main'
import * as main from '../src/main';

// Mock the action's entrypoint
const runMock = jest.spyOn(main, 'run').mockImplementation()
const runMock = jest.spyOn(main, 'run').mockImplementation();

describe('index', () => {
it('calls run when imported', async () => {
// eslint-disable-next-line @typescript-eslint/no-require-imports
require('../src/index')
require('../src/index');

expect(runMock).toHaveBeenCalled()
})
})
expect(runMock).toHaveBeenCalled();
});
});
80 changes: 0 additions & 80 deletions __tests__/main.test.ts

This file was deleted.

25 changes: 0 additions & 25 deletions __tests__/wait.test.ts

This file was deleted.

36 changes: 1 addition & 35 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
".": "./dist/index.js"
},
"engines": {
"node": ">=20"
"node": ">=18"
},
"scripts": {
"bundle": "npm run format:write && npm run package",
Expand Down
1 change: 1 addition & 0 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* The entrypoint for the action.
*/
import { run } from './main'
import { run } from './main';

// eslint-disable-next-line @typescript-eslint/no-floating-promises
run()
run();
1 change: 1 addition & 0 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
18 changes: 3 additions & 15 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
import * as core from '@actions/core'
import { wait } from './wait'
import * as core from '@actions/core';

/**
* The main function for the action.
* @returns {Promise<void>} Resolves when the action is complete.
*/
export async function run(): Promise<void> {
try {
const ms: string = core.getInput('milliseconds')

// Debug logs are only output if the `ACTIONS_STEP_DEBUG` secret is true
core.debug(`Waiting ${ms} milliseconds ...`)

// Log the current timestamp, wait, then log the new timestamp
core.debug(new Date().toTimeString())
await wait(parseInt(ms, 10))
core.debug(new Date().toTimeString())

// Set outputs for other workflow steps to use
core.setOutput('time', new Date().toTimeString())
// Call the your action code here
} catch (error) {
// Fail the workflow run if an error occurs
if (error instanceof Error) core.setFailed(error.message)
if (error instanceof Error) core.setFailed(error.message);
}
}
14 changes: 0 additions & 14 deletions src/wait.ts

This file was deleted.

6 changes: 5 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"newLine": "lf"
"newLine": "lf",
"paths": {
"@app/lib": ["src/lib"],
"@app/constants": ["src/constants"]
}
},
"exclude": ["./dist", "./node_modules", "./__tests__", "./coverage"]
}

0 comments on commit 9b47e15

Please sign in to comment.