-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from suba327777/main
Merge main into release
- Loading branch information
Showing
5 changed files
with
78 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Create release branch PR | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
branches: | ||
- main | ||
|
||
jobs: | ||
create-release-pr: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: fetch previous tag | ||
id: pre_tag | ||
run: | | ||
pre_tag=$(gh api repos/${{ github.repository }}/releases/latest | jq -r .tag_name) | ||
echo "pre_tag=$pre_tag" >> $GITHUB_OUTPUT | ||
- name: fetch list of merged PRs since latest release | ||
id: merged_prs | ||
run: | | ||
previous_tag=${{ steps.pre_tag.outputs.pre_tag }} | ||
merged_prs=$(gh api --method POST /repos/{owner}/{repo}/releases/generate-notes -f "tag_name=tmp" -f "target_commitish=main" -f "previous_tag_name=$previous_tag" | jq -r .body) | ||
echo "merged_prs<<EOF" >> $GITHUB_OUTPUT | ||
echo "$merged_prs" >> $GITHUB_OUTPUT | ||
echo "EOF" >> $GITHUB_OUTPUT | ||
- name: Create PR to release branch | ||
run: | | ||
PR_EXISTS=$(gh pr list --head main --base release --state open --json number --jq '.[].number') | ||
merged_prs="${{ steps.merged_prs.outputs.merged_prs }}" | ||
pr_body=$merged_prs | ||
if [ -z "$PR_EXISTS" ]; then | ||
gh pr create --title "Merge main into release" --body "$pr_body" --base release --head main | ||
else | ||
gh pr edit $PR_EXISTS --body "$pr_body" | ||
gh pr comment $PR_EXISTS --body "Additional PRs merged:\n$merged_prs" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,4 @@ linters: | |
- gosimple | ||
- varcheck | ||
- misspell | ||
- lll | ||
- gofumpt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ui | ||
|
||
import "fmt" | ||
|
||
func formatNumber(num int) string { | ||
if num >= 1000 { | ||
return fmt.Sprintf("%.1fk", float64(num)/1000) | ||
} else { | ||
return fmt.Sprintf("%d", num) | ||
} | ||
} |