ci: Cherry-picking-fork action name; unique commit-branches (#12753)

## Description

A sequel to https://github.com/cosmos/cosmos-sdk/pull/12478

Adds a Github action that makes it easy to cherry pick commits from a fork PR to main under fork-cherry-pick.yml. The necessity for this PR arises from Mergify / GitHub marketplace currently not having tooling for this kind of action.

Changelog:
- Added templating for the commit-branch that the action creates on the fork.
- Added a name to the Github action.

---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules)
- [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing)
- [x] added a changelog entry to `CHANGELOG.md`
- [x] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [x] updated the relevant documentation or specification
- [x] reviewed "Files changed" and left comments if necessary
- [x] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
This commit is contained in:
Xiangan He 2022-08-15 09:32:31 -04:00 committed by GitHub
parent f7310b3c30
commit 191c860e34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,5 @@
#This CI is disabled on main and meant to be enabled on forks as an easy way to cherry pick fork commits into main.
name: Cherry pick PR to Cosmos SDK
on:
#Set to trigger on every merge to main, not just a closed PR.
workflow_dispatch:
@ -27,7 +29,7 @@ jobs:
git fetch --all # Get the latest code
git checkout -b pr-patch upstream/main # Create new branch based on main branch
git cherry-pick ${{github.event.pull_request.head.sha}} # Cherry pick the latest commit of PR
git push -u origin pr-patch # Push your changes to the remote branch
git push -u origin pr-patch-${{github.event.pull_request.head.sha}} # Push your changes to the remote branch
- name: Autocreate PR
shell: bash
env:
@ -40,7 +42,7 @@ jobs:
--data '{
"title": "Automated PR for commit: ${{github.event.pull_request.head.sha}}",
"body":"Please merge these awesome changes in!",
"head":"${{github.event.pull_request.user.login}}:pr-patch",
"head":"${{github.event.pull_request.user.login}}:pr-patch-${{github.event.pull_request.head.sha}}",
"base":"main"
}' \
--fail