A GitHub action for removing emoji from PR content with regex replace.
Create a workflow (eg: .github/workflows/emoji_strip.yml
see Creating a Workflow file)
This will strip emoji from new PR titles and any text after the Changelog heading only, for any branch, when created or edited.
name: "PR Emoji Stripper"
on:
pull_request_target:
types: [opened, edited]
jobs:
title_and_body:
runs-on: ubuntu-20.04
steps:
- uses: Wayland-Smithy/emoji-stripper-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
title: true
body: true
body-after: "## Changelog"
Note: This grants access to the GITHUB_TOKEN
so the action can make calls to GitHub's rest API to fetch and edit PR data.
If neither body-after
or body-before
are provided with body
then the entire text will be parsed.
If both body-after
and body-before
are provided they must result in an overlap to be valid i.e. for "a-b-c-d" body-after: "a"
and body-before: "c"
is valid and only "-b-" will be parsed.
If body-after
or body-before
are provided but not found, invalid, or appear in the wrong order no emoji will be removed from the body and the run will succeed with a no match info log.