mirror of
https://github.com/actions/setup-java.git
synced 2024-08-16 10:19:51 +02:00
Update Authorization, Add Documentation
This commit is contained in:
parent
b4d76a354b
commit
6d2c5e1f82
3 changed files with 24 additions and 7 deletions
8
dist/setup/index.js
vendored
8
dist/setup/index.js
vendored
|
@ -124201,10 +124201,10 @@ class JetBrainsDistribution extends base_installer_1.JavaBase {
|
|||
const rawVersions = [];
|
||||
while (true) {
|
||||
const requestArguments = `per_page=100&page=${page_index}`;
|
||||
const requestHeaders = {
|
||||
"User-Agent": "jetbrains-jbr-installer",
|
||||
"Authorization": `Token ${process.env.GITHUB_TOKEN}`,
|
||||
};
|
||||
const requestHeaders = {};
|
||||
if (process.env.GITHUB_TOKEN) {
|
||||
requestHeaders['Authorization'] = `Bearer ${process.env.GITHUB_TOKEN}`;
|
||||
}
|
||||
const rawUrl = `https://api.github.com/repos/JetBrains/JetBrainsRuntime/releases?${requestArguments}`;
|
||||
if (core.isDebug() && page_index === 1) {
|
||||
// url is identical except page_index so print it once for debug
|
||||
|
|
|
@ -156,6 +156,21 @@ steps:
|
|||
- 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
|
||||
```yaml
|
||||
steps:
|
||||
|
|
|
@ -98,10 +98,12 @@ export class JetBrainsDistribution extends JavaBase {
|
|||
const rawVersions: IJetBrainsRawVersion[] = [];
|
||||
while (true) {
|
||||
const requestArguments = `per_page=100&page=${page_index}`;
|
||||
const requestHeaders: OutgoingHttpHeaders = {
|
||||
"User-Agent": "jetbrains-jbr-installer",
|
||||
"Authorization": `Token ${process.env.GITHUB_TOKEN}`,
|
||||
const requestHeaders: OutgoingHttpHeaders = {}
|
||||
|
||||
if (process.env.GITHUB_TOKEN) {
|
||||
requestHeaders['Authorization'] = `Bearer ${process.env.GITHUB_TOKEN}`;
|
||||
}
|
||||
|
||||
const rawUrl = `https://api.github.com/repos/JetBrains/JetBrainsRuntime/releases?${requestArguments}`;
|
||||
|
||||
if (core.isDebug() && page_index === 1) {
|
||||
|
|
Loading…
Reference in a new issue