runfinch / finch

The Finch CLI is an open source client for container development
https://www.runfinch.com
Apache License 2.0
3.47k stars 87 forks source link

Add features not to forget to execute `finch gen-docs generate -p cmd/finch/` #942

Open haytok opened 1 month ago

haytok commented 1 month ago

What is the problem you're trying to solve?. A clear and concise description of the use case for this feature. Please provide an example, if possible.

When we create new commands or options, we need to create command references by executing finch gen-docs generate -p cmd/finch/ on locally.

However, at the moment, the document, pull requests, and CI do not indicate that finch gen-docs generate needs to be run.

As a result, we often forgot to run this command and create reference.

Describe the feature you'd like A clear and concise description of what you'd like to happen.

We need to add CI to detect whether finch gen-docs generate -p cmd/finch/ is executed by way of 1 or 2 is needed.

  1. Fail the CI if we forget to run finch gen-docs generate, so that when we check the failure, we can run finch gen-docs generate and push the updated references.

  2. Run finch gen-docs generate periodically in CI, create a PR if there are updates to the references, and have it reviewed and merged.

Additional context Add any other context or screenshots about the feature request here.

Note that this issue is created based on the comments from the following PR.

haytok commented 1 month ago

Regarding option 1 for the CI, it would involve adding a CI step similar to the following.

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - name: Setup
        uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
        with:
          token: ${{secrets.GITHUB_TOKEN}}

      // Build Finch and Setup VM

      // Generate docs
      // finch gen-docs generate -p cmd/finch/

      - name: Check to generate docs
        run: |
          git add -N docs/cmd
          git diff --exit-code docs/cmd
pendo324 commented 1 month ago

Describe the feature you'd like A clear and concise description of what you'd like to happen.

* [ ]  Documentation

* [ ]  Pull Request template

I'm planning on taking these two, just been sidetracked with other work. I'll try to get a PR posted today.

Regarding option 1 for the CI, it would involve adding a CI step similar to the following.

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - name: Setup
        uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
        with:
          token: ${{secrets.GITHUB_TOKEN}}

      // Build Finch and Setup VM

      // Generate docs
      // finch gen-docs generate -p cmd/finch/

      - name: Check to generate docs
        run: |
          git add -N docs/cmd
          git diff --exit-code docs/cmd

This looks right, but I don't think it'll work well on Ubuntu at the moment. I'm working on #377, so eventually we can probably transition to a Linux runner, but macOS will be easier for now.

haytok commented 1 month ago

Thanks for the comments!!!

I'm planning on taking these two, just been sidetracked with other work. I'll try to get a PR posted today.

Okay, I'll add the CI (the way of 1).

so eventually we can probably transition to a Linux runner, but macOS will be easier for now.

Thanks!!! I will use the following link to implement a CI to check doc generation on macos-latest.