Actions triggered by commits, which create another commit

Curious if this is a common workflow. I’ll describe my current stack and reason for wanting this, since it seems like the type of thing I shouldn’t be the first to run into.

I was building a web app + desktop app with ReactJS / ElectronJS, and there was nice separation between source code and build artifacts. I edit source code, then commit, build/ directory is gitignored, and we have a workflow on GitHub Actions which automatically runs some build steps and creates a Release.

However, the new thing is we added Capacitor, for creating mobile apps, and the way Capacitor works is it takes what’s in build/ and generates/modifies your ios/ and android/ folders, which contain fully ready-to-be-run mobile apps. The problem is that from that viewpoint, ios/ and android/ are build artifacts, but since developers are also allowed to (and expected to) modify code in ios/ and android/ manually, those directories are expected to be checked into version control. So now a developer must remember to npm run build and copy it into ios/ and android/ (using npx cap sync) before any commit, or the raw source code and the built code will be “out of sync”.

So I’m wondering if there could be a GitHub Action which handles doing this build + sync, where if it finds that the build + sync changes any files in ios/ and android/ (meaning developers didn’t build + sync before committing) then this Action would create an additional commit with the result of build + sync.

  1. Does that seem like the supported method of dealing with a tool like Capacitor that operates that way?
  2. Can this be done with GitHub Actions in a reasonable manner?

It is possible to do, but if you want the push from an actions workflow to trigger another workflow, you need to use a PAT instead of GITHUB_TOKEN for authentication.

I’m not sure if committing those build results is the best option though (but I’m also not familiar with Capacitor). Maybe instead of committing build results you could upload archives containing them as artifacts (for test builds) or release files?