Skip to content

Commit 6c048b0

Browse files
authored
Merge pull request #12 from nimblehq/develop
Release 0.1.11
2 parents dd1387e + bc7ff02 commit 6c048b0

10 files changed

Lines changed: 194 additions & 21 deletions

File tree

.github/ISSUE_TEMPLATE/bug_template.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ labels: "type : bug"
77

88
## Issue
99

10-
Describe the issue you are facing. Show us the implementation: screenshots, gif, etc.
11-
10+
Describe the issue you are facing. Show us the implementation: screenshots, GIFs, etc.
11+
1212
## Expected
1313

14-
Describe what should be the correct behaviour.
15-
14+
Describe what should be the correct behavior.
15+
1616
## Steps to reproduce
1717

1818
1.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
name: "Chore"
3-
about: "Open a Chore for minor update."
3+
about: "Open a chore issue for a minor update."
44
title: "Update "
55
labels: "type : chore"
66
---
77

88
## Why
99

10-
Describe the update details and why it's needed.
11-
10+
Describe the update in detail and why it is needed.
11+
1212
## Who Benefits?
1313

1414
Describe who will be the beneficiaries e.g. everyone, specific chapters, clients...

.github/ISSUE_TEMPLATE/feature_template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ labels: "type : feature"
77

88
## Why
99

10-
Describe the big picture of the feature and why it's needed.
11-
10+
Describe the big picture of the feature and why it is needed.
11+
1212
## Who Benefits?
1313

1414
Describe who will be the beneficiaries e.g. everyone, specific chapters, clients...

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ https://github.com/nimblehq/git-template/issues/??
22

33
## What happened 👀
44

5-
Describe the big picture of your changes here to communicate to the team why we should accept this pull request.
6-
5+
Describe the big picture of your changes here to communicate to the team why we should accept this pull request.
6+
77
## Insight 📝
88

9-
Describe in details how to test the changes, which solution you tried but did not go with, referenced documentation is welcome as well.
10-
9+
Describe in detail how to test the changes, which solution you tried but did not go with, referenced documentation is welcome as well.
10+
1111
## Proof Of Work 📹
1212

13-
Show us the implementation: screenshots, gif, etc.
13+
Show us the implementation: screenshots, GIFs, etc.

.github/workflows/publish_wiki.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflow will publish all of the documents stored under ./github/wiki directory
1+
# This workflow will publish all of the documents stored under ./github/wiki directory
22
# to Github Wiki of the given repository.
33
#
44
# To use this workflow, please follow these steps
@@ -7,11 +7,11 @@
77
# - Create Personal Access Token with `repo` scope enabled - a bot account is recommended to generate that token
88
# https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
99
# - Create a Repository Secret for the above token, e.g. name it as GH_ACTION_TOKEN
10-
# - Define your own workflow and provide the required inputs & secret, here is an example workflow:
11-
#
10+
# - Define your own workflow and provide the required inputs & secrets, here is an example workflow:
11+
#
1212
# name: Publish Wiki
1313
#
14-
# on:
14+
# on:
1515
# push:
1616
# branches:
1717
# - develop
@@ -62,12 +62,12 @@ jobs:
6262

6363
steps:
6464
- name: Cancel previous runs
65-
uses: styfle/cancel-workflow-action@0.8.0
65+
uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # styfle/cancel-workflow-action@0.13.1
6666
with:
6767
access_token: ${{ github.token }}
6868

