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

refactor(main): rename robot #5

Merged
merged 1 commit into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Checkout the latest code
uses: actions/checkout@v3
- name: Gh Rebot for Sealos
uses: labring/gh-[email protected]
uses: labring/[email protected]
with:
version: v0.0.6
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
kube-version: 1.24.0
- name: Run set image
run: |
kubectl set image deployment/${{ github.event.inputs.deployment }} *=ghcr.io/${{ github.repository_owner }}/gh-robot:${{ github.event.inputs.imageTag }}
kubectl set image deployment/${{ github.event.inputs.deployment }} *=ghcr.io/${{ github.repository_owner }}/robot:${{ github.event.inputs.imageTag }}
10 changes: 5 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,25 @@ jobs:
password: ${{ secrets.GH_RELEASE_PAT }}
- name: Copy file
run: |
cp dist/gh-robot_linux_amd64_v1/gh-robot gh-robot
cp dist/robot_linux_amd64_v1/robot robot
- name: Expose git commit data
uses: rlespinasse/git-commit-data-action@v1
- name: build (and publish) main image
if: ${{ (github.event_name == 'push') }}
run: |
docker buildx build \
--platform linux/amd64 \
--label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/gh-robot" \
--label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/robot" \
--push \
-t ghcr.io/${{ github.repository_owner }}/gh-robot:${{ env.GIT_COMMIT_SHORT_SHA }} \
-t ghcr.io/${{ github.repository_owner }}/robot:${{ env.GIT_COMMIT_SHORT_SHA }} \
-f Dockerfile \
.
- name: build main image
if: ${{ (github.event_name != 'push') }}
run: |
docker buildx build \
--platform linux/amd64 \
--label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/gh-robot" \
-t ghcr.io/${{ github.repository_owner }}/gh-robot:${{ env.GIT_COMMIT_SHORT_SHA }} \
--label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/robot" \
-t ghcr.io/${{ github.repository_owner }}/robot:${{ env.GIT_COMMIT_SHORT_SHA }} \
-f Dockerfile \
.
2 changes: 1 addition & 1 deletion .github/workflows/test-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
run: |
make install
- run: |
gh-robot action
robot action
env:
SEALOS_TYPE: "/comment"
GH_TOKEN: "${{ secrets.GH_PAT }}"
4 changes: 2 additions & 2 deletions .github/workflows/test-issue-renew.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ jobs:
run: |
make install
- run: |
gh-robot action
robot action
env:
SEALOS_TYPE: "issue_renew"
SEALOS_ISSUE_TITLE: "[DaylyReport] Auto build for sealos"
SEALOS_ISSUE_BODY: "xxxx"
SEALOS_ISSUE_BODYFILE: "README.md"
SEALOS_ISSUE_LABEL: "dayly-report"
SEALOS_ISSUE_TYPE: "day"
SEALOS_ISSUE_REPO: "labring/gh-robot"
SEALOS_ISSUE_REPO: "labring/robot"
SEALOS_COMMENT_BODY: "FFFFFFF_TEST"
GH_TOKEN: "${{ secrets.GH_PAT }}"
- run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-issue-reply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
make install
- if: startswith(github.event.comment.body, '/comment')
run: |
gh-robot action
robot action
env:
SEALOS_TYPE: "issue_comment"
# SEALOS_FILENAME: "templates/template.md"
Expand All @@ -30,14 +30,14 @@ jobs:
run: |
echo "somethings.....default" >> templates/template.md
- run: |
gh-robot action
robot action
if: startswith(github.event.comment.body, '/comment')
env:
SEALOS_TYPE: "issue_comment"
SEALOS_FILENAME: "templates/template.md"
GH_TOKEN: "${{ secrets.GH_PAT }}"
- run: |
gh-robot action
robot action
if: startswith(github.event.comment.body, '/reply')
env:
SEALOS_TYPE: "issue_comment"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
make install
- if: ${{ (github.event_name != 'push') }}
run: |
gh-robot action
robot action
env:
SEALOS_TYPE: "issue_comment"
SEALOS_FILENAME: "templates/template.md"
Expand All @@ -32,7 +32,7 @@ jobs:
echo "somethings.....default" >> templates/template.md
- if: ${{ (github.event_name != 'push') }}
run: |
gh-robot action
robot action
env:
SEALOS_TYPE: "issue_comment"
SEALOS_FILENAME: "templates/template.md"
Expand Down
56 changes: 28 additions & 28 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ before:
# you may remove this if you don't need go generate
- go generate ./...
builds:
- id: gh-robot
- id: robot
env:
- CGO_ENABLED=0
goos:
Expand All @@ -15,57 +15,57 @@ builds:
- arm64
ldflags:
- -s -w
- -X github.com/labring/gh-robot/pkg/version.gitVersion={{.Version}}
- -X github.com/labring/gh-robot/pkg/version.gitCommit={{.ShortCommit}}
- -X github.com/labring/gh-robot/pkg/version.buildDate={{.Date}}
- -X github.com/labring/robot/pkg/version.gitVersion={{.Version}}
- -X github.com/labring/robot/pkg/version.gitCommit={{.ShortCommit}}
- -X github.com/labring/robot/pkg/version.buildDate={{.Date}}


