Skip to content

README.md example workflow patch #613

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

Open
wants to merge 31 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5d90a13
Add support for github pull request annotations (#367)
t3chguy Nov 27, 2022
cc2d03c
(ISSUELESS) Parse line, column and code in ts errors as numbers (#416)
abenhamdine Nov 27, 2022
f321f19
Simplify default values
abenhamdine Nov 27, 2022
2e3c200
Update readme
abenhamdine Nov 28, 2022
d26c1aa
Bump eslint from 8.28.0 to 8.31.0 (#444)
dependabot[bot] Jan 5, 2023
ae86d42
Update version of futuratrepadeira/changed-files used
abenhamdine Jan 5, 2023
1d5c57a
Bump @typescript-eslint/parser from 5.44.0 to 5.48.0 (#445)
dependabot[bot] Jan 5, 2023
0fbc920
Bump @types/node from 18.11.9 to 18.11.18 (#442)
dependabot[bot] Jan 5, 2023
247e6ab
Bump globby from 13.1.2 to 13.1.3 (#449)
dependabot[bot] Jan 22, 2023
44c9f10
Bump @vercel/ncc from 0.34.0 to 0.36.0 (#448)
dependabot[bot] Jan 22, 2023
9fa627e
Bump eslint-plugin-jest from 27.1.6 to 27.2.1 (#451)
dependabot[bot] Jan 22, 2023
86d9a0b
Bump typescript from 4.9.3 to 5.0.2 (#469)
dependabot[bot] Mar 27, 2023
d184cc3
Bump @typescript-eslint/eslint-plugin from 5.44.0 to 5.56.0 (#470)
dependabot[bot] Mar 27, 2023
400280a
Bump @octokit/rest from 19.0.5 to 19.0.7 (#458)
dependabot[bot] Mar 27, 2023
3c5ce5d
Update usage example in README.md (#463)
bharathvaj-ganesan Mar 27, 2023
afca8f4
Bump jest and @types/jest (#472)
dependabot[bot] Mar 27, 2023
2b11cbd
Bump ts-jest from 29.0.3 to 29.0.5 (#455)
dependabot[bot] Mar 27, 2023
d0f63bd
Bump @typescript-eslint/parser from 5.48.0 to 5.59.1 (#487)
dependabot[bot] Apr 26, 2023
8781ec6
Bump @types/node from 18.11.18 to 18.16.1 (#490)
dependabot[bot] Apr 26, 2023
716dcc8
Bump jest-circus from 29.3.1 to 29.5.0 (#476)
dependabot[bot] Apr 26, 2023
cdf2a70
Update some dependencies, fix security error
abenhamdine Apr 26, 2023
8a05d00
Fix some lint false positives
abenhamdine Apr 26, 2023
bea17d7
Package
abenhamdine Apr 26, 2023
3c0f3c8
Update action version to use nodejs 16
abenhamdine Apr 26, 2023
c7f9bf7
Force nodejs16 for action
abenhamdine Apr 26, 2023
6fcaac2
part of #170 : Support editing existing comment if one exists (#471)
josephluck Apr 26, 2023
0e25ee8
Package
abenhamdine Apr 26, 2023
39ded72
Bump eslint from 8.39.0 to 8.42.0 (#520)
dependabot[bot] Jun 14, 2023
050d2d2
Bump @typescript-eslint/parser from 5.59.1 to 5.62.0 (#542)
dependabot[bot] Oct 14, 2023
2a52563
Bump typescript from 5.0.4 to 5.2.2 (#557)
dependabot[bot] Oct 14, 2023
b71c222
Update README.md
C0dex73 Feb 21, 2025
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
2 changes: 2 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"project": "./tsconfig.json"
},
"rules": {
"i18n-text/no-en": "off",
"no-console": "off",
"filenames/match-regex": "off",
"github/array-foreach": "off",
Expand All @@ -21,6 +22,7 @@
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"no-shadow": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": [
"error",
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ jobs:
uses: Equip-Collaboration/diff-line-numbers@v1.0.0
with:
include: '["\\.ts$"]'
node-version: '16'
- name: Print line numbers of changed lines
run: echo Line numbers = ${{ toJSON(steps.diff.outputs.lineNumbers) }}
- name: Detecting files changed
id: files
uses: futuratrepadeira/changed-files@v3.2.1
uses: umani/changed-files@v4.0.1
with:
repo-token: ${{ github.token }}
pattern: '^.*\.ts$'
Expand Down
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
include: '["\\.ts$"]'
- name: Detecting files changed
id: files
uses: futuratrepadeira/changed-files@v3.2.1
uses: umani/changed-files@v4.0.0
with:
repo-token: ${{ github.token }}
pattern: '^.*\.ts$'
Expand All @@ -46,7 +46,7 @@ jobs:
echo 'Files modified: ${{steps.files.outputs.files_updated}}'
echo 'Files added: ${{steps.files.outputs.files_created}}'
echo 'Files removed: ${{steps.files.outputs.files_deleted}}'
- uses: Arhia/action-check-typescript@v0.11
- uses: snapshift/action-check-typescript@v1.1.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
use-check: true
Expand All @@ -55,6 +55,8 @@ jobs:
files-added: ${{steps.files.outputs.files_created}}
files-deleted: ${{steps.files.outputs.files_deleted}}
line-numbers: ${{steps.diff.outputs.lineNumbers}}
output-behaviour: both
comment-behaviour: new
```
## Customize the check

Expand All @@ -74,6 +76,21 @@ Value|Behaviour
`errors_in_pr`| Check fails if any errors are present in the files added/modified in the PR branch (even if already in base branche).
`errors_in_code`| Check fails if any errors are present in the whole branch.

The output behaviour depends on the value of `output-behaviour`

Value|Behaviour
-- | --
`comment` | Default, comments on the PR with the errors found for this run.
`annotate` | Uses github line annotations with the errors found for this run.
`both` | Does both of the above.

The comment behaviour depends on the value of `comment-behaviour`

Value|Behaviour
-- | --
`new` | Default, adds a new comment for every run of the action.
`edit` | Updates a previous run's comment, if one exists, otherwise creates a new comment.

## Use a specific tsconfig file

By default, this actions uses tsconfig file located at './tsconfig.json'
Expand All @@ -86,4 +103,4 @@ parameter `ts-config-path` :

```yml
ts-config-path: './tsconfig.check.json'
```
```
42 changes: 21 additions & 21 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ test('1. parse tsc error line', () => {
const errorParsed = parseTscErrorLine(line, tscMatcher)
expect(errorParsed).toBeDefined()
expect(errorParsed.fileName).toEqual('src/main.ts')
expect(errorParsed.line).toEqual('39')
expect(errorParsed.column).toEqual('11')
expect(errorParsed.code).toEqual('1155')
expect(errorParsed.line).toEqual(39)
expect(errorParsed.column).toEqual(11)
expect(errorParsed.code).toEqual(1155)
expect(errorParsed.severity).toEqual('error')
expect(errorParsed.message).toEqual("'const' declarations must be initialized.")
})
Expand All @@ -26,9 +26,9 @@ test('1.2 parse tsc error line with pipe ', () => {
const errorParsed = parseTscErrorLine(line, tscMatcher)
expect(errorParsed).toBeDefined()
expect(errorParsed.fileName).toEqual('server/webAPI/sal/webApiSalAddUpdate.ts')
expect(errorParsed.line).toEqual('45')
expect(errorParsed.column).toEqual('41')
expect(errorParsed.code).toEqual('2345')
expect(errorParsed.line).toEqual(45)
expect(errorParsed.column).toEqual(41)
expect(errorParsed.code).toEqual(2345)
expect(errorParsed.severity).toEqual('error')
expect(errorParsed.message).toEqual("Argument of type '(err?: Error | null | undefined, client?: PoolClient | undefined, sal_id?: number | null | undefined) => void' is not assignable to parameter of type 'IWebApiCallback'.")
})
Expand All @@ -42,32 +42,32 @@ test('2. parse output', () => {
expect(linesParsed).toHaveLength(2)
expect(linesParsed[0].fileName).toEqual('src/main.ts')
expect(linesParsed[1].fileName).toEqual('src/main.ts')
expect(linesParsed[1].column).toEqual('11')
expect(linesParsed[1].column).toEqual(11)
})

test('3. compareErrors', () => {

const errorsBefore: ErrorTs[] = [{
message: 'test',
line: '3',
column: '20',
code: '60312',
line: 3,
column: 20,
code: 60312,
fileName: 'src/fakeErrors.ts',
fileNameResolved: 'src/fakeErrors.ts'
}]

const errorsAfter: ErrorTs[] = [{
message: 'test',
line: '3',
column: '20',
code: '60312',
line: 3,
column: 20,
code: 60312,
fileName: 'src/fakeErrors.ts',
fileNameResolved: 'src/fakeErrors.ts'
}, {
message: 'test2',
line: '10',
column: '20',
code: '60312',
line: 10,
column: 20,
code: 60312,
fileName: 'src/fakeErrors.ts',
fileNameResolved: 'src/fakeErrors.ts'
}]
Expand Down Expand Up @@ -102,8 +102,8 @@ test('4. Parsing output', () => {
test('5. compare errors test 1', () => {

const resultCompareErrors = compareErrors({
errorsBefore: errorsBaseBranch as unknown as ErrorTs[],
errorsAfter: errorsCurrentBranch as unknown as ErrorTs[],
errorsBefore: errorsBaseBranch,
errorsAfter: errorsCurrentBranch,
filesChanged: filesModified.split(' '),
filesAdded: filesAdded.split(' '),
filesDeleted: filesRemoved.split(' '),
Expand All @@ -121,10 +121,10 @@ test('5. compare errors test 1', () => {
})

const comment = getBodyComment({
errorsInProjectBefore: errorsBaseBranch,
errorsInProjectAfter: errorsCurrentBranch,
errorsInProjectBefore: errorsBaseBranch as unknown as ErrorTs[],
errorsInProjectAfter: errorsCurrentBranch as unknown as ErrorTs[],
newErrorsInProject: resultCompareErrors.errorsAdded,
errorsInModifiedFiles,
errorsInModifiedFiles: errorsInModifiedFiles as unknown as ErrorTs[],
newErrorsInModifiedFiles
})

Expand Down
2 changes: 1 addition & 1 deletion __tests__/test_compare_1/erreursBaseBranch.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion __tests__/test_compare_1/erreursBaseBranch.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion __tests__/test_compare_1/errorsCurrentBranch.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion __tests__/test_compare_1/errorsCurrentBranch.ts

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions __tests__/test_compare_2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { filesAdded, filesModified, filesRemoved } from './test_compare_2/filesC
test.skip('1. compare errors test 2', () => {

const resultCompareErrors = compareErrors({
errorsBefore: errorsBaseBranch as unknown as ErrorTs[],
errorsAfter: errorsCurrentBranch as unknown as ErrorTs[],
errorsBefore: errorsBaseBranch,
errorsAfter: errorsCurrentBranch,
filesChanged: filesModified.split(' '),
filesAdded: filesAdded.split(' '),
filesDeleted: filesRemoved.split(' '),
Expand Down
2 changes: 1 addition & 1 deletion __tests__/test_compare_2/erreursBaseBranch.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion __tests__/test_compare_2/erreursBaseBranch.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion __tests__/test_compare_2/errorsCurrentBranch.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion __tests__/test_compare_2/errorsCurrentBranch.ts

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions __tests__/test_compare_2/filesChanged.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.filesRemoved = exports.filesAdded = exports.filesModified = void 0;
exports.filesModified = 'server/constants.ts server/reports/canUserGenerateReport.ts server/reports/data/getDataShared.ts server/reports/data/shared/generateCritDesc.ts server/reports/data/shared/getTitres.ts server/reports/data/shared/groupOnColNo.ts server/reports/data/shared/shared.d.ts server/reports/dataReportsMgr.ts server/reports/handlebars/handlebarsHelpers.spec.ts server/reports/handlebars/handlebarsHelpers.ts server/reports/objectToTemplateArray.ts server/reports/reportsConfigs.ts server/reports/templateMgr.ts';
exports.filesAdded = 'server/reports/data/getDataVarsSaisRubs.ts server/reports/data/templateConfigs/configVarsSaisRubs.ts';
exports.filesModified = 'server/api/contrats/services/GetInfosCnt.ts server/payrollEngine/PayrollEngine.ts server/payrollEngine/declaCalc.d.ts server/payrollEngine/selectBulsToRecalculate.ts';
exports.filesAdded = '';
exports.filesRemoved = '';
2 changes: 1 addition & 1 deletion __tests__/test_compare_2/lineNumbers.js

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

Loading