From 3bccaea7f41daf489c21456f8959468c320150ab Mon Sep 17 00:00:00 2001 From: Wsine Date: Thu, 25 Aug 2022 20:20:42 +0800 Subject: [PATCH] ci: use secrets in pr --- .github/workflows/unittest.yaml | 35 +++++++++++++++++++-------------- Makefile | 3 +-- main.go | 2 +- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/workflows/unittest.yaml b/.github/workflows/unittest.yaml index 553196a..60a3765 100644 --- a/.github/workflows/unittest.yaml +++ b/.github/workflows/unittest.yaml @@ -3,26 +3,31 @@ name: unittest on: push: branches: - - main + - main pull_request: branches: - - main + - main + pull_request_target: + branches: + - main workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout the code - uses: actions/checkout@v2 - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - name: Run testing - env: - FEISHU_APP_ID: ${{ secrets.FEISHU_APP_ID }} - FEISHU_APP_SECRET: ${{ secrets.FEISHU_APP_SECRET }} - run: | - touch .env - go test -v ./... + - name: Checkout the code + uses: actions/checkout@v2 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.17 + - name: Check format + run: test -z $(gofmt -l .) + - name: Run testing + env: + FEISHU_APP_ID: ${{ secrets.FEISHU_APP_ID }} + FEISHU_APP_SECRET: ${{ secrets.FEISHU_APP_SECRET }} + run: | + touch .env + go test -v ./... diff --git a/Makefile b/Makefile index 25207bc..f517b91 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,7 @@ HAS_UPX := $(shell command -v upx 2> /dev/null) .PHONY: build build: - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \ - go build -ldflags "-s -w" -o ./bin/feishu2md main.go + go build -o ./bin/feishu2md main.go ifneq ($(and $(COMPRESS),$(HAS_UPX)),) upx -9 ./bin/feishu2md endif diff --git a/main.go b/main.go index 3e615df..a277f15 100644 --- a/main.go +++ b/main.go @@ -126,7 +126,7 @@ func handleUrlArgument(url string) error { func main() { app := &cli.App{ Name: "feishu2md", - Version: "v1.0.1", + Version: "v1.1.0", Usage: "download feishu/larksuite document to markdown file", Action: func(ctx *cli.Context) error { if ctx.NArg() > 0 {