Customizing the GitHub push action

When you select to Push to GitHub, Plasmic sets up the repo with a GitHub Actions workflow.

If you are using PlasmicLoader, then no commits are being made, and the workflow simply triggers a build - possibly.

If you are using codegen, then the generated code is synced into your repo and a commit and/or PR is made.

In either case, before doing anything, the workflow file is first updated to the latest version, if necessary. Note that the workflow rarely changes.

Now, you may want to customize the way this works. Examples of reasons:

  • You want to customize the commit messages.
  • You want to change the branch to something other than what you initially set when setting up the integration.
  • You want to run other build/deploy commands.

If you want to customize any aspect of this, you should detach the workflow. This means you now take ownership of the workflow instead of relying on the “Push to GitHub” mechanism.

Instead, you’ll be triggering the workflow via webhook—it will look no different than any other build+deploy webhook that you would otherwise configure, for hosts such as Vercel, Netlify, etc.

In short, GitHub Actions can be triggered by a webhook. This is called ”repository dispatch.” (There is also ”workflow dispatch” as an alternative.) The Plasmic workflow is already listening to repository_dispatch:

plasmic.yml
Copy
on:
repository_dispatch:
types: [plasmic]

Steps to trigger repository dispatches

To do this, first create a personal access token.

Test that you can manually trigger the workflow using a repository dispatch call, replacing the variables below and passing your personal access token:

Copy
curl \
-i -u USER:TOKEN \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/OWNER/REPO/dispatches \
-d '{"event_type":"on-demand-test","client_payload":{"unit":false,"integration":true}}'

Verify that an action run is happening.

Open up the Publish modal in a Plasmic project, and input the webhook above.

Remove the Push To GitHub action in the Plasmic publish dialog.

Finally, hit Publish to make sure it all works.

Was this page helpful?

Give feedback on this page