|
| 1 | +name: Create Pre-Release PR from Milestone(Deprecated) |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: write |
| 5 | + pull-requests: write |
| 6 | + issues: write |
| 7 | + |
| 8 | +on: |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + milestone_name: |
| 12 | + description: "Milestone name to collect closed PRs from" |
| 13 | + required: true |
| 14 | + default: "v3.8.2" |
| 15 | + target_branch: |
| 16 | + description: "Target branch to merge the consolidated PR" |
| 17 | + required: true |
| 18 | + default: "pre-release-v3.8.2" |
| 19 | + |
| 20 | +env: |
| 21 | + MILESTONE_NAME: ${{ github.event.inputs.milestone_name || 'v3.8.2' }} |
| 22 | + TARGET_BRANCH: ${{ github.event.inputs.target_branch || 'pre-release-v3.8.2' }} |
| 23 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 24 | + BOT_TOKEN: ${{ secrets.BOT_TOKEN }} |
| 25 | + LABEL_NAME: cherry-picked |
| 26 | + TEMP_DIR: /tmp # Using /tmp as the temporary directory |
| 27 | + |
| 28 | +jobs: |
| 29 | + cherry_pick_milestone_prs: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + steps: |
| 32 | + - name: Setup temp directory |
| 33 | + run: | |
| 34 | + # Create the temporary directory and initialize necessary files |
| 35 | + mkdir -p ${{ env.TEMP_DIR }} |
| 36 | + touch ${{ env.TEMP_DIR }}/pr_numbers.txt |
| 37 | + touch ${{ env.TEMP_DIR }}/commit_hashes.txt |
| 38 | + touch ${{ env.TEMP_DIR }}/pr_title.txt |
| 39 | + touch ${{ env.TEMP_DIR }}/pr_body.txt |
| 40 | + touch ${{ env.TEMP_DIR }}/created_pr_number.txt |
| 41 | + - name: Checkout repository |
| 42 | + uses: actions/checkout@v4 |
| 43 | + with: |
| 44 | + fetch-depth: 0 |
| 45 | + token: ${{ secrets.BOT_TOKEN }} |
| 46 | + |
| 47 | + - name: Setup Git User for OpenIM-Robot |
| 48 | + run: | |
| 49 | + # Set up Git credentials for the bot |
| 50 | + git config --global user.email "OpenIM-Robot@users.noreply.github.com" |
| 51 | + git config --global user.name "OpenIM-Robot" |
| 52 | + - name: Fetch Milestone ID and Filter PR Numbers |
| 53 | + env: |
| 54 | + MILESTONE_NAME: ${{ env.MILESTONE_NAME }} |
| 55 | + run: | |
| 56 | + # Fetch milestone details and extract milestone ID |
| 57 | + milestones=$(curl -s -H "Authorization: token $BOT_TOKEN" \ |
| 58 | + -H "Accept: application/vnd.github+json" \ |
| 59 | + "https://api.github.com/repos/${{ github.repository }}/milestones") |
| 60 | + milestone_id=$(echo "$milestones" | grep -B3 "\"title\": \"$MILESTONE_NAME\"" | grep '"number":' | head -n1 | grep -o '[0-9]\+') |
| 61 | + if [ -z "$milestone_id" ]; then |
| 62 | + echo "Milestone '$MILESTONE_NAME' not found. Exiting." |
0 commit comments