Skip to content

Repository files navigation

Sync Release Artifacts Action

A GitHub Action that keeps a target branch (default: main) in sync with release artifacts published on the release branch (default: release) after semantic-release. It either merges the changes or opens a pull request, depending on the input.

What it does

  • Fetches main and release branches
  • Optionally opens a PR from release into main when pr-needed: 'true'
  • Otherwise merges release into main and pushes the result
  • Skips PR creation if no changes exist

Usage

Example workflow:

name: Update main branchon:
push:
branches: [ release ]paths-ignore:
- 'CHANGELOG.md'permissions:
contents: writepull-requests: writejobs:
sync:
runs-on: ubuntu-lateststeps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0with:
fetch-depth: 0
- uses: knowledgepixels/sync-release-artifacts-action@3926beed487a1c183af52423344bf6ee36fd7b27 # v1.0.0with:
main-branch: mainrelease-branch: releasepr-needed: falsegit-user-name: github-actions[bot]git-user-email: github-actions[bot]@users.noreply.github.com

Inputs

NameDescriptionRequiredDefault
main-branchBranch to update (target).Nomain
release-branchBranch to merge from (source).Norelease
pr-neededIf true, open a PR instead of pushing directly. Skips PR if no diff.Nofalse
git-user-nameUser name for commits/merges.Nogithub-actions[bot]
git-user-emailEmail for commits/merges.Nogithub-actions[bot]@users.noreply.github.com

Permissions & requirements

  • Ensure the workflow grants:
    • contents: write (required to push)
    • pull-requests: write (required when pr-needed: 'true')
  • Use actions/checkout with fetch-depth: 0 (action expects a working repository).
  • If main is protected, provide a token or allow the Actions bot to push, or use the PR flow.

Testing

  • Use a test workflow that prepares a release branch and runs the action with pr-needed set to true and false.
  • A matrix job can run both flows in one dispatch: prepare release with a tiny change for the true run, keep it identical for the false run.

Notes

  • The action does not resolve real merge conflicts.
  • When pr-needed: 'true' and there are no changes, PR creation is skipped with a clear log message.
  • Consider branch protection and required checks when using the PR flow.

License

MIT

About

GitHub Action to sync Semantic Release Artifacts to Main/Master after a release is triggered

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages