How to check App Store Review Guidelines updates through GitHub Actions

App Store Review Guidelines are living documents. I reckon we, iOS Engineers, are better off checking the updates regularly. If it is a major one, Apple will announce it, whereas if it is a subtle revision, they will not say anything, and then, we will miss it. In the worst case, our updated apps might be rejected by Apple because of not knowing the difference from the last time we read. To avoid such a disaster, I suggest a simple solution to catch up on the latest guidelines by GitHub Actions.
What motivated me?
Last summer, Sign in with Apple was one of the most controversial topics for iOS developers since it was announced in WWDC 19, and I used to follow some news which were relevant to the latest technology for a while, then one day, I stumbled upon an article and was like,
“Apple Inc will ask developers to position a new “Sign on with Apple” button in iPhone and iPad apps above rival buttons from Alphabet Inc’s Google and Facebook Inc, according to design guidelines released this week.”
(Cited from Reuters)
I got stumped because when I checked the part of the guidelines, I had not found anything like “above rival buttons”, but someone told me that it seemed like kind of the words were erased soon after the latest guidelines were published during the WWDC.
I always read the news and updates from Apple through RSS feeds in order not to miss the latest information every time there is an update on App Store Review Guidelines; however, it did not notify me as it was probably a very subtle change. As an alternative way, I checked appstorereviewguidelineshistory.com, but unfortunately, it seemed like the website was not active at that time. Out of curiosity, I really wanted to know the subtle difference, so I decided to develop a tool that can check the update by scraping the website daily automagically.
GitHub Actions
First, I intended to use Cloud Functions and Cloud Pub/Sub just because I have developed a push notification service by using them before. However, it was not enough to store the latest and last data in Cloud Firestore, and it was necessary to develop something else to show the difference between them with visual aids.
Therefore I was about to forgo embodying my idea, but a Changhui Xu’s article regarding GitHub Actions on Medium gave me an epiphany. I realized I can stack the difference as the commit log and node.js, which is a bit familiar with me, can be also available like Cloud Functions.
Workflow
All I had to do was crystal-clear. I just scraped the website, saved the contents as an HTML file and push it to the GitHub repository daily.
on
It schedules the workflow to run twice a day by cron. As the guidelines will not be updated so much, I suppose it will be enough frequency. Only once a day could be even better.
jobs
First, it runs the node.js script. This time, I mainly used Nightmare and cheerio for the web-scraping. (Why Nightmare? I will talk about it later.)
After that, it checks in the git repository to add and push the created HTML file which includes the web contents inside. If it detects the difference from the previously pushed file, it creates a commit log and notifies the update through a channel on my own Slack workspace.

Done!
Actually, this action could detect the updates! You could see the result in the commit logs.

Room of Improvement
I reckon that it is good enough to check the updates; however, there are some rooms for improvement regarding the action itself.
Nightmare vs axios
This time, I used Nightmare for the web-scraping just because I have never done it and wanted to try to use it. However, during the development, I realized that it worked on macOS only in the action. In addition, macOS runners that GitHub hosts consumed minutes at 10 times the rate that jobs on Linux runners consumed. Although I did not mind so much as the action that I had developed this time did not run frequently, and I did not own another action, you are better off avoiding to use Nightmare unless your scripts have to scrape some dynamic websites. axios is probably more preferable.
Multiple Slack Channel Notifications
I suppose that many engineers nowadays take part in multiple slack workspaces as well as me; therefore, I wanted to send multiple notifications to some workspaces where I belonged to. However, as I am not familiar with shell scripts so much, I passed on the feature this time. I will try it again eventually.
Enjoy your automation!