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

update(ci): add update emoji schedule workflow #2436

Merged
merged 5 commits into from
May 25, 2024
Merged

Conversation

Koooooo-7
Copy link
Member

@Koooooo-7 Koooooo-7 commented May 22, 2024

Summary

Add update emoji schedule workflow to daily update emoji data.
Changes:

  • Support schedule at UTC 2:00 daily run, or manually trigger.
  • Remove the build:emoji out of build.
  • Remove the try catch from emoji.js to ensure the writeJS and wirteMarkdown in same transaction (both success or failed), so, we could just check the last write file (src/core/render/emoji-data.js) changes and add them all.
  • The commit branch uses the update-emoji-data-$current_date-${last commit hash 7} to be an unique branch commit, it makes it possible that we could manually trigger multi times in a day or it were be trigger both in schedule and manually does.

Others:

  • Hasn't added a build:emoji in release.sh since it is unlikely happen as per our discussion.

close #2434

  • PR
    Screenshot 2024-05-22 at 22 42 06

  • Branch details
    Screenshot 2024-05-22 at 22 42 47

Related issue, if any:

What kind of change does this PR introduce?

Build-related changes

For any code change,

  • Related documentation has been updated, if needed
  • Related tests have been added or updated, if needed

Does this PR introduce a breaking change?

No

Tested in the following browsers:

  • Chrome
  • Firefox
  • Safari
  • Edge

Copy link

vercel bot commented May 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docsify-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 24, 2024 5:15am

@Koooooo-7 Koooooo-7 marked this pull request as ready for review May 22, 2024 14:44
@Koooooo-7 Koooooo-7 requested a review from a team May 22, 2024 14:44
Copy link
Member

@jhildenbiddle jhildenbiddle left a comment

Choose a reason for hiding this comment

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

This looks great, @Koooooo-7. A few minor naming nitpicks, but otherwise this looks good.

Has this been tested? If not, it seems like we could by removing a data property entry from /src/core/render/emoji-data.js, committing the change, then waiting to see if this workflow generates the expected PR.

.github/workflows/rotate-emoji.yml Outdated Show resolved Hide resolved
.github/workflows/rotate-emoji.yml Outdated Show resolved Hide resolved
.github/workflows/rotate-emoji.yml Outdated Show resolved Hide resolved
.github/workflows/rotate-emoji.yml Outdated Show resolved Hide resolved
@Koooooo-7
Copy link
Member Author

This looks great, @Koooooo-7. A few minor naming nitpicks, but otherwise this looks good.

I will update it.

Has this been tested? If not, it seems like we could by removing a data property entry from /src/core/render/emoji-data.js, committing the change, then waiting to see if this workflow generates the expected PR.

I tested it from a fork. ( the screenshot is gotten from that).
And when we merge it into develop,we could manually trigger it for a test again.

And we don't need mock a emoji update since there already exists emoji update between our emojiData and github.

@Koooooo-7 Koooooo-7 requested review from jhildenbiddle, sy-records and a team May 23, 2024 01:20
@Koooooo-7 Koooooo-7 changed the title update(ci): add rotate emoji schedule workflow update(ci): add update emoji schedule workflow May 23, 2024
Comment on lines +38 to +50
branch_name="update-emoji-data-$current_date"
pr_title="update(emoji): Sync emoji data with GitHub emoji API [$current_date]"
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"

git checkout -b $branch_name
git add src/core/render/emoji-data.js
git add docs/emoji.md
git commit -m "update(emoji): Sync emoji data with GitHub emoji API [$current_date]"
unique_branch_name=$branch_name-$(git log -1 --pretty=%h)
git checkout -b $unique_branch_name
git push origin $unique_branch_name
gh pr create --title "$pr_title" --body "Found updated github emojis need to sync, PTAL @docsifyjs/reviewers :robot:." --base develop
Copy link
Member

@sy-records sy-records May 24, 2024

Choose a reason for hiding this comment

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

Copy link
Member Author

@Koooooo-7 Koooooo-7 May 24, 2024

Choose a reason for hiding this comment

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

Thx for it.
I know those actions but according to our plain needs,using them gonna makes the action more complicated to me.

  1. file change check steps and ::OUTPUT.
  2. commit action on pre if-condition.
  3. pr with change condition with if-condition also.

Personally, I think we could put them together without much actions dependencies for now.

How about we use this now and when we have more requirements on it,we do the refinement then?

Copy link
Member

@jhildenbiddle jhildenbiddle left a comment

Choose a reason for hiding this comment

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

Looks like @sy-records prefers we replace the git commands with actions, but otherwise this looks good to me.

@Koooooo-7
Copy link
Member Author

Koooooo-7 commented May 24, 2024

Looks like @sy-records prefers we replace the git commands with actions, but otherwise this looks good to me.

I will negotiate with him and do the updates if needs.

@Koooooo-7 Koooooo-7 requested review from sy-records and trusktr May 24, 2024 05:13
@jhildenbiddle
Copy link
Member

Sounds good, @Koooooo-7. Looks like this is ready to merge whenever you and @sy-records resolve the actions discussion. :)

Thanks for getting this up and running so quickly!

@Koooooo-7 Koooooo-7 merged commit 6552853 into develop May 25, 2024
9 checks passed
@Koooooo-7 Koooooo-7 deleted the rotate-emoji branch May 25, 2024 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Workflow: Setup a daily sync scheduler to sync emoji data instead of run in every build
3 participants