GitHub Actions 101

Sequel: GitHub Actions 101 Continued

Preface

As RetroArch F-Droid repo hasn’t been updated long enough , I decide to give GitHub Actions a try (which turns into a doomed failure).

Idea

The basic idea is simple:

  1. I setup a public repo where an Action would download & upload nightly Android release from buildbot .
  2. The same action create tags using ISO-formatted date and releases labeled as nightly.
  3. I setup another public repo which turns itself into a F-Droid compatible repo by:

Actions

Where to start

The official doc is super useful when writing the action.yml. And be sure to install a linter extension if you have a GUI in hand (or you’ll go ape when dealing w/ the endless syntax error/startup failure).

And I refer to a CSDN blog when trying out Actions.

Error, error, error everywhere

Scenario 1

As I wish to download all three variants of RetroArch, I wanna do it in a single run.

It’s simple: just use - run: | and add the commands you want to use .

Scenario 2

To commit the files, I followed this guide on CSDN .

To create tags & upload releases, I followed another guide on CSDN .

Oh, and I’m cursed by the Workers .gitignore template for adding *.apk, which prevents the action from committing the files with the exact file extension XD.

Scenario 3

I wish to use ISO date as tags. But git commit does not accept pipeline like date --iso-8601 | git commit.

Just use the -F <file>, --file=<file> options. Then you can redirect stdout to git commit.

date --iso-8601 | git commit -F -

Scenario 4

Workflows are expected to get triggered on daily after buildbot finishes their job. It uses a cron syntax.

Besides that, on: push is useful when debugging.

on:
  push

Failure

After tens of fixes, the Action tells me that GitHub only allows files up to 100 MB so RetroArch*.apk is outa reach, which is a signal for “NO”, unless you pay for $5/GB/m, for storage AND bandwidth, SEPERATELY.

Enable Git LFS would be enough, but I highly doubt the legitimacy to host a repo so I quit.

That’s why the project is doomed as was mentioned in the preface.

Anyway the journey is interesting, and I learned a lot.

Bonus

GitHub Action bot

If you are in want of a cool contributor, try the followings:

git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"

CI skip / Custom filter

Don’t run on commits with [ci skip]:

jobs:
  build:
    runs-on: ubuntu-latest
    if: "! contains(github.event.head_commit.message, '[ci skip]')"

Only run on commits with [build]:

jobs:
  build:
    runs-on: ubuntu-latest
    if: "contains(toJSON(github.event.head_commit.message), '[build]')"

Source: skip ci for GitHub Actions

Run only on certain file change

on:
  push:
    branches: ['main']
    paths: ['folder/*']

Vinfall's Geekademy

Sine īrā et studiō