Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflows: Add github action checking emoji data matching with server. #918

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Ezio-Sarthak
Copy link
Member

@Ezio-Sarthak Ezio-Sarthak commented Feb 12, 2021

The workflow uses CRON time syntax to schedule the check daily at a specific time.
In case of a mismatch in fetched data and existing data, the check would fail with exit status: Emoji data not up-to-date.

[unrelated]: Corrects a couple of diffs :)

Fixes #912

@zulipbot zulipbot added the size: M [Automatic label added by zulipbot] label Feb 12, 2021
@Ezio-Sarthak Ezio-Sarthak force-pushed the emoji-check-server-workflow branch from 5751356 to 3ffd9f1 Compare February 12, 2021 16:14
@Ezio-Sarthak Ezio-Sarthak changed the title workflows: Add gihub action to regularly check emoji data up-to-date. workflows: Add github action checking emoji data matching with server. Feb 12, 2021
@Ezio-Sarthak Ezio-Sarthak force-pushed the emoji-check-server-workflow branch 2 times, most recently from b481654 to c08ca8a Compare February 12, 2021 16:45
@Abhirup-99
Copy link
Contributor

Wouldn't it be better if it's checked in every push and PR? If something breaks in a certain pr, it would be very difficult to identify it. Also, the main branch is supposed to be stable and we are all using it during development, so this goes against that.

@prah23
Copy link
Member

prah23 commented Feb 12, 2021

I second @Ezio-Sarthak's approach here. A CRON job might be better suited as these change infrequently as mentioned in the issue. We wouldn't have to run this as frequently as on every push and PR, also considering the frequency of that is highly variable. I presume the check is meant to be more general. Since the emoji list is auto-generated and not meant to be modified manually, the chance of something breaking in a PR should be significantly low.

@Ezio-Sarthak
Copy link
Member Author

Ezio-Sarthak commented Feb 13, 2021

@Abhirup-99 I initially had a thought of doing so, but as mentioned by Neil in the issue, this (that is, change in emoji data) should be infrequent, and so a regular check could be enough. Also, since we have some workflows triggering already (specially codeql), having one more with every push would be a bloat to the repo.

@prah23 Thanks for the clarification 👍

PS - The PR is open for reviews :)

Copy link
Collaborator

@neiljp neiljp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ezio-Sarthak Thanks for looking into this 👍

The guts of this check seem good, but I do think we need to think about how the triggering and notification is going to occur.

I'm not sure how feasible it is, but sending the results to a Zulip topic may be the tidiest result here. If I understand the parallels, this is being worked on for zulip/zulip; I just posted in #automated testing>Unicode emoji sync to query this.

Given how minimal this is, we could limit this to trigger only on pushes to main on zulip/zulip-terminal. I'm not sure if we want this to fail CI due to this, but I'm not sure what other notification options we have that are straightforward.

If this runs on a timed schedule, I'm not sure where the result appears?

Comment on lines 34 to 35
export DIFF_LEN=${#DIFF}
if [[ ${DIFF_LEN} == 0 ]] ; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps use --exit-code with git diff, and $? ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I didn't know it before 😅

@Ezio-Sarthak Ezio-Sarthak force-pushed the emoji-check-server-workflow branch from c08ca8a to 9fc7034 Compare February 13, 2021 07:41
@Ezio-Sarthak
Copy link
Member Author

@neiljp Thanks for the review!

The notification of check on czo topic is a pretty awesome idea!
I'll see if I could make a script to send a message to czo #zulip-terminal > Unicode emoji sync with server if that's possible :)
Also, do we have to notify in czo only if there's a change in data?

@Ezio-Sarthak Ezio-Sarthak force-pushed the emoji-check-server-workflow branch 3 times, most recently from 2e613cd to 7729ce8 Compare February 19, 2021 17:52
@Ezio-Sarthak Ezio-Sarthak force-pushed the emoji-check-server-workflow branch from 7729ce8 to 0794127 Compare February 21, 2021 07:02
@zulipbot zulipbot added size: L [Automatic label added by zulipbot] and removed size: M [Automatic label added by zulipbot] labels Feb 21, 2021
@Ezio-Sarthak Ezio-Sarthak force-pushed the emoji-check-server-workflow branch from 0794127 to bafbf72 Compare February 21, 2021 07:04
@zulipbot zulipbot added size: M [Automatic label added by zulipbot] PR needs review PR requires feedback to proceed and removed size: L [Automatic label added by zulipbot] labels Feb 21, 2021
@Ezio-Sarthak Ezio-Sarthak force-pushed the emoji-check-server-workflow branch 2 times, most recently from c635220 to b18488e Compare March 9, 2021 14:16
echo "Emojis up-to-date"
else
curl -X POST https://chat.zulip.org/api/v1/messages \
-u ${{ secrets.ZT_BOT_EMAIL }}:${{ secrets.ZT_BOT_API_KEY }} \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a skim of the secrets documents, we would likely want this to be in an environment variable rather than exposed in clear text.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of my knowledge, secrets are default environment variable itself in GitHub actions.
However, It's good storing them as env variables in any case 👍. This will tidy-up the relevant code wherever they are used. (currently double brackets seem visually messy).

Comment on lines 42 to 44
--data-urlencode 'subject=Emoji sync with server' \
--data-urlencode 'content=Heads up :caution:!
Emoji data needs to be updated.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can easily change these later, but:

  • I expect it'd be better to have a more general single topic for CI feedback, since we have everything in one stream.
  • Re the content, we may wish to specify more that this originates from a server emoji update.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Re topic, maybe something like: "CI action feedback"?
  • Re the content, the below message could be a potential description?:
    "Heads up! Emoji sync with the server failed!
    This originated from an update in server emoji. Kindly re-generate unicode_emojis.py"

@Ezio-Sarthak Ezio-Sarthak force-pushed the emoji-check-server-workflow branch from b18488e to bd857bd Compare March 27, 2021 09:40
@zulipbot zulipbot added size: L [Automatic label added by zulipbot] and removed size: M [Automatic label added by zulipbot] labels Mar 27, 2021
@Ezio-Sarthak Ezio-Sarthak force-pushed the emoji-check-server-workflow branch 2 times, most recently from 2d4fae1 to 45607be Compare March 27, 2021 10:22
@Ezio-Sarthak Ezio-Sarthak force-pushed the emoji-check-server-workflow branch 6 times, most recently from 1b4714e to ffab889 Compare April 3, 2021 08:45
@Ezio-Sarthak Ezio-Sarthak force-pushed the emoji-check-server-workflow branch from ffab889 to ce0807b Compare April 8, 2021 10:27
@Ezio-Sarthak Ezio-Sarthak force-pushed the emoji-check-server-workflow branch from ce0807b to 7d5ae35 Compare April 17, 2021 03:35
The workflow uses CRON time syntax to schedule a check daily at a
specific time. In case of a mismatch in fetched data and existing
data, a message would be sent to CZO on the thread:

 '#zulip-terminal > CI action feedback'

Currently the workflow would be triggered everyday at 17:00 UTC
times.

Fixes zulip#912.
@zulipbot
Copy link
Member

zulipbot commented Mar 4, 2022

Heads up @Ezio-Sarthak, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/main branch and resolve your pull request's merge conflicts accordingly.

@neiljp neiljp added the area: infrastructure Project infrastructure label Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: infrastructure Project infrastructure has conflicts PR needs review PR requires feedback to proceed size: L [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add GitHub Action to regularly check unicode emoji are up to date with those in server
5 participants