green-action

Check how your web project is affecting the planet

MIT License

Stars
1
Committers
7

Green Action

Check how your project is affecting the planet and check the carbon stats

Read about it in my Dev.to post

Demo

Setup

  1. Open your README and add paste the following tag in there (this will be,
    where the image will be placed): <!-- CARBON-STATS -->
  2. Add the following workflow to your .github/workflows folder:
name: Website green-o-meter

on:
  push:
    branches: main

jobs:
  update-gist:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@master
        with:
          persist-credentials: false
          fetch-depth: 0
      - name: green-website
        uses: filiptronicek/green-action@main
        env:
          URL: https://dev.to #Your measured URL
      - name: Commit files
        run: |
          git config --local user.email "[email protected]"
          git config --local user.name "GitHub Action"
          git commit -m "Update carbon image" -a
      - name: Push changes
        uses: ad-m/github-push-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          branch: main #Change this to master, or any other branch to which the changes should be pushed

Development

  1. clone the repo (git clone https://github.com/filiptronicek/green-action)
  2. change the URL in the env file (first create it): cp .env.example .env
Package Rankings
Top 20.29% on Github actions