From 606d12105c685a6d38b8cb713549e7ed8cfdce9c Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 7 Oct 2023 18:49:27 +0200 Subject: [PATCH 1/4] :tada: Add host parameter --- action.yml | 4 ++++ index.js | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 90291f1..562e246 100644 --- a/action.yml +++ b/action.yml @@ -19,6 +19,10 @@ inputs: message: description: 'The right text of the badge' required: true + host: + description: 'The base URL of the gist API' + default: 'https://api.github.com/gists/' + required: false forceUpdate: description: 'If set to true, the gist will be updated even if the content did not change' default: 'false' diff --git a/index.js b/index.js index 7cea9db..0432a64 100644 --- a/index.js +++ b/index.js @@ -7,10 +7,7 @@ import core from '@actions/core'; import { makeBadge } from 'badge-maker'; -const gistUrl = new URL( - core.getInput('gistID'), - 'https://api.github.com/gists/' -); +const gistUrl = new URL(core.getInput('gistID'), core.getInput('host')); // This uses the method above to update a gist with the given data. The user agent is // required as defined in https://developer.github.com/v3/#user-agent-required From 5dcfe114e3fb088b578fc9a67a629b63c8576e0e Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 7 Oct 2023 18:49:42 +0200 Subject: [PATCH 2/4] :memo: Document new host parameter --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cdc9f23..57bcbdd 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,7 @@ Embed the badge with: | Parameter | Description | Supported in SVG Mode | | ------------- | -------------------------------------------------------------------------------------------------- | --------------------- | +| `host` | Default is `https://api.github.com/gists/`. You can change this if you're using GitHub enterprise. | ✅ | | `forceUpdate` | Default is `false`. If set to `true`, the gist will be updated even if the content did not change. | ✅ | ### Shields.io Parameters (optional) From cb47279d0805196aece8afc07f5db461f2d50d7c Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 7 Oct 2023 18:53:56 +0200 Subject: [PATCH 3/4] :memo: Add example enterprise host --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 57bcbdd..45fadd1 100644 --- a/README.md +++ b/README.md @@ -87,10 +87,10 @@ Embed the badge with: ### Optional Input Parameters -| Parameter | Description | Supported in SVG Mode | -| ------------- | -------------------------------------------------------------------------------------------------- | --------------------- | -| `host` | Default is `https://api.github.com/gists/`. You can change this if you're using GitHub enterprise. | ✅ | -| `forceUpdate` | Default is `false`. If set to `true`, the gist will be updated even if the content did not change. | ✅ | +| Parameter | Description | Supported in SVG Mode | +| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | +| `host` | Default is `https://api.github.com/gists/`. You can change this if you're using GitHub enterprise. The URL will be something like `github-enterprise-hostname/api/v3/gists`. | ✅ | +| `forceUpdate` | Default is `false`. If set to `true`, the gist will be updated even if the content did not change. | ✅ | ### Shields.io Parameters (optional) From d57076bbf122cbfda44997559095825c78a58871 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 7 Oct 2023 18:54:07 +0200 Subject: [PATCH 4/4] :memo: Add changelog entry --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index e1b9024..59437ef 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,7 @@ #### Changes - **SVG Mode:** If your gist filename ends with `.svg` instead of `.json`, the action will now generate an SVG badge instead of a JSON file. This is useful if you cannot use shields.io for some reason. However, this SVG mode does not support all features of shields.io. Thanks to [@runarberg](https://github.com/runarberg) for this contribution! +- **New `host` Parameter:** You can now specify the host for the gist API. This is useful if you want to use the action on a GitHub enterprise instance. Thanks to [@LucBerge](https://github.com/LucBerge) for this idea! - The action now runs on Node 20 instead of Node 16. ## [Dynamic Badges Action 1.6.0](https://github.com/Schneegans/dynamic-badges-action/tree/v1.6.0)