Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/markpatterson27/points-bar
A GitHub action that creates an SVG points bar.
https://github.com/markpatterson27/points-bar
actions assessment autograding feedback points
Last synced: 3 months ago
JSON representation
A GitHub action that creates an SVG points bar.
- Host: GitHub
- URL: https://github.com/markpatterson27/points-bar
- Owner: markpatterson27
- License: mit
- Created: 2021-09-16T09:48:57.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-01T05:42:50.000Z (10 months ago)
- Last Synced: 2024-03-14T21:22:40.598Z (10 months ago)
- Topics: actions, assessment, autograding, feedback, points
- Language: JavaScript
- Homepage:
- Size: 736 KB
- Stars: 7
- Watchers: 1
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Points Bar Action
[![units-test](https://github.com/markpatterson27/points-bar/actions/workflows/test.yml/badge.svg)](https://github.com/markpatterson27/points-bar/actions/workflows/test.yml)
A GitHub action that creates an SVG points bar.
## Usage
```yaml
name: Update Points Baron:
push:jobs:
update:
name: Update points bar
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3# create points bar
- name: points bar
uses: markpatterson27/points-bar@v1
with:
points: '25/50'
path: 'points-bar.svg'# commit and push points-bar if changed
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add 'points-bar.svg'
git commit -m "Add/Update points bar" || exit 0
git push```
## Inputs
| Input Name | Required | Default | Description |
|---|---|---|---|
| `points` | yes | | Points string separated with a / slash. |
| `path` | yes | | File path to save the generated SVG to. |
| `type` | no | 'default' | Style of bar to generate. Can be either 'default' or 'badge'. |
| `bar-color` | no | | Color to use for the points bar. |
| `bar-background` | no | | Background color for the points bar. |
| `font-color` | no | | Color to use for text. |
| `label` | no | 'Points' | Text to use for label part of points bar. |
| `width` | no | | Bar/badge width. |
| `reverse` | no | 'false' | Reverse the progress direction of the bar. i.e. Progress bar moves from right to left. |## Examples
### Default
```yaml
- name: points bar
uses: markpatterson27/points-bar@v1
with:
points: '25/50'
path: '.github/icons/points-bar.svg'
```### Badge
```yaml
- name: points badge
uses: markpatterson27/points-bar@v1
with:
points: '25/50'
path: '.github/icons/points-badge.svg'
type: 'badge'
```### Text and Bar Color
```yaml
- name: points bar color
uses: markpatterson27/points-bar@v1
with:
points: '25/50'
path: '.github/icons/points-bar-color.svg'
bar-color: 'gold'
bar-background: '#115544'
font-color: '#BF5700'
```### Label
```yaml
- name: points bar
uses: markpatterson27/points-bar@v1
with:
points: '25/50'
path: '.github/icons/points-bar-custom-label.svg'
label: 'Score'
``````yaml
- name: autograde badge
uses: markpatterson27/points-bar@v1
with:
points: '25/50'
path: '.github/icons/points-badge-custom-label.svg'
type: 'badge'
label: 'Autograde'
```### Width
```yaml
- name: points bar
uses: markpatterson27/points-bar@v1
with:
points: '25/50'
path: '.github/icons/points-bar-wide.svg'
width: 220
```### Reversed
```yaml
- name: points badge reversed
uses: markpatterson27/points-bar@v1
with:
points: '25/50'
path: '.github/icons/points-badge-reversed.svg'
type: 'badge'
bar-color: '#11BBCC'
bar-background: '#88BBCC'
reverse: true
```## GitHub Classroom Use
The points bar was original written to be used with GitHub Classroom's autograding feature to provide grade score feedback to students. To use the points bar with GitHub Classroom, replace (or edit) the `.github/workflow/classroom.yml` workflow file used by Autograding with the following:
```yaml
name: GitHub Classroom Workflowon:
push:
branches:
- '*'
- '!badges'jobs:
build:
name: Autograding
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo# add id to action so outputs can be used
- uses: education/autograding@v1
id: autograder
continue-on-error: true# switch to badges branch
- run: git checkout badges || git checkout -b badges# create points bar
- name: points bar
uses: markpatterson27/points-bar@v1
with:
points: ${{ steps.autograder.outputs.points }}
path: '.github/badges/points-bar.svg'# commit and push badges if badges have changed
- name: Commit changes to points bar
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add '.github/badges/points-bar.svg'
git commit -m "Add/Update points bar" || exit 0
git push origin badges
```To display the points bar, add the following to the top of the assignment README:
```
![Points bar](../../blob/badges/.github/badges/points-bar.svg)
```If you want to float the points bar to the right, use the following instead:
```html
```## Using the Reusable Points Bar Workflow
This repository includes a [reusable workflow](https://docs.github.com/en/actions/using-workflows/reusing-workflows) for generating a points bar. The workflow includes steps to commit and push the updated points bar back to the repository.
An example of how to use the reusable workflow:
```yaml
name: My Workflow
on:
push:
branches:
- '*'
- '!status'jobs:
update-points-bar:
uses: markpatterson27/points-bar/.github/workflows/reusable-workflow.yml@main
permissions:
contents: write
with:
points: '10/20'
path: '.github/activity-icons/points-bar.svg'
type: 'bar'
bar-color: '#4c1'
bar-background: '#555'
font-color: '#aaa'
label: 'Points'
width: '100'
reverse: false
branch: status
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
```Inputs for the reusable workflow follow the action inputs described above with the following additional inputs:
| Input Name | Required | Default | Description |
|---|---|---|---|
| `branch` | yes | 'main' | Name of branch to commit the points bar to. |
| `token` | yes | | Token with permissions to commit and push updated points bar back to the repository. |## Alternatives
[Badge Action](https://github.com/emibcn/badge-action) creates a customizable badge with many styling options. Useful if you want a customizable badge and don't need a progress style points bar.