🔀 Merge pull request #27 from Schneegans/feature/configurable-host

This commit is contained in:
Simon Schneegans
2023-10-07 19:26:49 +02:00
committed by GitHub
4 changed files with 10 additions and 7 deletions

View File

@@ -87,9 +87,10 @@ Embed the badge with:
### Optional Input Parameters ### Optional Input Parameters
| Parameter | Description | Supported in SVG Mode | | Parameter | Description | Supported in SVG Mode |
| ------------- | -------------------------------------------------------------------------------------------------- | --------------------- | | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| `forceUpdate` | Default is `false`. If set to `true`, the gist will be updated even if the content did not change. | ✅ | | `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) ### Shields.io Parameters (optional)

View File

@@ -19,6 +19,10 @@ inputs:
message: message:
description: 'The right text of the badge' description: 'The right text of the badge'
required: true required: true
host:
description: 'The base URL of the gist API'
default: 'https://api.github.com/gists/'
required: false
forceUpdate: forceUpdate:
description: 'If set to true, the gist will be updated even if the content did not change' description: 'If set to true, the gist will be updated even if the content did not change'
default: 'false' default: 'false'

View File

@@ -7,6 +7,7 @@
#### Changes #### 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! - **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. - 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) ## [Dynamic Badges Action 1.6.0](https://github.com/Schneegans/dynamic-badges-action/tree/v1.6.0)

View File

@@ -7,10 +7,7 @@
import core from '@actions/core'; import core from '@actions/core';
import { makeBadge } from 'badge-maker'; import { makeBadge } from 'badge-maker';
const gistUrl = new URL( const gistUrl = new URL(core.getInput('gistID'), core.getInput('host'));
core.getInput('gistID'),
'https://api.github.com/gists/'
);
// This uses the method above to update a gist with the given data. The user agent is // 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 // required as defined in https://developer.github.com/v3/#user-agent-required