Skip to content

Commit 318d629

Browse files
committed
Update README and add env name in case of hitting GitHub API limits
1 parent 742cddb commit 318d629

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

README.md

+27
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,33 @@ steps:
5858
run: swift --version
5959
```
6060

61+
To request development snapshots, use one of these options:
62+
63+
**Main development snapshot (trunk)**
64+
65+
```yaml
66+
swift-version: "main-snapshot-2024-08-01"
67+
```
68+
69+
Or you can omit date to lookup for latest available snapshot (note that you may run into GitHub API limits,
70+
which can be avoided if you specify API Token in your project settings)
71+
72+
```yaml
73+
swift-version: "main-snapshot"
74+
```
75+
76+
**Specific version development snapshot**
77+
78+
```yaml
79+
swift-version: "5.7-snapshot-2022-08-30"
80+
```
81+
82+
If date is ommited, it will lookup for the latest snapshot
83+
84+
```yaml
85+
swift-version: "5.7-snapshot"
86+
```
87+
6188
## Note about versions
6289

6390
This project uses strict semantic versioning to determine what version of Swift to configure. This differs slightly from the official convention used by Swift.

dist/index.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -536,10 +536,11 @@ class SnapshotResolver {
536536
}
537537
if (!Array.isArray(json)) {
538538
// fail if couldn't get from second try
539-
let errorMessage = "Failed to retrive snapshot tags. Please, try again later" +
540-
(this.githubClient.hasApiToken()
541-
? "."
542-
: ", or specify GitHub API token in your project settings to avoid limits.");
539+
let errorMessage = "Failed to retrive snapshot tags. Please, try again later.";
540+
if (!this.githubClient.hasApiToken()) {
541+
errorMessage +=
542+
" To avoid limits specify `API_GITHUB_ACCESS_TOKEN` in your project settings.";
543+
}
543544
throw new Error(errorMessage);
544545
}
545546
const tags = json.map((e) => {

src/snapshot-resolver.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,11 @@ export class SnapshotResolver {
8585
if (!Array.isArray(json)) {
8686
// fail if couldn't get from second try
8787
let errorMessage =
88-
"Failed to retrive snapshot tags. Please, try again later" +
89-
(this.githubClient.hasApiToken()
90-
? "."
91-
: ", or specify GitHub API token in your project settings to avoid limits.");
88+
"Failed to retrive snapshot tags. Please, try again later.";
89+
if (!this.githubClient.hasApiToken()) {
90+
errorMessage +=
91+
" To avoid limits specify `API_GITHUB_ACCESS_TOKEN` in your project settings.";
92+
}
9293
throw new Error(errorMessage);
9394
}
9495
const tags: Tag[] = json.map((e: any) => {

0 commit comments

Comments
 (0)