Skip to content

Automatically collect freebies with Github Actions

Trung Le edited this page Dec 8, 2021 · 4 revisions

Intro

Using a cronjob on cloud pipeline (Github Actions, Gitlab CI, Azure pipeline...) can help you to collect the freebies once a week on Thursday.

Setup and forget.

You can also trigger the job manually.

Disclaimer

Use this at your own risk, as this might be considered abuse and your account might be suspended by Github.

But to be fair, it only runs for ~30 seconds a week (for 1 EpicGames account), less than 3 minutes a month so it's pretty safe.

How to

Create a repository

If you use a private repo, it will be billed to your account. However, your account should be eligible for free tier of Github Actions (~2000 free minutes) and you will only use ~3-4 minutes a month.

If you use a public repo, your EpicGames email(s) will be exposed to public.

Create a workflow

Create a yaml file claim.yml in auto-jobs/.github/workflows/claim.yml:

name: EFC
on:
  workflow_dispatch:
  schedule:
    - cron: "0 18 * * 4"

jobs:
  EFC:
    name: Claim Freebie
    runs-on: ubuntu-latest
    steps:
      - name: Setup data folder
        env:
          EG_AUTH_JSON: ${{ secrets.EG_AUTH_JSON }}
        run: |
          mkdir "$GITHUB_WORKSPACE/data"
          echo "$EG_AUTH_JSON" > $GITHUB_WORKSPACE/data/device_auths.json
          wget https://raw.githubusercontent.com/Revadike/epicgames-freebies-claimer/master/data/config.example.json \
            -O "$GITHUB_WORKSPACE/data/config.example.json"

      - name: Setup config file
        env:
          EG_CONFIG_JSON: ${{ secrets.EG_CONFIG_JSON }}
        if: ${{ env.EG_CONFIG_JSON != null }}
        run: echo "$EG_CONFIG_JSON" > $GITHUB_WORKSPACE/data/config.json

      - name: Claim
        env:
          EG_AUTH_JSON: ${{ secrets.EG_AUTH_JSON }}
        run: |
          docker run --rm --pull always \
            --volume "$GITHUB_WORKSPACE/data:/app/data" \
            ghcr.io/jackblk/epicgames-freebies-claimer:latest

Add workspace authentication JSON

Get your authentication JSON from device_auths.json. Guide

Add a secret to your repository with this name: EG_AUTH_JSON

For the Value, paste everything from device_auths.json file.

Notification with Apprise

To use this feature, you need to configure config.json file. Check out Notification with Apprise Guide.

Add a secret to your repository with this name: EG_CONFIG_JSON

For the Value, paste everything from config.json file.

Clone this wiki locally