Fix emoji chat to send messages to all clients #1730
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Emoji | |
on: [ push, pull_request ] | |
env: | |
PIP_DISABLE_PIP_VERSION_CHECK: yes | |
jobs: | |
check-emoji: | |
name: Check for emoji in commit message | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Fetch PR commit | |
if: github.event_name == 'pull_request' | |
run: git fetch origin ${{ github.event.pull_request.head.sha }} | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install required library | |
run: pip install "emoji==2.*" | |
- name: Run the check | |
shell: python | |
run: | | |
import emoji, os | |
if "${{ github.event_name }}".startswith("pull_request"): | |
commit = "${{ github.event.pull_request.head.sha }}" | |
else: | |
commit = "${{ github.sha }}" | |
commit_message = os.popen(f"git show -s --format=%B {commit}").read() | |
if not emoji.emoji_count(commit_message): | |
exit("No Emoji found. 👎") |