From d71d141bf4aeb7c3e98e60de652f4eff2d931acd Mon Sep 17 00:00:00 2001 From: Sander Date: Mon, 30 Sep 2024 17:19:42 +0400 Subject: [PATCH 1/4] ci: disable pre-commit hooks during doc gen --- .github/workflows/generate.yml | 120 +++++++++++++++++---------------- 1 file changed, 63 insertions(+), 57 deletions(-) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 88211344b..6015add69 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -9,69 +9,75 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v29 - with: - extra_nix_config: | - access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - - uses: cachix/cachix-action@v15 - with: - name: devenv - - run: nix profile install . -L --accept-flake-config + - uses: cachix/install-nix-action@v29 + with: + extra_nix_config: | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + - uses: cachix/cachix-action@v15 + with: + name: devenv - - name: Generate doc options - run: devenv shell devenv-generate-doc-options - - uses: EndBug/add-and-commit@v9 - if: ${{ github.event_name == 'push' }} - with: - default_author: github_actions - add: docs/reference/options.md - message: 'Auto generate docs/reference/options.md' + - name: Install devenv + run: nix profile install . -L --accept-flake-config - - name: Verify individual docs - run: devenv shell devenv-verify-individual-docs - - uses: EndBug/add-and-commit@v9 - if: ${{ github.event_name == 'push' }} - with: - default_author: github_actions - message: 'Auto generate missing individual markdowns' + - name: Disable pre-commit hooks + run: | + echo '{ pre-commit.default_stages = ["manual"]; }' > devenv.local.nix - - name: Generate docs and supported-languages example - run: | - devenv shell devenv-generate-docs - devenv shell devenv-generate-languages-example - devenv shell devenv-generate-individual-docs - - uses: EndBug/add-and-commit@v9 - if: ${{ github.event_name == 'push' }} - with: - default_author: github_actions - add: docs examples/supported-languages/devenv.nix - message: 'Auto generate docs and examples' + - name: Generate doc options + run: devenv shell devenv-generate-doc-options + - uses: EndBug/add-and-commit@v9 + if: ${{ github.event_name == 'push' }} + with: + default_author: github_actions + add: docs/reference/options.md + message: "Auto generate docs/reference/options.md" - - name: Generate JSON schema - run: devenv generate-json-schema - - uses: EndBug/add-and-commit@v9 - if: ${{ github.event_name == 'push' }} - with: - default_author: github_actions - add: docs/devenv.schema.json - message: 'Auto generate docs/devenv.schema.json' + - name: Verify individual docs + run: devenv shell devenv-verify-individual-docs + - uses: EndBug/add-and-commit@v9 + if: ${{ github.event_name == 'push' }} + with: + default_author: github_actions + message: "Auto generate missing individual markdowns" - - name: Check for uncommitted changes - run: | - diff=$(git diff --stat) - if [[ -n "$diff" ]]; then - message="There are uncommitted doc changes in the repository. + - name: Generate docs and supported-languages example + run: | + devenv shell devenv-generate-docs + devenv shell devenv-generate-languages-example + devenv shell devenv-generate-individual-docs + - uses: EndBug/add-and-commit@v9 + if: ${{ github.event_name == 'push' }} + with: + default_author: github_actions + add: docs examples/supported-languages/devenv.nix + message: "Auto generate docs and examples" - ${diff} + - name: Generate JSON schema + run: devenv generate-json-schema + - uses: EndBug/add-and-commit@v9 + if: ${{ github.event_name == 'push' }} + with: + default_author: github_actions + add: docs/devenv.schema.json + message: "Auto generate docs/devenv.schema.json" - To resolve this, you can: - a. Run the failing devenv-generate-* commands locally and commit the changes. - b. Let CI auto-commit the changes to your fork of the repo. You may need to enable this workflow on your fork." + - name: Check for uncommitted changes + run: | + diff=$(git diff --stat) + if [[ -n "$diff" ]]; then + message="There are uncommitted doc changes in the repository. - echo "::error::${message//$'\n'/%0A}" - exit 1 - else - echo "No uncommitted doc changes found." - fi + ${diff} + + To resolve this, you can: + a. Run the failing devenv-generate-* commands locally and commit the changes. + b. Let CI auto-commit the changes to your fork of the repo. You may need to enable this workflow on your fork." + + echo "::error::${message//$'\n'/%0A}" + exit 1 + else + echo "No uncommitted doc changes found." + fi From a73dfb76383e71099a27d2c2407e7c2d992c91db Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 14:49:54 +0000 Subject: [PATCH 2/4] Auto generate docs/reference/options.md --- docs/reference/options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/options.md b/docs/reference/options.md index a9397ea6e..68c3d4ddd 100644 --- a/docs/reference/options.md +++ b/docs/reference/options.md @@ -3245,7 +3245,7 @@ package *Default:* -` pkgs.nodejs ` +` languages.javascript.package ` *Declared by:* - [https://github.com/cachix/devenv/blob/main/src/modules/languages/javascript.nix](https://github.com/cachix/devenv/blob/main/src/modules/languages/javascript.nix) From 0339d771d1ce7d20bfbf289ba984161b4a0a437a Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 14:52:44 +0000 Subject: [PATCH 3/4] Auto generate missing individual markdowns --- devenv.local.nix | 1 + 1 file changed, 1 insertion(+) create mode 100644 devenv.local.nix diff --git a/devenv.local.nix b/devenv.local.nix new file mode 100644 index 000000000..692e45975 --- /dev/null +++ b/devenv.local.nix @@ -0,0 +1 @@ +{ pre-commit.default_stages = ["manual"]; } From b95ca367fd4a625335e3c4f487f7aac8dd546ab5 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:13:45 +0000 Subject: [PATCH 4/4] Auto generate docs and examples --- docs/supported-languages/javascript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/supported-languages/javascript.md b/docs/supported-languages/javascript.md index 5eb33dcd4..c2c218d0f 100644 --- a/docs/supported-languages/javascript.md +++ b/docs/supported-languages/javascript.md @@ -190,7 +190,7 @@ package *Default:* -` pkgs.nodejs ` +` languages.javascript.package `