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

Automate Release Pull Request Creation Process #557

Open
nkhanh44 opened this issue Jul 2, 2024 · 1 comment · May be fixed by #567
Open

Automate Release Pull Request Creation Process #557

nkhanh44 opened this issue Jul 2, 2024 · 1 comment · May be fixed by #567

Comments

@nkhanh44
Copy link
Contributor

nkhanh44 commented Jul 2, 2024

Why

We can improve the workflow by automating the process of creating release pull requests, including building the changelog, creating a release branch, and creating the pull request. This will streamline the process and make it more efficient for the team.

Acceptance Criteria

  • The create_release_pull_request.yml workflow file is created and added to the repository.
  • The workflow is triggered when a GitHub Actions workflow dispatch event is received, with the version name passed as an input parameter.
  • The .github/workflows/configs/changelog-config.json file used for the changelog configuration.

Example:

create_release_pull_request.yml

name: Create Release Pull Request

on:
  workflow_dispatch:
    inputs:
      newVersion:
        description: "Version name"
        required: true
        type: string

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  create_release_pull_request:
    name: Create Release Pull Request
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Find HEAD commit
        id: head
        run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT

      - name: Build changelog
        id: changelog
        uses: mikepenz/release-changelog-builder-action@v4
        with:
          configuration: ".github/workflows/configs/changelog-config.json"
          toTag: ${{ steps.head.outputs.sha }}
          token: ${{ secrets.GITHUB_TOKEN }}

      - name: Create Release branch
        uses: peterjgrainger/[email protected]
        with:
          branch: release/${{ github.event.inputs.newVersion }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Create pull request
        run: gh pr create --draft -B main -H release/${{ github.event.inputs.newVersion }} -t 'Release - ${{ github.event.inputs.newVersion }}' -b "${{ steps.changelog.outputs.changelog }}"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

changelog-config.json

{
  "categories": [
    {
      "title": "## ✨ Features",
      "labels": [
        "type : feature"
      ]
    },
    {
      "title": "## 🐛 Bug fixes",
      "labels": [
        "type : bug"
      ]
    },
    {
      "title": "## 🧹 Chores",
      "labels": [
        "type : chore"
      ]
    },
    {
      "title": "## Others",
      "exclude_labels": [
        "type : feature",
        "type : bug",
        "type : chore",
        "type : release"
      ]
    }
  ],
  "max_pull_requests": 200
}

Who Benefits?

  • Users
@markgravity
Copy link
Contributor

@nkhanh44 I can work on it 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants