Skip to content

Commit

Permalink
fix: provide more info on private repos when missing access (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav authored Sep 8, 2023
1 parent 07c0fb5 commit 1b5230d
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
- **[fix]**: Provide more information for private repos when missing access
## [1.6.1] - 2022-10-14
- **[fix]**: Use fallback on CirclCI API glitches
- **[fix]**: Fallback to main branch when CIRCLE_BRANCH is missing
- **[fix]**: Incorrect API page query param
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ width="100%" alt="Nx - Smart, Extensible Build Framework"></p>
version: 2.1

orbs:
nx: nrwl/[email protected].1
nx: nrwl/[email protected].2

jobs:
checks:
Expand Down
2 changes: 1 addition & 1 deletion src/examples/custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: >
usage:
version: 2.1
orbs:
nx: nrwl/[email protected].1
nx: nrwl/[email protected].2
jobs:
build:
docker:
Expand Down
2 changes: 1 addition & 1 deletion src/examples/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: >
usage:
version: 2.1
orbs:
nx: nrwl/[email protected].1
nx: nrwl/[email protected].2
jobs:
build:
docker:
Expand Down
2 changes: 1 addition & 1 deletion src/examples/private.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ description: >
usage:
version: 2.1
orbs:
nx: nrwl/[email protected].1
nx: nrwl/[email protected].2
12 changes: 10 additions & 2 deletions src/scripts/find-successful-workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,16 @@ async function getJson(url) {

res.on('end', () => {
const response = Buffer.concat(data).toString();
const responseJSON = JSON.parse(response);
resolve(responseJSON);
try {
const responseJSON = JSON.parse(response);
resolve(responseJSON);
} catch (e) {
if (response.includes('Project not found')) {
reject(new Error(`Error: Project not found.\nIf you are using a private repo, make sure the CIRCLE_API_TOKEN is set.\n\n${response}`));
} else {
reject(e)
}
}
});
}).on('error', error => reject(
circleToken
Expand Down

0 comments on commit 1b5230d

Please sign in to comment.