From 99632fcac47210a7eac939ed246aa444a769d53b Mon Sep 17 00:00:00 2001 From: Jason Dent Date: Wed, 14 Feb 2024 12:36:18 +0100 Subject: [PATCH 1/2] chore: cleanup update workflow --- .github/workflows/update-dependencies.yml | 17 ++++++++++------- package.json | 4 ++-- pnpm-lock.yaml | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index 79dfb53..8654b5d 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -41,11 +41,14 @@ jobs: run: | pnpm up - - name: Gen Body - run: | - echo 'git_body<> $GITHUB_ENV - git --no-pager diff --compact-summary >> $GITHUB_ENV - echo 'DIFF' >> $GITHUB_ENV + - name: PR Body + id: body + uses: streetsidesoftware/actions/public/pr-body@v1 + with: + title: 'Workflow Bot -- Update ALL Dependencies (${{ env.REF_BRANCH }})' + path: >- + package.json + README.md - name: PR uses: streetsidesoftware/actions/.github/actions/pr@v1 @@ -53,7 +56,7 @@ jobs: commit-message: '${{ env.PR_TYPE }}: Workflow Bot -- Update ALL Dependencies' branch: ${{ env.NEW_BRANCH }} base: ${{ env.REF_BRANCH }} - title: '${{ env.PR_TYPE }}: Workflow Bot -- Update ALL Dependencies (${{ env.REF_BRANCH }})' - body: ${{ env.git_body }} + title: '${{ env.PR_TYPE }}: ${{ steps.body.outputs.title }}' + body: ${{ steps.body.outputs.body }} app_id: ${{ secrets.AUTOMATION_APP_ID }} app_private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }} diff --git a/package.json b/package.json index 63394dc..7cfc138 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "eslint": "eslint .", "eslint:fix": "eslint . --fix", "spell": "cspell --no-progress .", - "run:samples": "cd samples && pnpm i && pnpm run:samples", + "run:samples": "cd samples && pnpm add .. && pnpm run:samples", "update-readme": "pnpm run:samples && inject-markdown README.md" }, "keywords": [ @@ -32,7 +32,7 @@ "devDependencies": { "@eslint/js": "^8.56.0", "@tsconfig/node18": "^18.2.2", - "@typescript-eslint/eslint-plugin": "^7.0.1", + "@typescript-eslint/eslint-plugin": "^7.0.0", "@typescript-eslint/parser": "^6.21.0", "@vitest/coverage-istanbul": "^1.2.2", "cspell": "^8.3.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9b4c617..187064b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,7 +12,7 @@ devDependencies: specifier: ^18.2.2 version: 18.2.2 '@typescript-eslint/eslint-plugin': - specifier: ^7.0.1 + specifier: ^7.0.0 version: 7.0.1(@typescript-eslint/parser@6.21.0)(eslint@8.56.0)(typescript@5.3.3) '@typescript-eslint/parser': specifier: ^6.21.0 From 32ca92211eda97271dc3d1d42f58f5abbd7bbf2c Mon Sep 17 00:00:00 2001 From: Jason Dent Date: Wed, 14 Feb 2024 13:00:04 +0100 Subject: [PATCH 2/2] Add update readme workflow --- .github/workflows/test.yml | 2 - .github/workflows/update-dependencies.yml | 11 ++++-- .github/workflows/update-lint.yml | 16 ++++---- .github/workflows/update-readme.yml | 46 +++++++++++++++++++++++ .prettierignore | 4 -- samples/histogram.js | 2 + 6 files changed, 64 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/update-readme.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c722b96..d0014a0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,9 +6,7 @@ name: Test on: workflow_dispatch: push: - branches: ['main'] pull_request: - branches: ['main'] jobs: test-node-versions: diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index 8654b5d..e9a322d 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -41,11 +41,16 @@ jobs: run: | pnpm up + - name: Fix Samples + run: | + cd samples + pnpm add .. + - name: PR Body id: body uses: streetsidesoftware/actions/public/pr-body@v1 with: - title: 'Workflow Bot -- Update ALL Dependencies (${{ env.REF_BRANCH }})' + title: 'Workflow Bot -- Update ALL Dependencies' path: >- package.json README.md @@ -53,10 +58,10 @@ jobs: - name: PR uses: streetsidesoftware/actions/.github/actions/pr@v1 with: - commit-message: '${{ env.PR_TYPE }}: Workflow Bot -- Update ALL Dependencies' + commit-message: '${{ env.PR_TYPE }}: ${{ steps.body.outputs.title }}' branch: ${{ env.NEW_BRANCH }} base: ${{ env.REF_BRANCH }} - title: '${{ env.PR_TYPE }}: ${{ steps.body.outputs.title }}' + title: '${{ env.PR_TYPE }}: ${{ steps.body.outputs.title }} (${{ env.REF_BRANCH }})' body: ${{ steps.body.outputs.body }} app_id: ${{ secrets.AUTOMATION_APP_ID }} app_private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }} diff --git a/.github/workflows/update-lint.yml b/.github/workflows/update-lint.yml index 3aae925..813d961 100644 --- a/.github/workflows/update-lint.yml +++ b/.github/workflows/update-lint.yml @@ -28,19 +28,19 @@ jobs: pnpm build pnpm lint:fix - - name: Gen Body - run: | - echo 'git_body<> $GITHUB_ENV - git --no-pager diff --compact-summary >> $GITHUB_ENV - echo 'DIFF' >> $GITHUB_ENV + - name: PR Body + id: body + uses: streetsidesoftware/actions/public/pr-body@v1 + with: + title: 'Workflow Bot -- Fix Lint' - name: PR uses: streetsidesoftware/actions/.github/actions/pr@v1 with: - commit-message: '${{ env.PR_TYPE }}: Workflow Bot -- Fix Lint' + commit-message: '${{ env.PR_TYPE }}: ${{ steps.body.outputs.title }}' branch: ${{ env.NEW_BRANCH }} base: ${{ env.REF_BRANCH }} - title: '${{ env.PR_TYPE }}: Workflow Bot -- Fix Lint (${{ env.REF_BRANCH }})' - body: ${{ env.git_body }} + title: '${{ env.PR_TYPE }}: ${{ steps.body.outputs.title }} (${{ env.REF_BRANCH }})' + body: ${{ steps.body.outputs.body }} app_id: ${{ secrets.AUTOMATION_APP_ID }} app_private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }} diff --git a/.github/workflows/update-readme.yml b/.github/workflows/update-readme.yml new file mode 100644 index 0000000..dccb7b1 --- /dev/null +++ b/.github/workflows/update-readme.yml @@ -0,0 +1,46 @@ +name: ' 📄 Update Readme' + +on: + workflow_dispatch: + inputs: + base: + description: The Base Ref to apply the diff + required: false + default: 'main' + push: + branches: ['main'] + +jobs: + update-readme: + runs-on: ubuntu-latest + env: + NEW_BRANCH: readme-${{ inputs.base || 'main' }} + REF_BRANCH: ${{ inputs.base || 'main' }} + PR_TYPE: ci + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ env.REF_BRANCH }} + - name: Setup + uses: ./.github/actions/setup + - name: Build + run: | + pnpm build + pnpm update-readme + + - name: PR Body + id: body + uses: streetsidesoftware/actions/public/pr-body@v1 + with: + title: 'Workflow Bot -- Update README.md Examples' + + - name: PR + uses: streetsidesoftware/actions/.github/actions/pr@v1 + with: + commit-message: '${{ env.PR_TYPE }}: ${{ steps.body.outputs.title }}' + branch: ${{ env.NEW_BRANCH }} + base: ${{ env.REF_BRANCH }} + title: '${{ env.PR_TYPE }}: ${{ steps.body.outputs.title }} (${{ env.REF_BRANCH }})' + body: ${{ steps.body.outputs.body }} + app_id: ${{ secrets.AUTOMATION_APP_ID }} + app_private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }} diff --git a/.prettierignore b/.prettierignore index da2afe6..899c4fb 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,3 @@ -[sS]amples/ [tT]emp/ **/dist/** **/node_modules/** @@ -8,7 +7,4 @@ **/.docusaurus/** CHANGELOG.md coverage -cspell.json **/*.schema.json -/fixtures-output/** -.release-please-manifest.json diff --git a/samples/histogram.js b/samples/histogram.js index 3ccb5b9..97e9eab 100644 --- a/samples/histogram.js +++ b/samples/histogram.js @@ -4,6 +4,8 @@ const data = [ ['one', 1], ['two', 2], ['three', 3], + ['four', 4], + ['2.5', 2.5], ]; const hist = histogram(data, { width: 40, maxLabelWidth: 5, title: 'Numbers', headers: ['Label', 'Value'] }); console.log(hist);