cage1016 / ak

A generator for golang alfred workflow that helps you create boilerplate code.
https://kaichu.io/posts/golang-alfred-workflow-generator-ak/
MIT License
9 stars 0 forks source link

found the following issues that I'd like to discuss with you #4

Closed xbpk3t closed 6 months ago

xbpk3t commented 1 year ago

go-bindata


# Regenerates OPA data from rego files
HAVE_GO_BINDATA := $(shell command -v go-bindata 2> /dev/null)
generate: ## go generate
ifndef HAVE_GO_BINDATA
    @echo "requires 'go-bindata' (go get -u github.com/kevinburke/go-bindata/go-bindata)"
    @exit 1 # fail  
else
    go generate ./...
endif

go get -u github.com/kevinburke/go-bindata/go-bindata

go get is deprecated

maybe this is better

go install github.com/go-bindata/go-bindata/go-bindata@latest

symbolic link error

make unlink doesn't work, i have to delete workflow directly, then the symbolic link will be removed



➜  workflows pwd
/Users/lhgtqb7bll/Library/Mobile\ Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows
➜  workflows ll
total 0
drwxr-xr-x  10 lhgtqb7bll  staff   320B Apr 20  2023 user.workflow.14276D3F-D16B-456C-8CDB-C0EFC4EB87ED
drwxr-xr-x  52 lhgtqb7bll  staff   1.6K Sep 30 17:39 user.workflow.15E8E1BA-9847-4F57-9CA7-FC4593231F26
drwxr-xr-x   8 lhgtqb7bll  staff   256B Oct  3 23:55 user.workflow.1EC230E7-153C-477A-8253-1DA928145BF3
drwxr-xr-x   4 lhgtqb7bll  staff   128B Feb  5  2023 user.workflow.232358C2-6481-418A-A979-C49EB2803A14
drwxr-xr-x   6 lhgtqb7bll  staff   192B Oct 14 14:53 user.workflow.2CF50757-994C-4E1A-8B37-A058EB0347F7
drwxr-xr-x   6 lhgtqb7bll  staff   192B Sep 30 17:39 user.workflow.3D00BE58-A213-43DD-AE68-0A627F68745E
lrwxr-xr-x   1 lhgtqb7bll  staff    67B Oct 22 17:18 user.workflow.420CF600-B208-4119-BAAD-89E09D90F6C5 -> /Users/lhgtqb7bll/Documents/chrome-actions-alfredworkflow/.workflow
drwxr-xr-x   5 lhgtqb7bll  staff   160B Oct 16 18:54 user.workflow.474E9D4D-410E-4FE7-A1EB-A6C22640F86E
drwxr-xr-x   6 lhgtqb7bll  staff   192B Oct 14 14:51 user.workflow.5FF01267-C534-4595-A673-587702BB0308
drwxr-xr-x   6 lhgtqb7bll  staff   192B Apr 23 22:46 user.workflow.641A3D11-9229-4B14-9B05-EE3949B31DB1
drwxr-xr-x   6 lhgtqb7bll  staff   192B Sep 30 17:39 user.workflow.65A3BF41-954A-45EB-A102-452D19A23D28
drwxr-xr-x   7 lhgtqb7bll  staff   224B Feb  6  2023 user.workflow.82B43860-8993-41B9-83FB-F18019A8A613
drwxr-xr-x   3 lhgtqb7bll  staff    96B Feb  1  2023 user.workflow.878A0779-C943-4A18-8DB5-CAAFCAE36D42
drwxr-xr-x   3 lhgtqb7bll  staff    96B Apr 27 16:22 user.workflow.A6FA9615-5A81-442F-A270-18B71A09F483
drwxr-xr-x   5 lhgtqb7bll  staff   160B Oct 17 18:44 user.workflow.B95D6FB4-E663-41B8-B6A1-48A589359D38
drwxr-xr-x   8 lhgtqb7bll  staff   256B Feb  4  2023 user.workflow.BA7106F3-F594-4D96-9092-B6DDA263BFCC
drwxr-xr-x  72 lhgtqb7bll  staff   2.3K Oct 22 15:33 user.workflow.CAE3028E-8895-4B5E-A8D7-9E5EE3725387
drwxr-xr-x   4 lhgtqb7bll  staff   128B Apr 23 19:50 user.workflow.DB4BA671-2EF4-4E00-B23E-A815F1E809F9
lrwxr-xr-x   1 lhgtqb7bll  staff    67B Oct 22 15:12 user.workflow.EEB56321-E953-4349-B160-5AC722DAFA0D -> /Users/lhgtqb7bll/Documents/chrome-actions-alfredworkflow/.workflow
drwxr-xr-x  14 lhgtqb7bll  staff   448B Jan 30  2023 user.workflow.F336D871-B668-4F39-A22D-D138CA314896

I've make unlink to remove symbolic link, but this symbolic link is still exist

release tag


      - name: Parse Event
        run: |
          echo "tag=$(jq -r '.release.tag_name' "${GITHUB_EVENT_PATH}" | sed s/^v//)" >> $GITHUB_ENV

  echo "artifact=$(echo "chrome-actions-alfredworkflow_auto_update-null.alfredworkflow")" >> $GITHUB_ENV
  shell: /bin/bash -e {0}
  env:
    GOROOT: /Users/runner/hostedtoolcache/go/1.20.8/x64
    tag: null
  adding: icon.png (deflated 0%)
  adding: update-available.png (deflated 4%)
  adding: exe (deflated 61%)
  adding: info.plist (deflated 89%)

tag is null

I usually use ${{ github.ref_name }}, and this works fine

EnabledAutoUpdate

Why not directly control whether to automatically update through env, but make two releases?

This is not intuitive


Finally, this tool is really useful, thx for your work

cage1016 commented 1 year ago

Thanks for feedback

The first two issue has been fixed at Release v0.4.1 · cage1016/ak

xbpk3t commented 1 year ago

Thx for your answer

The third point is because I directly use the tag trigger instead of the release trigger, so there is no relevant data, cause this error.

If use release trigger, It may be a better choice to judge before executing the operation, and it is best to be compatible with tag trigger, such as this


      - name: Set version env variable
        run: |
          # Define the release tag name based on the event type
          if [[ "${{ github.event_name }}" == "release" ]]; then
            echo "VERSION=$(cat ${GITHUB_EVENT_PATH} | jq -r '.release.tag_name')" >> $GITHUB_ENV
          elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
            echo "VERSION=${{ inputs.release_tag_name }}" >> $GITHUB_ENV
      elif [[ "${{ github.event_name }}" == "push" && contains(github.ref, 'refs/tags/') ]]; then
            echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
          fi

The fourth point is that I still think that using env to control is a better choice. As a generator, Users should not directly download different workflows to determine whether automatic updates can be performed.

Hope you can consider it.