actions-template-sync icon indicating copy to clipboard operation
actions-template-sync copied to clipboard

[Feat]: Ability to sync towards most recent semver release

Open JakobHavtorn opened this issue 1 year ago • 4 comments

Describe the feature

Always syncing to the most recent commit to main is useful, but in some release schedules, several PRs might be accumulated in main before a new release is made. Being able to sync towards the most recent release (as measured by semantic versioning) would be a good way to make the synchronisation even more structured. It would also be very useful to have an Action variable that contains the release notes for the release tag we are syncing against, so these notes can be included in the PR description.

Use Case

This would enable

  • Creating a sync PR only when the template repository gets a release. This ensures more "well-packaged" sync PRs.
  • Referring directly and transparently to which changes are included in an upstream merge via the release notes.

Proposed Solution

I imagine the implementation would consist of steps similar to:

  1. Check if this "release-based" sync is enabled.
  2. If not, do as before. If it is, proceed to 3.
  3. Retrieve all tags.
  4. Keep only tags that are semantic versions (e.g. *.*.*).
  5. Sort semvers alphanumerically in descending order.
  6. Select the first entry (most recent release).
  7. Run upstream merge towards this tag instead of main, as before.

Acknowledgements

  • [ ] I may be able to implement this feature request

JakobHavtorn avatar Jul 15 '24 08:07 JakobHavtorn

Hi @JakobHavtorn , I understand your idea and the use case. Most likely will help. Maybe as a first step an option to sync the tags makes sense. Currently (due to some time constraints) I cannot give an ETA when I am able to start this feature. Maybe someone is able to jump in? :)

AndreasAugustin avatar Jul 18 '24 20:07 AndreasAugustin

@all-contributors please add @JakobHavtorn for idea

AndreasAugustin avatar Jul 18 '24 20:07 AndreasAugustin

@AndreasAugustin

I've put up a pull request to add @JakobHavtorn! :tada:

allcontributors[bot] avatar Jul 18 '24 20:07 allcontributors[bot]

@JakobHavtorn sorry for delay. At least I have a PR available to sync the tags (first step). #561 Actually the code is already there since a while, did not have time yet to test. If you want to check this feature please use smth like


on:
  # manual trigger
  workflow_dispatch:
jobs:
  repo-sync:
    runs-on: ubuntu-latest
    # https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
    permissions:
      contents: write
      pull-requests: write

    steps:
      # To use this repository's private action, you must check out the repository
      - name: Checkout
        uses: actions/checkout@v4

      - name: actions-template-sync
        uses: AndreasAugustin/actions-template-sync@feat/547_tags  # reference the branch
        with:
          source_repo_path: <owner/repo>
          upstream_branch: <target_branch> # defaults to main
          is_with_tags: true  # new property

AndreasAugustin avatar Sep 04 '24 19:09 AndreasAugustin