dockers:
- use: buildx
ids:
- gh-robot
- robot
goos: linux
goarch: amd64
image_templates:
- ghcr.io/{{ .Env.USERNAME }}/gh-robot:{{ .Tag }}-amd64
- ghcr.io/{{ .Env.USERNAME }}/robot:{{ .Tag }}-amd64
dockerfile: Dockerfile
build_flag_templates:
- --pull
- --platform=linux/amd64
- --build-arg=TARGETARCH=amd64
- --label=io.sealos.image.created={{.Date}}
- --label=io.sealos.image.title=gh-robot
- --label=io.sealos.image.title=robot
- --label=io.sealos.image.revision={{.ShortCommit}}
- --label=io.sealos.image.version={{.Tag }}
- --label=io.sealos.image.auth={{ .Env.USERNAME }}
- --label=org.opencontainers.image.description="Automatically github bot for Sealos using comment and cmd"
- --label=org.opencontainers.image.licenses="Apache 2.0"
- --label=org.opencontainers.image.source="https://github.com/labring/gh-robot"
- --label=org.opencontainers.image.source="https://github.com/labring/robot"
- use: buildx
ids:
- gh-robot
- robot
goos: linux
goarch: arm64
image_templates:
- ghcr.io/{{ .Env.USERNAME }}/gh-robot:{{ .Tag }}-arm64
- ghcr.io/{{ .Env.USERNAME }}/robot:{{ .Tag }}-arm64
dockerfile: Dockerfile
build_flag_templates:
- --pull
- --platform=linux/arm64
- --build-arg=TARGETARCH=arm64
- --label=io.sealos.image.created={{.Date}}
- --label=io.sealos.image.title=gh-robot
- --label=io.sealos.image.title=robot
- --label=io.sealos.image.revision={{.ShortCommit}}
- --label=io.sealos.image.version={{.Tag }}
- --label=io.sealos.image.auth={{ .Env.USERNAME }}
- --label=org.opencontainers.image.description="Automatically github bot for Sealos using comment and cmd"
- --label=org.opencontainers.image.licenses="Apache 2.0"
- --label=org.opencontainers.image.source="https://github.com/labring/gh-robot"
- --label=org.opencontainers.image.source="https://github.com/labring/robot"
docker_manifests:
- name_template: ghcr.io/{{ .Env.USERNAME }}/gh-robot:{{ .Tag }}
- name_template: ghcr.io/{{ .Env.USERNAME }}/robot:{{ .Tag }}
image_templates:
- ghcr.io/{{ .Env.USERNAME }}/gh-robot:{{ .Tag }}-amd64
- ghcr.io/{{ .Env.USERNAME }}/gh-robot:{{ .Tag }}-arm64
- ghcr.io/{{ .Env.USERNAME }}/robot:{{ .Tag }}-amd64
- ghcr.io/{{ .Env.USERNAME }}/robot:{{ .Tag }}-arm64


