macoaure / badge-action
Generate dynamic badges using shields.io API
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >=8.1
- ext-curl: *
- psr/log: ^3.0
- symfony/console: *
Requires (Dev)
- ergebnis/composer-normalize: ^2.47
- ergebnis/license: ^2.6
- friendsofphp/php-cs-fixer: ^3.75
- mikey179/vfsstream: ^1.6
- mockery/mockery: ^1.6
- monolog/monolog: ^3.9
- pestphp/pest: ^3.8
- phpunit/php-code-coverage: ^11.0
- squizlabs/php_codesniffer: ^3.12
README
A GitHub Action for generating dynamic SVG badges using Shields.io. Create and update beautiful, customizable badges directly in your GitHub repository.
🌟 Features
- 🎨 Fully Customizable: Colors, styles, logos, and more
- 🔄 Dynamic Updates: Automatically update badges on repository changes
- 🎯 Multiple Badge Styles: Support for flat, flat-square, plastic, for-the-badge, and social styles
- 🔒 Cache Control: Configure badge caching for optimal performance
- 🔗 Clickable Badges: Add links to make badges interactive
- 🛡️ Powered by Shields.io: Built on the reliable Shields.io API
📋 Quick Start
- Create a badges directory in your repository:
mkdir -p badges
- Add this to your GitHub workflow:
- name: Generate Badge uses: macoaure/badge-action@v1 with: label: "build" status: "passing" path: "badges/build.svg" color: "green" style: "flat-square"
- Reference your badge in your README:
[](https://github.com/USER/REPO/actions)
🎯 Use Cases
Build Status Badge
- name: Generate Build Badge uses: macoaure/badge-action@v1 with: label: "build" status: "passing" path: "badges/build.svg" color: "green" logo: "github"
Version Badge
- name: Generate Version Badge uses: macoaure/badge-action@v1 with: label: "version" status: ${{ github.ref_name }} path: "badges/version.svg" color: "blue" style: "flat-square"
Coverage Badge
- name: Generate Coverage Badge uses: macoaure/badge-action@v1 with: label: "coverage" status: "95%" path: "badges/coverage.svg" color: "brightgreen" logo: "codecov"
📝 Inputs
Input | Description | Required | Default |
---|---|---|---|
label |
Left side text | Yes | - |
status |
Right side text | Yes | - |
path |
Output file path | Yes | - |
color |
Badge color | No | blue |
label-color |
Left side color | No | 555 |
style |
Badge style | No | flat-square |
logo |
Logo from simple-icons.org | No | - |
logo-color |
Logo color | No | - |
cache-seconds |
Cache duration | No | - |
link |
Clickable URL | No | - |
max-age |
Maximum cache age | No | - |
🎨 Available Styles
flat
- Flat styleflat-square
- Flat square styleplastic
- 3D plastic stylefor-the-badge
- Bold, wider stylesocial
- Social media style
🔄 Complete Workflow Example
name: Generate Badges on: push: branches: [main] jobs: generate-badges: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 # Optional: Calculate coverage if needed - name: Calculate coverage id: coverage run: | # Your coverage calculation here echo "coverage=95%" >> $GITHUB_OUTPUT - name: Generate Build Badge uses: macoaure/badge-action@v1 with: label: "build" status: "passing" path: "badges/build.svg" color: "green" style: "flat-square" logo: "github" - name: Generate Coverage Badge uses: macoaure/badge-action@v1 with: label: "coverage" status: ${{ steps.coverage.outputs.coverage }} path: "badges/coverage.svg" color: "brightgreen" logo: "codecov" # Commit and push the badges - name: Commit changes run: | git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" git add badges/ git commit -m "🔄 Update repository badges" git push
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Credits
- Badge generation powered by Shields.io
- Icons provided by Simple Icons
🔍 Related
- Shields.io - The service powering our badge generation
- Simple Icons - The icons used in badges