6969
- name: Checkout the repository
70-
uses: actions/checkout@v2
70+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # actions/checkout@v6.0.3
7171
with:
7272
ref: ${{ github.head_ref }}
7373

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
## Usage
1111
Follow the [instruction](https://docs.github.com/en/actions/learn-github-actions/reusing-workflows#calling-a-reusable-workflow) from Github to use any workflows in this repository.
1212

13+
- [Automate creating the Release pull request](create_release_pull_request/README.md)
14+
1315
## How to contribute
14-
- Refer to the [official guide](https://docs.github.com/en/actions/learn-github-actions/reusing-workflows#creating-a-reusable-workflow) to learn how to define a resuable workflow
16+
- Refer to the [official guide](https://docs.github.com/en/actions/learn-github-actions/reusing-workflows#creating-a-reusable-workflow) to learn how to define a reusable workflow
1517
- Put the new workflow under `./github/workflows` directory
1618
- Follow our [convention](https://nimblehq.co/compass/development/code-conventions/github-actions/) when defining the workflow
1719
- Submit a [Pull rquest](https://github.com/nimblehq/github-actions-workflows/compare) to this repository
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Automate creating the Release pull request
2+
3+
## Usage
4+
5+
- Create a `create_release_pull_request.yml` workflow, sample [here](sample/workflows/create_release_pull_request.yml).
6+
- Provide a release changelog configuration file, sample [here](sample/workflows/config/changelog-release.json).
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Automate creating the Release pull request
2+
description: Automate creating the Release pull request
3+
inputs:
4+
release_version:
5+
description: Release version
6+
required: true
7+
changelog_configuration:
8+
description: The changelog configuration file path, e.g., ".github/workflows/config/changelog-release.json"
9+
required: true
10+
default: ".github/workflows/config/changelog_release.json"
11+
github_token:
12+
description: The GitHub PAT for this action to use
13+
required: false
14+
default: ${{ github.token }}
15+
base_branch:
16+
description: The base branch for the release pull request, e.g., "main"
17+
required: false
18+
default: main
19+
assignee:
20+
description: The assignee for the Release pull request, e.g., bot
21+
required: false
22+
label:
23+
description: 'The label for the Release pull request, e.g., "type : release"'
24+
required: false
25+
default: "type : release"
26+
release_body_url:
27+
description: The URL to put in the release body. If not set, the GitHub Milestone (= release_version) URL will be used.
28+
required: false
29+
30+
runs:
31+
using: composite
32+
steps:
33+
- name: Find the HEAD commit
34+
id: find_head_commit
35+
shell: bash
36+
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
37+
38+
- name: Find the latest ${{ inputs.base_branch }} commit
39+
id: find_latest_base_commit
40+
shell: bash
41+
run: |
42+
git fetch origin ${{ inputs.base_branch }}
43+
echo "sha=$(git rev-parse origin/${{ inputs.base_branch }})" >> $GITHUB_OUTPUT
44+
45+
- name: Generate changelog
46+
id: generate_changelog
47+
uses: mikepenz/release-changelog-builder-action@348e88fab4c37338b1e803ceb2d4a7a5db6c0833 # mikepenz/release-changelog-builder-action@v6.2.2
48+
with:
49+
token: ${{ inputs.github_token }}
50+
configuration: ${{ inputs.changelog_configuration }}
51+
outputFile: body_content.txt
52+
fromTag: ${{ steps.find_latest_base_commit.outputs.sha }}
53+
toTag: ${{ steps.find_head_commit.outputs.sha }}
54+
55+
- name: Find milestone
56+
id: find_milestone
57+
env:
58+
GH_TOKEN: ${{ inputs.github_token }}
59+
shell: bash
60+
run: |
61+
gh extension install valeriobelli/gh-milestone
62+
MILESTONE=${{ inputs.release_version }}
63+
MILESTONE_URL=$(gh milestone list --query $MILESTONE --json url --jq ".[0].url")
64+
echo "milestone=$MILESTONE" >> $GITHUB_OUTPUT
65+
echo "milestone_url=$MILESTONE_URL" >> $GITHUB_OUTPUT
66+
67+
- name: Prepend Release URL into the changelog
68+
shell: bash
69+
run: |
70+
if [ -n "${{ inputs.release_body_url }}" ]; then
71+
echo -e "${{ inputs.release_body_url }}\n\n$(cat body_content.txt)" > body_content.txt
72+
else
73+
echo -e "${{ steps.find_milestone.outputs.milestone_url }}\n\n$(cat body_content.txt)" > body_content.txt
74+
fi
75+
76+
- name: Create the Release pull request
77+
env:
78+
GH_TOKEN: ${{ inputs.github_token }}
79+
shell: bash
80+
run: |
81+
RELEASE_BRANCH=release/${{ inputs.release_version }}
82+
83+
# Create the release branch
84+
git checkout -b $RELEASE_BRANCH
85+
git push origin $RELEASE_BRANCH -f
86+
87+
# Add milestone if available
88+
if [ -n "${{ steps.find_milestone.outputs.milestone_url }}" ]; then
89+
MILESTONE_PARAM="--milestone ${{ steps.find_milestone.outputs.milestone }}"
90+
else
91+
MILESTONE_PARAM=""
92+
fi
93+
94+
# Create the pull request
95+
gh pr create \
96+
--base ${{ inputs.base_branch }} \
97+
--head $RELEASE_BRANCH \
98+
--assignee ${{ inputs.assignee }} \
99+
--title "Release - ${{ inputs.release_version }}" \
100+
--label "${{ inputs.label }}" \
101+
$MILESTONE_PARAM \
102+
--body-file body_content.txt \
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"categories": [
3+
{
4+
"title": "## ✨ Features",
5+
"labels": [
6+
"type : feature"
7+
],
8+
"empty_content": "N/A"
9+
},
10+
{
11+
"title": "## 🐛 Bug fixes",
12+
"labels": [
13+
"type : bug"
14+
],
15+
"empty_content": "N/A"
16+
},
17+
{
18+
"title": "## 🧹 Chores",
19+
"labels": [
20+
"type : chore"
21+
],
22+
"empty_content": "N/A"
23+
},
24+
{
25+
"title": "## Others",
26+
"exclude_labels": [
27+
"type : feature",
28+
"type : bug",
29+
"type : chore",
30+
"type : release"
31+
]
32+
}
33+
],
34+
"max_pull_requests": 200
35+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Create the Release pull request
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
create_release_pull_request:
8+
name: Create the Release pull request
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
steps:
14+
- name: Check out
15+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # actions/checkout@v6.0.3
16+
17+
- name: Read the current version
18+
id: version
19+
uses: christian-draeger/read-properties@908f99d3334be3802ec7cb528395a69d19914e7b # christian-draeger/read-properties@1.1.1
20+
with:
21+
path: "version.properties"
22+
properties: "version"
23+
24+
- uses: nimblehq/github-actions-workflows/create_release_pull_request@0.1.10
25+
with:
26+
release_version: ${{ steps.version.outputs.version }}
27+
changelog_configuration: ".github/workflows/config/changelog-release.json"
28+
assignee: bot-nimble

0 commit comments

Comments
 (0)