#archives:
Expand Down Expand Up @@ -116,12 +116,12 @@ changelog:
release:
prerelease: auto
header: |
## labring: gh-robot {{ .Tag }}
We are excited to present to you the latest tool from labring: gh-robot {{ .Tag }}! Gh-robot is a powerful automation tool designed specifically for GitHub repositories, with features such as handling issue and PR comments, automatic publishing, and auto-generating changelog files. In this article, we will provide a brief introduction to the main features of gh-robot and how to obtain the corresponding Docker image.
## labring: robot {{ .Tag }}
We are excited to present to you the latest tool from labring: robot {{ .Tag }}! Gh-robot is a powerful automation tool designed specifically for GitHub repositories, with features such as handling issue and PR comments, automatic publishing, and auto-generating changelog files. In this article, we will provide a brief introduction to the main features of robot and how to obtain the corresponding Docker image.

## Usage Instructions

gh-robot is a powerful tool that can help you effortlessly handle issue and PR comments in your GitHub repositories while also automatically publishing and generating changelog files. To start using gh-robot, you first need to download the precompiled binary file suitable for your operating system. You can find these files on our [GitHub Releases page](https://github.com/labring/gh-robot/releases).
robot is a powerful tool that can help you effortlessly handle issue and PR comments in your GitHub repositories while also automatically publishing and generating changelog files. To start using robot, you first need to download the precompiled binary file suitable for your operating system. You can find these files on our [GitHub Releases page](https://github.com/labring/robot/releases).

### Installation

Expand All @@ -130,37 +130,37 @@ release:

### Usage

In the command line, run the following command to start gh-robot:
In the command line, run the following command to start robot:

```bash
gh-robot [OPTIONS]
robot [OPTIONS]
```

`OPTIONS` can include the following parameters:

- `--help`: Display help information.
- `--version`: Display the version information of gh-robot.
- `--version`: Display the version information of robot.
- Other optional parameters.

## Docker Image

For added convenience, we also provide a Docker image for gh-robot. You can obtain the image with the following command:
For added convenience, we also provide a Docker image for robot. You can obtain the image with the following command:

```bash
docker pull ghcr.io/labring/gh-robot:{{ .Tag }}
docker pull ghcr.io/labring/robot:{{ .Tag }}
```

To run the gh-robot Docker container, use the following command:
To run the robot Docker container, use the following command:

```bash
docker run --rm -it ghcr.io/labring/gh-robot:{{ .Tag }} [OPTIONS]
docker run --rm -it ghcr.io/labring/robot:{{ .Tag }} [OPTIONS]
```

Here, `OPTIONS` are the options you want to pass to gh-robot.
Here, `OPTIONS` are the options you want to pass to robot.

footer: |
**Full Changelog**: https://github.com/{{ .Env.USERNAME }}/gh-robot/compare/{{ .PreviousTag }}...{{ .Tag }}
**Full Changelog**: https://github.com/{{ .Env.USERNAME }}/robot/compare/{{ .PreviousTag }}...{{ .Tag }}

* * *

Thank you for your interest and support in labring and gh-robot! If you encounter any problems during use, please feel free to submit an issue in our [GitHub repository](https://github.com/labring/gh-robot). We will resolve your issue as soon as possible.
Thank you for your interest and support in labring and robot! If you encounter any problems during use, please feel free to submit an issue in our [GitHub repository](https://github.com/labring/robot). We will resolve your issue as soon as possible.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ MAINTAINER "Sealos Inc."

RUN apk --no-cache add jq bash curl git git-lfs github-cli

COPY gh-robot /usr/bin/
COPY robot /usr/bin/


ENTRYPOINT ["/usr/bin/gh-robot"]
ENTRYPOINT ["/usr/bin/robot"]

CMD ["--help"]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
install:
go build -o gh-robot -v
sudo mv gh-robot /usr/bin/
go build -o robot -v
sudo mv robot /usr/bin/

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# gh-robot 项目说明文档
# robot 项目说明文档

gh-robot 是一个针对 sealos 项目的 GitHub robot,用于自动执行一些常见操作,如发布新版本等。本文档将介绍该 robot 的配置文件,并提供相应的使用指南。
robot 是一个针对 sealos 项目的 GitHub robot,用于自动执行一些常见操作,如发布新版本等。本文档将介绍该 robot 的配置文件,并提供相应的使用指南。

## 配置文件

下面是 gh-robot 项目的配置文件:
下面是 robot 项目的配置文件:

```yaml
version: v1
Expand Down Expand Up @@ -69,7 +69,7 @@ message:

## 使用文档

使用 gh-robot 时,需要遵循以下步骤:
使用 robot 时,需要遵循以下步骤:

1. 将配置文件添加到项目的`.github`目录` gh-bot.yml `文件。
2. 确保配置文件中的用户名、仓库名称等信息与实际情况相符。
Expand All @@ -91,7 +91,7 @@ message:

### 错误处理

根据配置文件中的消息模板,gh-robot 会在执行操作过程中遇到错误时返回相应的提示消息。例如:
根据配置文件中的消息模板,robot 会在执行操作过程中遇到错误时返回相应的提示消息。例如:

- 格式错误:‼️ 机器人说:操作格式错误,请检查此操作的格式。
- 权限错误:‼️ 机器人说:操作无权限触发。
Expand All @@ -104,7 +104,7 @@ message:

```yaml
- name: Gh Rebot for Sealos
uses: labring/gh-[email protected]
uses: labring/[email protected]
with:
version: v0.0.6-rc6
env:
Expand Down
12 changes: 6 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ description: "Add some robot command for sealos"
author: "cuisongliu"
inputs:
version:
description: 'version of gh-robot'
description: 'version of robot'
required: true
default: 'v0.0.5'
runs:
using: "composite"
steps:
- run: |
sudo wget -q https://github.com/labring/gh-robot/releases/download/${GH_REBOT_VERSION}/gh-robot_${GH_REBOT_VERSION#v}_linux_amd64.tar.gz
sudo tar -zxf gh-robot_${GH_REBOT_VERSION#v}_linux_amd64.tar.gz gh-robot && chmod +x gh-robot && sudo mv gh-robot /usr/bin/gh-robot
gh-robot version
sudo rm -rf gh-robot_${GH_REBOT_VERSION#v}_linux_amd64.tar.gz
gh-robot action
sudo wget -q https://github.com/labring/robot/releases/download/${GH_REBOT_VERSION}/robot_${GH_REBOT_VERSION#v}_linux_amd64.tar.gz
sudo tar -zxf robot_${GH_REBOT_VERSION#v}_linux_amd64.tar.gz robot && chmod +x robot && sudo mv robot /usr/bin/robot
robot version
sudo rm -rf robot_${GH_REBOT_VERSION#v}_linux_amd64.tar.gz
robot action
shell: bash
env:
GH_REBOT_VERSION: ${{ inputs.version }}
Expand Down
8 changes: 4 additions & 4 deletions cmd/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ package cmd
import (
"fmt"
"github.com/cuisongliu/logger"
"github.com/labring/gh-robot/pkg/action"
"github.com/labring/gh-robot/pkg/setup"
"github.com/labring/gh-robot/pkg/types"
"github.com/labring/gh-robot/pkg/utils"
"github.com/labring/robot/pkg/action"
"github.com/labring/robot/pkg/setup"
"github.com/labring/robot/pkg/types"
"github.com/labring/robot/pkg/utils"
"os"

"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var cfgFile string

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "gh-robot",
Use: "robot",
// Uncomment the following line if your bare application
// has an action associated with it:
// Run: func(cmd *cobra.Command, args []string) { },
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package cmd

import (
"fmt"
"github.com/labring/gh-robot/pkg/version"
"github.com/labring/robot/pkg/version"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/util/json"
Expand Down
4 changes: 2 additions & 2 deletions cmd/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ package cmd

import (
"github.com/cuisongliu/logger"
"github.com/labring/gh-robot/pkg/setup"
"github.com/labring/gh-robot/pkg/webhook"
"github.com/labring/robot/pkg/setup"
"github.com/labring/robot/pkg/webhook"

"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/labring/gh-robot
module github.com/labring/robot

go 1.20

Expand Down
Loading