Skip to content

GitHub Actions

Shu-Wei Hsu edited this page Jan 3, 2025 · 2 revisions

RecNet Release Action

We have developed a typescript-based github action under /libs/recnet-release-action and use this github action(see /.github/workflows/release-action.yml) to automate our workflow: We use dev branch as our development branch, all bug fixes and new features from us should be merged to dev. When we are ready for a new production release, we will merge the development branch to master.

Inputs

This action takes 4 inputs:

  • github_token: You don't have to manually copy/paste anything. Just use ${{ secrets.GITHUB_TOKEN }} variable in github action.
  • head_branch: The git ref to your development branch (The branch you wanna create PR). In our case, dev.
  • base_branch: The git ref to your master or production branch (The target branch you want your PR to merge into). In our case, master.
  • repo: Repo and owner. You don't have to manually copy/paste anything. Just use ${{ github.repository }} variable in github action.

How it works

The action will create a "Release" PR from head_branch to base_branch if there's any difference between them. A "Release" PR means a pull request from head_branch to base_branch which is created by our github action bot. The "Release" PR will aggregate and collect all github issues and pull requests link to the commits between the two git refs and mention the issues and PRs in the pull request content of the "Release" PR. If there's already one "Release" PR opened and unmerged, the action will, instead of create a new one, update the opened "Release" PR and update the content.

We run this github action whenever the head_branch receives any new commit (see /.github/workflows/release-action.yml). So that we don't have to keep manually opening/editing PR from dev branch to production branch each time.

Misc

  • The GitHub action is written by TypeScript using this template: https://github.com/actions/typescript-action
  • We compiled the GitHub Action before it runs instead of compiling to js locally and pushing to repo (since this method will generate a huge js file). See libs/recnet-release-action/action.yml.
  • The compiling step is cached by the hash of the Github action's source code. Thus, if the GitHub Action itself is unchanged, the compiling step will be skipped.
  • The action will also tag the committers as reviewer of the "Release" PR.
  • The github action is powered by GitHub API (package, api docs).
Clone this wiki locally