Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve automatic backport flow #5365

Conversation

waiting-for-dev
Copy link
Contributor

@waiting-for-dev waiting-for-dev commented Aug 31, 2023

Summary

Make automatic backporting PRs take the title from the original one

Up until now, the title of the backporting PRs was the name of the merge commit, which is not very readable. This commit builds the title from the original PR title and the target branch, e.g.:

[v4.2] Fix some bug

This is now possible thanks to upstream's recent changes. See sorenlouv/backport#455 for details.

Automatically copy labels from original PR to backported PRs

None of the automatically generated PRs for backports can trigger the labeler flow, which resulted in them not being added to the automatic release notes unless manual work was done to update the labels. The reason is that an action in a workflow can't trigger another action, and that's by design. As referenced in an issue from the create-pull-request project:

An action in a workflow run can't trigger a new workflow run. For example, if an action pushes code using the repository's GITHUB_TOKEN, a new workflow will not run even when the repository contains a workflow configured to run when push events occur.

On that issue, there's also a reference from a response from GH support:

This is a deliberate decision by the Actions team in order to prevent accidental "infinite loop" situations, and as an anti-abuse measure. You will be able to work around this using a Personal Access Token in place of the provided token. As this needs to be explicitly provided it will remove any potential for possible abuse, so we recommend using this method when needing to create a pull request.

As said, we could work around that by using a personal token, which could be scoped to the solidusio/solidus repository. However, we don't think that would be a good idea because of security & practical concerns.

Thanks to upstream work in the backporter tool [2] we can now copy the labels from the original PR to the backported PRs, avoiding the need for manual work.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@waiting-for-dev waiting-for-dev requested a review from a team as a code owner August 31, 2023 12:32
@github-actions github-actions bot added the changelog:repository Changes to the repository not within any gem label Aug 31, 2023
@waiting-for-dev waiting-for-dev self-assigned this Aug 31, 2023
@waiting-for-dev waiting-for-dev changed the title Make automatic backporting PRs take the title from the original one Improve automatic backport flow Sep 4, 2023
.backportrc.json Outdated Show resolved Hide resolved
@waiting-for-dev waiting-for-dev force-pushed the waiting-for-dev/backport_title_from_original_pr branch from b200f6e to 4f58428 Compare September 4, 2023 13:25
Up until now, the title of the backporting PRs was the name of the merge
commit, which is not very readable. This commit builds the title from
the original PR title and the target branch, e.g.:

    [v4.2] Fix some bug

This is now possible thanks to upstream's recent changes. See
sorenlouv/backport#455 for details.
None of the automatically generated PRs for backports can trigger the
labeler flow, which resulted in them not being added to the automatic
release notes unless manual work was done to update the labels. The
reason is that an action in a workflow can't trigger another action, and
that's by design. As referenced in an issue from the
`create-pull-request` project [1]:

> An action in a workflow run can't trigger a new workflow run. For
> example, if an action pushes code using the repository's GITHUB_TOKEN, a
> new workflow will not run even when the repository contains a workflow
> configured to run when push events occur.

On that issue, there's also a reference from a response from GH support:

> This is a deliberate decision by the Actions team in order to prevent accidental "infinite loop" situations, and as an anti-abuse measure.
> You will be able to work around this using a Personal Access Token in
> place of the provided token. As this needs to be explicitly provided it
> will remove any potential for possible abuse, so we recommend using this
> method when needing to create a pull request.

As said, we could work around that by using a personal token, which
could be scoped to the `solidusio/solidus` repository. However, we don't
think that would be a good idea because of security & practical
concerns.

Thanks to upstream work in the backporter tool [2] we can now copy the
labels from the original PR to the backported PRs, avoiding the need for
manual work.

[1] - peter-evans/create-pull-request#48
[2] - sorenlouv/backport#456 (comment)
@waiting-for-dev waiting-for-dev force-pushed the waiting-for-dev/backport_title_from_original_pr branch from 4f58428 to 6ecc1a1 Compare September 4, 2023 13:28
@waiting-for-dev waiting-for-dev merged commit 152b022 into solidusio:main Sep 5, 2023
2 checks passed
@waiting-for-dev waiting-for-dev deleted the waiting-for-dev/backport_title_from_original_pr branch September 5, 2023 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:repository Changes to the repository not within any gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants