Skip to content

Commit 99d1f56

Browse files
Merge pull request #82 from superbrobenji/test/test-for-work
made test workflow
2 parents 8e4fe49 + 99bf7eb commit 99d1f56

File tree

2 files changed

+64
-1
lines changed

2 files changed

+64
-1
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Cherry-Pick PRs by Milestone
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
milestone:
6+
description: "The milestone to filter PRs by"
7+
required: true
8+
default: "v1.0"
9+
target_branch:
10+
description: "The branch to base the new branch on (e.g., staging)"
11+
required: true
12+
default: "staging"
13+
14+
jobs:
15+
cherry-pick:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
- name: Set up Git
23+
run: |
24+
git config --global user.name "github-actions[bot]"
25+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
26+
- name: Get PRs with Milestone
27+
id: fetch_prs
28+
run: |
29+
PR_LIST=$(gh pr list --state closed --json number,milestone,mergeCommitSha \ i
30+
--jq ".[] | select(.milestone.title == '${{ inputs.milestone }}') | .mergeCommitSha")
31+
if [ -z "$PR_LIST" ]; then
32+
echo "No PRs found with milestone ${{ inputs.milestone }}"
33+
exit 1
34+
fi
35+
echo "PRs to cherry-pick:"
36+
echo "$PR_LIST"
37+
echo "::set-output name=pr_list::$PR_LIST"
38+
- name: Create new branch
39+
id: create_branch
40+
run: |
41+
NEW_BRANCH="cherry-pick-${{ inputs.milestone }}-$(date +'%Y%m%d%H%M%S')"
42+
git checkout ${{ inputs.target_branch }}
43+
git checkout -b $NEW_BRANCH
44+
echo "::set-output name=new_branch::$NEW_BRANCH"
45+
- name: Cherry-pick PRs
46+
run: |
47+
for COMMIT in ${{ steps.fetch_prs.outputs.pr_list }}; do
48+
echo "Cherry-picking commit $COMMIT..." git cherry-pick $COMMIT || {
49+
echo "Conflict occurred. Aborting.";
50+
git cherry-pick --abort;
51+
exit 1; }
52+
done
53+
- name: Push new branch
54+
run: |
55+
git push origin ${{ steps.create_branch.outputs.new_branch }}
56+
- name: Create Pull Request
57+
uses: peter-evans/create-pull-request@v5
58+
with:
59+
token: ${{ secrets.GITHUB_TOKEN }}
60+
base: ${{ inputs.target_branch }}
61+
head: ${{ steps.create_branch.outputs.new_branch }}
62+
title: "Cherry-pick PRs for Milestone: ${{ inputs.milestone }}"
63+
body: "This PR cherry-picks the following commits into the ${{ inputs.target_branch }} branch:\n\n${{ steps.fetch_prs.outputs.pr_list }}"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<a href="https://www.npmjs.com/package/asyncrify" target="_blank">
44
<img alt="Version" src="https://img.shields.io/npm/v/asyncrify.svg">
55
</a>
6-
<a href="https://github.com/superbrobenji/async-queue/blob/main/docs/package.md" target="_blank">
6+
<a href="https://superbrobenji.github.io/async-queue/" target="_blank">
77
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
88
</a>
99
<a href="https://github.com/superbrobenji/async-queue/graphs/commit-activity" target="_blank">

0 commit comments

Comments
 (0)