Update Authorization, Add Documentation

This commit is contained in:
Gregory Mitchell 2024-07-09 10:33:58 -05:00
parent b4d76a354b
commit 6d2c5e1f82
No known key found for this signature in database
GPG key ID: 771A6C995A086B84
3 changed files with 24 additions and 7 deletions

8
dist/setup/index.js vendored
View file

@ -124201,10 +124201,10 @@ class JetBrainsDistribution extends base_installer_1.JavaBase {
const rawVersions = []; const rawVersions = [];
while (true) { while (true) {
const requestArguments = `per_page=100&page=${page_index}`; const requestArguments = `per_page=100&page=${page_index}`;
const requestHeaders = { const requestHeaders = {};
"User-Agent": "jetbrains-jbr-installer", if (process.env.GITHUB_TOKEN) {
"Authorization": `Token ${process.env.GITHUB_TOKEN}`, requestHeaders['Authorization'] = `Bearer ${process.env.GITHUB_TOKEN}`;
}; }
const rawUrl = `https://api.github.com/repos/JetBrains/JetBrainsRuntime/releases?${requestArguments}`; const rawUrl = `https://api.github.com/repos/JetBrains/JetBrainsRuntime/releases?${requestArguments}`;
if (core.isDebug() && page_index === 1) { if (core.isDebug() && page_index === 1) {
// url is identical except page_index so print it once for debug // url is identical except page_index so print it once for debug

View file

@ -156,6 +156,21 @@ steps:
- run: java -cp java HelloWorldApp - run: java -cp java HelloWorldApp
``` ```
The JetBrains installer uses the GitHub API to fetch the latest version. If you believe your project is going to be running into rate limits, you can provide a
GitHub token to the action to increase the rate limit. Set the `GITHUB_TOKEN` environment variable to the value of your GitHub token in the workflow file.
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'jetbrains'
java-version: '11'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: java -cp java HelloWorldApp
```
## Installing custom Java package type ## Installing custom Java package type
```yaml ```yaml
steps: steps:

View file

@ -98,10 +98,12 @@ export class JetBrainsDistribution extends JavaBase {
const rawVersions: IJetBrainsRawVersion[] = []; const rawVersions: IJetBrainsRawVersion[] = [];
while (true) { while (true) {
const requestArguments = `per_page=100&page=${page_index}`; const requestArguments = `per_page=100&page=${page_index}`;
const requestHeaders: OutgoingHttpHeaders = { const requestHeaders: OutgoingHttpHeaders = {}
"User-Agent": "jetbrains-jbr-installer",
"Authorization": `Token ${process.env.GITHUB_TOKEN}`, if (process.env.GITHUB_TOKEN) {
requestHeaders['Authorization'] = `Bearer ${process.env.GITHUB_TOKEN}`;
} }
const rawUrl = `https://api.github.com/repos/JetBrains/JetBrainsRuntime/releases?${requestArguments}`; const rawUrl = `https://api.github.com/repos/JetBrains/JetBrainsRuntime/releases?${requestArguments}`;
if (core.isDebug() && page_index === 1) { if (core.isDebug() && page_index === 1) {