Skip to content

Commit

Permalink
chore: logging the answers
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoraboeuf committed Oct 11, 2023
1 parent d57fb66 commit 9d31afd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ Reusable low-level Ontrack GraphQL client for GitHub Actions.

```bash
npm login --scope=@nemerosa --registry=https://npm.pkg.github.com
npm install @nemerosa/ontrack-github-ingestion-build-links
npm install @nemerosa/ontrack-github-action-client
```

# Usage

```javascript
const client = require('@nemerosa/ontrack-github-ingestion-build-links');
const client = require('@nemerosa/ontrack-github-action-client');

// logging: true or false or undefined
const clientEnvironment = client.checkEnvironment(logging);
Expand All @@ -33,7 +33,7 @@ Typically, these will be defined at repository or organization level and exposed

```yaml
env:
ONTRACK_URL: "${{ secrets.ONTRACK_URL }}"
ONTRACK_URL: "${{ vars.ONTRACK_URL }}"
ONTRACK_TOKEN: "${{ secrets.ONTRACK_TOKEN }}"
```
Expand Down
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ const graphQL = async (clientEnvironment, query, variables, logging) => {
})
});
if (result.status >= 200 && result.status < 300) {
return result.json();
const json = await result.json();
if (logging) {
console.log("Answer: ", json);
}
return json;
} else {
throw Error(`HTTP ${result.status}`);
}
Expand Down

0 comments on commit 9d31afd

Please sign in to comment.