mirror of
https://github.com/Paillat-dev/discord-emojis.git
synced 2026-01-02 00:56:19 +00:00
Add initial configuration files for GitHub Actions and copywrite checks
This commit is contained in:
16
.copywrite.hcl
Normal file
16
.copywrite.hcl
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
schema_version = 1
|
||||||
|
|
||||||
|
project {
|
||||||
|
license = "MIT"
|
||||||
|
copyright_year = 2025
|
||||||
|
copyright_holder = "Paillat-dev"
|
||||||
|
header_ignore = [
|
||||||
|
".venv/**",
|
||||||
|
"logs/**",
|
||||||
|
".idea/**",
|
||||||
|
".git/**",
|
||||||
|
".vscode/**",
|
||||||
|
"__pycache__/**",
|
||||||
|
"*.pyc",
|
||||||
|
]
|
||||||
|
}
|
||||||
13
.github/workflows/CI.yaml
vendored
Normal file
13
.github/workflows/CI.yaml
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "master"]
|
||||||
|
pull_request:
|
||||||
|
branches: ["master"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
quality:
|
||||||
|
uses: ./.github/workflows/quality.yaml
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
54
.github/workflows/quality.yaml
vendored
Normal file
54
.github/workflows/quality.yaml
vendored
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
name: Quality Checks
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-license-header:
|
||||||
|
name: License Header Check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Copywrite
|
||||||
|
uses: hashicorp/setup-copywrite@5e3e8a26d7b9f8a508848ad0a069dfd2f7aa5339
|
||||||
|
- name: Check Header Compliance
|
||||||
|
run: copywrite headers --plan --config .copywrite.hcl
|
||||||
|
|
||||||
|
quality:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
check: [format, lint, basedpyright]
|
||||||
|
include:
|
||||||
|
- check: format
|
||||||
|
name: "Format Check"
|
||||||
|
command: "uv run ruff format --check ."
|
||||||
|
- check: lint
|
||||||
|
name: "Lint Check"
|
||||||
|
command: "uv run ruff check ."
|
||||||
|
- check: basedpyright
|
||||||
|
name: "Type Check"
|
||||||
|
command: "uv run basedpyright ."
|
||||||
|
|
||||||
|
name: ${{ matrix.name }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: "Install uv"
|
||||||
|
uses: astral-sh/setup-uv@v5
|
||||||
|
with:
|
||||||
|
enable-cache: true
|
||||||
|
|
||||||
|
- name: "Set up Python"
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version-file: "pyproject.toml"
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: uv sync
|
||||||
|
|
||||||
|
- name: ${{ matrix.name }}
|
||||||
|
run: ${{ matrix.command }}
|
||||||
65
README.md
Normal file
65
README.md
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# Discord Emojis
|
||||||
|
|
||||||
|
A Python tool that automatically fetches and extracts the latest emoji data from Discord.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
This project automatically downloads the latest Discord build from the [Discord-Datamining](https://github.com/Discord-Datamining/Discord-Datamining) repository, extracts emoji data, and saves it in a structured JSON format. It runs as a GitHub Actions workflow twice a week to keep the emoji data up-to-date without manual intervention.
|
||||||
|
|
||||||
|
## How It Works
|
||||||
|
|
||||||
|
- GitHub Actions workflow runs automatically twice per week
|
||||||
|
- Downloads the latest Discord build
|
||||||
|
- Extracts emoji information
|
||||||
|
- Saves data in a standardized JSON format
|
||||||
|
- Tracks changes using hash comparison to avoid unnecessary updates
|
||||||
|
- Detects and reports UTF-16 surrogate pairs
|
||||||
|
|
||||||
|
## Technical Details
|
||||||
|
|
||||||
|
The project uses:
|
||||||
|
- Python 3.13+
|
||||||
|
- Dependencies:
|
||||||
|
- json5
|
||||||
|
- orjson
|
||||||
|
- requests
|
||||||
|
|
||||||
|
## Output
|
||||||
|
|
||||||
|
The emoji data is saved in `build/emojis.json` in the following format:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"emojis": [
|
||||||
|
{
|
||||||
|
"name": "emoji_name",
|
||||||
|
"id": "emoji_id",
|
||||||
|
...
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The main emojis.json file in the root directory is the updated version that consumers can access via GitHub raw URLs or by cloning this repository.
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
For local development or testing:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install dependencies using uv
|
||||||
|
uv sync --dev
|
||||||
|
|
||||||
|
# Run the update script manually
|
||||||
|
uv run src
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: Local execution should only be done during development. In production, the script runs automatically through GitHub Actions.
|
||||||
|
|
||||||
|
The script will:
|
||||||
|
1. Download the latest Discord build
|
||||||
|
2. Extract emoji information
|
||||||
|
3. Save the data to `build/emojis.json`
|
||||||
|
4. Generate a hash file to track changes
|
||||||
|
|
||||||
|
If no changes are detected compared to the previous run, the script will exit with status code 3.
|
||||||
Reference in New Issue
Block a user