Skip to content

Commit

Permalink
Update passed from value (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
iansu committed Sep 15, 2022
1 parent 40657de commit 697c9ad
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Apollo Schema Check Action Changelog

## 2.0.2 (September 15, 2022)

- Update `from` parameter format. It seems Apollo no longer wants `sec` included with offsets.

## 2.0.1 (July 6, 2022)

- Pass `from` parameter to Apollo Studio API as a string instead of a number (see: [https://status.apollographql.com/incidents/c5dvk0tbg5bv](https://status.apollographql.com/incidents/c5dvk0tbg5bv))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "apollo-schema-check-action",
"description": "A GitHub Action to run a schema check with Apollo Studio and post the results as a comment on a Pull Request",
"version": "2.0.1",
"version": "2.0.2",
"author": "Ian Sutherland <ian@iansutherland.ca>",
"license": "MIT",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions src/get-arguments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ const getApolloConfigFile = async (file: string): Promise<ApolloConfigFile> => {

const getFromValue = (validationPeriod: string): string => {
if (validationPeriod.startsWith('P')) {
return `${toSeconds(parse(validationPeriod))} sec`;
return `${toSeconds(parse(validationPeriod))}`;
} else if (validationPeriod.match(/^-?\d+$/)) {
return `${Math.abs(Number.parseInt(validationPeriod))} sec`;
return `${Math.abs(Number.parseInt(validationPeriod))}`;
} else {
return validationPeriod;
}
Expand Down
6 changes: 3 additions & 3 deletions test/get-arguments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ describe.skip('getQueryVariables', () => {

describe('getFromValue', () => {
test('negative number of seconds', () => {
expect(getFromValue('-86400')).toBe('86400 sec');
expect(getFromValue('-86400')).toBe('86400');
});

test('positive number of seconds', () => {
expect(getFromValue('300')).toBe('300 sec');
expect(getFromValue('300')).toBe('300');
});

test('ISO 8601 duration', () => {
expect(getFromValue('P2W')).toBe('1209600 sec');
expect(getFromValue('P2W')).toBe('1209600');
});

test('Plain text duration', () => {
Expand Down

0 comments on commit 697c9ad

Please sign in to comment.