diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0f3be5e..593af53 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,9 +42,9 @@ jobs: - uses: "actions/setup-go@v2" with: go-version: "${{ env.GO_VERSION }}" - - run: "go get golang.org/x/tools/cmd/stringer" + - run: "go install golang.org/x/tools/cmd/stringer" - - run: "go generate ./..." + - run: "go generate unifi/device.go" - run: "git diff --compact-summary --exit-code" lint: diff --git a/.github/workflows/generate.yaml b/.github/workflows/generate.yaml new file mode 100644 index 0000000..95f3aec --- /dev/null +++ b/.github/workflows/generate.yaml @@ -0,0 +1,31 @@ +--- +on: + schedule: + - cron: "0 0 * * *" + workflow_dispatch: {} + +env: + GO_VERSION: "^1.16" + +jobs: + fields: + runs-on: "ubuntu-latest" + steps: + - uses: "actions/setup-go@v2" + with: + go-version: "${{ env.GO_VERSION }}" + + - uses: "actions/checkout@v2" + - uses: "actions/cache@v2" + with: + path: "~/go/pkg/mod" + key: "${{ runner.os }}-gomod-${{ hashFiles('**/go.sum') }}" + restore-keys: | + ${{ runner.os }}-gomod- + + # TODO: Automatically merge the PR if tests pass. + - run: "go generate unifi/fields.go" + - uses: "peter-evans/create-pull-request@v3" + with: + delete-branch: true + title: "Update to latest controller version" diff --git a/unifi/gen.go b/unifi/fields.go similarity index 100% rename from unifi/gen.go rename to unifi/fields.go