Skip to content

Update emojis

Update emojis #13

Workflow file for this run

name: Update emojis
on:
workflow_dispatch:
inputs:
dry-run:
description: Run the workflow without creating a pull request
required: false
default: "false"
schedule:
# https://crontab.guru/#0_0_*/7_*_*
- cron: "0 0 */7 * *"
jobs:
update:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
pull-requests: write
if: github.repository_owner == 'luxass'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: setup pnpm
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
- name: setup node
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version: lts/*
- name: install dependencies
run: pnpm install
- name: save old emoji-urls file
run: cp emoji-urls.json /tmp/old-emoji-urls.json
- name: run update:emojis script
run: pnpm run update:emojis
- name: process emoji changes
id: emoji_changes
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const { readFileSync } = require('fs');
const oldEmojiUrls = JSON.parse(readFileSync('/tmp/old-emoji-urls.json', 'utf8'));
const newEmojiUrls = JSON.parse(readFileSync('emoji-urls.json', 'utf8'));
const changes = Object.keys(newEmojiUrls).reduce((acc, key) => {
if (oldEmojiUrls[key] !== newEmojiUrls[key]) {
acc[key] = newEmojiUrls[key]
}
return acc;
}, {});
let changesTable = '';
for (let i = 0; i < Object.keys(changes).length; i += 3) {
const key1 = Object.keys(changes)[i];
const key2 = Object.keys(changes)[i + 1];
const key3 = Object.keys(changes)[i + 2];
changesTable += `| :${key1}: | ${key2 != null ? ':' + key2 + ':' : ''} | ${key3 != null ? ':' + key3 + ':' : ''} |\n`;
}
if (Object.keys(changes).length === 0) {
core.setOutput('changes', 'false');
} else {
core.setOutput('changes', 'true');
core.setOutput('changes-table', changesTable)
}
- name: create pull request
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6
if: ${{ github.event.inputs.dry-run != 'true' && steps.emoji_changes.outputs.changes == 'true' }}
with:
commit-message: "chore: updated emojis"
title: "chore: updated github emojis"
body: |
I found some new changes in GitHub's list of emojis.
<details>
<summary>Here you can see a list of the new emojis</summary>
| Emoji | Emoji | Emoji |
| ----- | ----- | ----- |
${{ steps.emoji_changes.outputs.changes-table }}
</details>
I don't know which emoji they changed or added, but I'm sure it's cool.
If you want you can go take a look yourself.
I will be waiting for your approval 👋.
This is an automated PR to update the GitHub Emoji List.
If you have any questions or suggestions, please open an issue.
branch: update-emojis
base: main
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
reviewers: luxass
- name: upload new emojis as artifact
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
if: steps.emoji_changes.outputs.changes == 'true'
with:
name: new-github-emojis
path: emoji-urls.json