You've already forked dynamic-badges-action
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65787a717d | ||
|
|
cfd1eebb35 | ||
|
|
42207bfa4c | ||
|
|
4c1242cfa4 | ||
|
|
7788d4f27b | ||
|
|
a298000e06 | ||
|
|
5ba090896c | ||
|
|
2f15321252 | ||
|
|
a96c4be21f | ||
|
|
fe55f62a4b | ||
|
|
9ee069bab8 |
2
.github/workflows/badges.yml
vendored
2
.github/workflows/badges.yml
vendored
@@ -8,7 +8,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Get the Numbers
|
- name: Get the Numbers
|
||||||
run: echo "::set-env name=ANSWER::42"
|
run: echo "ANSWER=42" >> $GITHUB_ENV
|
||||||
- name: Create the Badge
|
- name: Create the Badge
|
||||||
uses: schneegans/dynamic-badges-action@master
|
uses: schneegans/dynamic-badges-action@master
|
||||||
with:
|
with:
|
||||||
|
|||||||
14
README.md
14
README.md
@@ -8,7 +8,7 @@ This action allows you to create badges for your README.md with [shields.io](htt
|
|||||||
|
|
||||||
This action supports all [configuration options of shields.io/endpoint](https://shields.io/endpoint) and can be used in various ways:
|
This action supports all [configuration options of shields.io/endpoint](https://shields.io/endpoint) and can be used in various ways:
|
||||||
* Show custom CI statistics from GitHub actions, such as code coverage or detailed test results.
|
* Show custom CI statistics from GitHub actions, such as code coverage or detailed test results.
|
||||||
* Show metadata of your repository such as lines of code, comment line percentage, ...
|
* Show metadata of your repository such as [lines of code, comment line percentage](https://schneegans.github.io/tutorials/2020/08/16/badges), ...
|
||||||
* Basically anything which may change from commit to commit!
|
* Basically anything which may change from commit to commit!
|
||||||
|
|
||||||
## How Does It Work?
|
## How Does It Work?
|
||||||
@@ -33,13 +33,13 @@ https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/schneegan
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
1. Head over to [gist.github.com](https://gist.github.com/) and create a new gist. You will need the ID of the gist (this is the long alphanumerical part of its URL) later.
|
1. Head over to [gist.github.com](https://gist.github.com/) and create a new gist. You can name the file `test.json`, but this can be changed later as well. You will need the ID of the gist (this is the long alphanumerical part of its URL) later.
|
||||||
2. Navigate to [github.com/settings/tokens](https://github.com/settings/tokens) and create a new token with the *gist* scope.
|
2. Navigate to [github.com/settings/tokens](https://github.com/settings/tokens) and create a new token with the *gist* scope.
|
||||||
3. Go to the *Secrets* page of the settings of your repository and add this token as a new secret. You can give it any name, for example `GIST_SECRET`.
|
3. Go to the *Secrets* page of the settings of your repository and add this token as a new secret. You can give it any name, for example `GIST_SECRET`.
|
||||||
4. Add something like the following to your workflow:
|
4. Add something like the following to your workflow:
|
||||||
```yml
|
```yml
|
||||||
- name: Create Awesome Badge
|
- name: Create Awesome Badge
|
||||||
uses: schneegans/dynamic-badges-action@v1.0.0
|
uses: schneegans/dynamic-badges-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
auth: ${{ secrets.GIST_SECRET }}
|
auth: ${{ secrets.GIST_SECRET }}
|
||||||
gistID: <gist-ID>
|
gistID: <gist-ID>
|
||||||
@@ -49,7 +49,7 @@ https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/schneegan
|
|||||||
color: orange
|
color: orange
|
||||||
```
|
```
|
||||||
|
|
||||||
Once the action is executed, got to your gist.
|
Once the action is executed, go to your gist.
|
||||||
There should be a new file called `test.json`.
|
There should be a new file called `test.json`.
|
||||||
You can view the raw content of this file at `https://gist.githubusercontent.com/<user>/<gist-ID>/raw/test.json`.
|
You can view the raw content of this file at `https://gist.githubusercontent.com/<user>/<gist-ID>/raw/test.json`.
|
||||||
Embed the badge with:
|
Embed the badge with:
|
||||||
@@ -71,7 +71,7 @@ Gist Parameter | Description
|
|||||||
`label` | Required. The left text of the badge.
|
`label` | Required. The left text of the badge.
|
||||||
`message` | Required. The right text of the badge.
|
`message` | Required. The right text of the badge.
|
||||||
`labelColor` | The left color of the badge.
|
`labelColor` | The left color of the badge.
|
||||||
`color` | The right color of the badge.
|
`color` | The right color of the badge. For custom colors wrap color string in quotes `"#bf155b"`
|
||||||
`isError` | The color will be red and cannot be overridden.
|
`isError` | The color will be red and cannot be overridden.
|
||||||
`namedLogo` | A logo name from [simpleicons.org](http://simpleicons.org/).
|
`namedLogo` | A logo name from [simpleicons.org](http://simpleicons.org/).
|
||||||
`logoSvg` | An svg-string to be used as logo.
|
`logoSvg` | An svg-string to be used as logo.
|
||||||
@@ -87,9 +87,9 @@ A common usage pattern of this action is to create environment variables in prev
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
- name: Get the Numbers
|
- name: Get the Numbers
|
||||||
run: echo "::set-env name=ANSWER::42"
|
run: echo "ANSWER=42" >> $GITHUB_ENV
|
||||||
- name: Create the Badge
|
- name: Create the Badge
|
||||||
uses: schneegans/dynamic-badges-action@v1.0.0
|
uses: schneegans/dynamic-badges-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
auth: ${{ secrets.GIST_SECRET }}
|
auth: ${{ secrets.GIST_SECRET }}
|
||||||
gistID: <gist-ID>
|
gistID: <gist-ID>
|
||||||
|
|||||||
30
changelog.md
Normal file
30
changelog.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# Changelog of the Dynamic Badges Action
|
||||||
|
|
||||||
|
## [Dynamic Badges Action 1.2.0](https://github.com/Schneegans/dynamic-badges-action/tree/v1.2.0)
|
||||||
|
|
||||||
|
**Release Date:** 2022-03-26
|
||||||
|
|
||||||
|
#### Changes
|
||||||
|
|
||||||
|
* The action does not log the response of writing the Gist anymore.
|
||||||
|
* Added this changelog.
|
||||||
|
|
||||||
|
|
||||||
|
## [Dynamic Badges Action 1.1.0](https://github.com/Schneegans/dynamic-badges-action/tree/v1.1.0)
|
||||||
|
|
||||||
|
**Release Date:** 2021-06-16
|
||||||
|
|
||||||
|
#### Changes
|
||||||
|
|
||||||
|
* The action now logs an error message when writing the Gist failed.
|
||||||
|
* Used new API for setting environment variables in the README.md examples.
|
||||||
|
|
||||||
|
|
||||||
|
## [Dynamic Badges Action 1.0.0](https://github.com/Schneegans/dynamic-badges-action/tree/v1.0.0)
|
||||||
|
|
||||||
|
**Release Date:** 2020-08-16
|
||||||
|
|
||||||
|
#### Changes
|
||||||
|
|
||||||
|
* Initial publication on GitHub.
|
||||||
|
|
||||||
10
index.js
10
index.js
@@ -86,9 +86,13 @@ try {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
res => {
|
res => {
|
||||||
let body = '';
|
if (res.statusCode < 200 || res.statusCode >= 400) {
|
||||||
res.on('data', data => body += data);
|
core.setFailed(
|
||||||
res.on('end', () => console.log('result:' + body));
|
'Failed to create gist, response status code: ' + res.statusCode +
|
||||||
|
', status message: ' + res.statusMessage);
|
||||||
|
} else {
|
||||||
|
console.log('Success!');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
req.write(request);
|
req.write(request);
|
||||||
|
|||||||
Reference in New Issue
Block a user