The first version of this Cloud Genshin check-in script ran on GitHub Actions, and it eventually got banned there. That outcome is easy to understand: running an Action just to make a few API requests is heavy. Starting a workflow consumes enough resources to resemble launching a Docker container, while the actual task is a simple HTTP request.

Dedicated automatic check-in services such as QianDao can host many scripts and are simple to operate, but they still need a server, and servers expire. For a job this small, that is more machinery than necessary. Cloudflare Workers is a better fit.

Cron triggers on Workers

Worker code can make network requests with fetch; there is no need for the XHR style. It feels Node-based, and the documentation is straightforward. The Cron Trigger documentation explains how to schedule the Worker. An earlier Python version of this script already existed, so rather than work out which of the three requests actually mattered, the simplest approach was to send all of them.

The Worker code:

addEventListener('scheduled', event => {
  event.waitUntil(
    handleSchedule(event.scheduledTime)
  )
})

async function handleSchedule(scheduledDate) {
  const init = {
    headers: {
      'x-rpc-combo_token': '填入Token',
      'x-rpc-client_type': '2',
      'x-rpc-app_version': '3.4.0',
      'x-rpc-sys_version': '11',
      'x-rpc-channel': 'mihoyo',
      'x-rpc-device_id': '填入设备ID',
      'x-rpc-device_name': '填入手机名称',
      'x-rpc-device_model': '填入手机型号',
      'x-rpc-app_id': '1953439974',
      'Referer': 'https://app.mihoyo.com',
      'Host': 'api-cloudgame.mihoyo.com',
      'Connection': 'Keep-Alive',
      'Accept-Encoding': 'gzip',
      'User-Agent': 'okhttp/4.9.0'
    },
  };
  console.log(scheduledDate);
  console.log(await fetch("https://api-cloudgame.mihoyo.com/hk4e_cg_cn/wallet/wallet/get", init));
  console.log(await fetch("https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/getAnnouncementInfo", init));
  console.log(await fetch("https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/listNotifications?status=NotificationStatusUnread&type=NotificationTypePopup&is_sort=true", init));
}

Replace the placeholder token, device ID, device name, and device model with your own values. To get them, use a packet capture tool such as HttpCanary. Start the Cloud Genshin app before capturing traffic; otherwise the app may check the SSL certificate, decide it is invalid, and log you out. Once traffic is captured, open any request and the header values above should be visible.

Configuring the Worker is minimal. Paste the code into a Worker, then open Triggers and set a Cron Trigger. Once a day is usually enough. The dashboard can generate the Cron expression for you, or you can use 0 0 * * *. After that, there is nothing else to do.

Why this belongs on Workers

A simple check-in is a good reason to use Workers rather than GitHub Actions. Cloudflare is not going to ban an account over this kind of automation. Actions are better reserved for work that actually needs compute, such as compiling code or generating static HTML, daily reports, and similar output. Using them for check-ins wastes resources and can lead to a ban.

Cloud functions are another option, but they are still essentially Docker underneath: a full runtime environment. Workers run in a lighter sandbox, which may even be a little more environmentally friendly.