https://github.com/green-code-initiative/green-codeql-queries
CodeQL Analysis for sustainability
https://github.com/green-code-initiative/green-codeql-queries
carbon codeql energy green-software sustainability
Last synced: 24 days ago
JSON representation
CodeQL Analysis for sustainability
- Host: GitHub
- URL: https://github.com/green-code-initiative/green-codeql-queries
- Owner: green-code-initiative
- License: gpl-3.0
- Created: 2026-02-07T10:02:54.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-03-31T17:03:49.000Z (27 days ago)
- Last Synced: 2026-03-31T19:09:25.341Z (27 days ago)
- Topics: carbon, codeql, energy, green-software, sustainability
- Language: CodeQL
- Homepage:
- Size: 122 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# 🍃 Green CodeQL
A first-of-its-kind repository of custom queries to scan your codebase and detect environmental sustainability problems, notably energy-related issues.
## 🚀 How to use green queries on your GitHub
To run these custom green queries directly on your repository, copy this code into a GitHub Action (Java code analysis in the example below):
```yaml
name: "Green CodeQL Analysis"
env:
TARGET_LANGUAGE: "java"
on:
workflow_dispatch:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ env.TARGET_LANGUAGE }}
build-mode: none
packs: green-code-initiative/${{ env.TARGET_LANGUAGE }}-queries
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "Sustainability"
```
> [!NOTE]
> For lack of a better option, sustainability alerts are reported just as vulnerabilities in 🛡️ Security → Code scanning
## 📦 Status of green queries packs
[6 Green CodeQL packs](https://github.com/orgs/green-code-initiative/packages?repo_name=green-codeql-queries) are currently available:
- Java/Kotlin :
[](https://github.com/green-code-initiative/green-codeql-queries/actions/workflows/PublishJavaPack.yml)
- Python:
[](https://github.com/green-code-initiative/green-codeql-queries/actions/workflows/PublishPythonPack.yml)
- C/C++ :
[](https://github.com/green-code-initiative/green-codeql-queries/actions/workflows/PublishCppPack.yml)
- Javascript/TypeScript :
[](https://github.com/green-code-initiative/green-codeql-queries/actions/workflows/PublishJavascriptPack.yml)
- Actions/YAML :
[](https://github.com/green-code-initiative/green-codeql-queries/actions/workflows/PublishActionsPack.yml)
- C# :
[](https://github.com/green-code-initiative/green-codeql-queries/actions/workflows/PublishCSharpPack.yml)