├── .prettierignore ├── .github ├── CODEOWNERS ├── FUNDING.yml ├── workflows │ ├── ci-master.yml │ ├── merge.yml │ ├── ci-pr.yml │ ├── ci-base-danger.yml │ ├── ci-base-merge.yml │ ├── report.yml │ ├── ci-base-approve.yml │ ├── metrics.yml │ ├── release.yml │ └── ci-base-build.yml ├── ISSUE_TEMPLATE │ ├── question.md │ ├── bug-report.md │ └── feature-request.md ├── dependabot.yml ├── labels.yml ├── CONTRIBUTING.md └── bump.yml ├── .gitattributes ├── .gitignore ├── Dangerfile ├── .vscode ├── extensions.json └── settings.json ├── Gemfile ├── tsconfig.eslint.json ├── .prettierrc ├── action.yml ├── src ├── json.ts └── main.ts ├── LICENSE ├── __test__ └── main.test.ts ├── package.json ├── eslint.config.mjs ├── README.md ├── tsconfig.json └── dist └── index.js /.prettierignore: -------------------------------------------------------------------------------- 1 | *.md -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @MeilCli -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: MeilCli 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-language=TypeScript -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | eslint_report.json -------------------------------------------------------------------------------- /Dangerfile: -------------------------------------------------------------------------------- 1 | eslint.config_file = ".eslintrc.json" 2 | eslint.target_extensions = [".ts"] 3 | eslint.filtering = true 4 | eslint.lint -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode", "bierner.markdown-preview-github-styles"] 3 | } 4 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source "https://rubygems.org" 4 | 5 | git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } 6 | 7 | gem "danger-eslint" -------------------------------------------------------------------------------- /tsconfig.eslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["src/**/*.ts", "__test__/**/*.test.ts", "eslint.config.mjs"], 4 | "exclude": ["node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /.github/workflows/ci-master.yml: -------------------------------------------------------------------------------- 1 | name: CI-Master 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | build: 10 | uses: ./.github/workflows/ci-base-build.yml 11 | secrets: inherit 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: Question this project, usage .. etc 4 | title: '' 5 | labels: Question 6 | assignees: MeilCli 7 | 8 | --- 9 | 10 | [Please easy english or easy japanese] 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: Bug 6 | assignees: MeilCli 7 | 8 | --- 9 | 10 | [Please easy english or easy japanese] 11 | 12 | ## Description 13 | 14 | ## Environment 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: Feature 6 | assignees: MeilCli 7 | 8 | --- 9 | 10 | [Please easy english or easy japanese] 11 | 12 | ## Feature description 13 | Describe the solution you'd like 14 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 4, 3 | "printWidth": 120, 4 | "semi": true, 5 | "singleQuote": false, 6 | "overrides": [ 7 | { 8 | "files": ["*.yml"], 9 | "options": { 10 | "tabWidth": 2, 11 | "singleQuote": true 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: 'npm' 4 | directory: '/' 5 | schedule: 6 | interval: 'daily' 7 | cooldown: 8 | default-days: 5 9 | reviewers: 10 | - 'MeilCli' 11 | assignees: 12 | - 'MeilCli' 13 | labels: 14 | - 'Dependencies' 15 | open-pull-requests-limit: 20 16 | -------------------------------------------------------------------------------- /.github/workflows/merge.yml: -------------------------------------------------------------------------------- 1 | name: Automerge 2 | 3 | on: 4 | pull_request_review: 5 | types: 6 | - submitted 7 | 8 | jobs: 9 | automerge: 10 | if: github.event.review.state == 'approved' 11 | runs-on: ubuntu-latest 12 | env: 13 | PR_URL: ${{ github.event.pull_request.html_url }} 14 | GITHUB_TOKEN: ${{ secrets.MEILCLI_BOT }} 15 | steps: 16 | - run: gh pr merge --merge --auto "$PR_URL" 17 | -------------------------------------------------------------------------------- /.github/workflows/ci-pr.yml: -------------------------------------------------------------------------------- 1 | name: CI-PR 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | build: 10 | uses: ./.github/workflows/ci-base-build.yml 11 | secrets: inherit 12 | danger: 13 | uses: ./.github/workflows/ci-base-danger.yml 14 | secrets: inherit 15 | approve: 16 | uses: ./.github/workflows/ci-base-approve.yml 17 | secrets: inherit 18 | needs: build 19 | merge: 20 | uses: ./.github/workflows/ci-base-merge.yml 21 | secrets: inherit 22 | needs: build 23 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules/typescript/lib", 3 | "extensions.ignoreRecommendations": false, 4 | "editor.formatOnSave": true, 5 | "editor.codeActionsOnSave": { 6 | "source.fixAll.eslint": "explicit" 7 | }, 8 | "editor.formatOnPaste": true, 9 | "editor.rulers": [120], 10 | "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"], 11 | "[json]": { 12 | "editor.defaultFormatter": "esbenp.prettier-vscode" 13 | }, 14 | "[jsonc]": { 15 | "editor.defaultFormatter": "esbenp.prettier-vscode" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.github/labels.yml: -------------------------------------------------------------------------------- 1 | - name: Action 2 | color: 92efb4 3 | description: '' 4 | - name: BreakingChange 5 | color: db3b4d 6 | description: '' 7 | - name: Bug 8 | color: d73a4a 9 | description: Something isn't working 10 | - name: Dependencies 11 | color: abc43e 12 | description: '' 13 | - name: Development 14 | color: fef2c0 15 | description: '' 16 | - name: Documentation 17 | color: 1d76db 18 | description: '' 19 | - name: Feature 20 | color: a2eeef 21 | description: New feature or request 22 | - name: Maintenance 23 | color: 4d6eb7 24 | description: '' 25 | - name: Question 26 | color: d876e3 27 | description: Further information is requested 28 | -------------------------------------------------------------------------------- /.github/workflows/ci-base-danger.yml: -------------------------------------------------------------------------------- 1 | on: 2 | workflow_call: 3 | 4 | jobs: 5 | danger: 6 | runs-on: ubuntu-latest 7 | if: github.event_name == 'pull_request' 8 | steps: 9 | - uses: actions/checkout@v4 10 | - uses: actions/setup-node@v4 11 | with: 12 | node-version: 20 13 | - uses: ruby/setup-ruby@v1 14 | with: 15 | ruby-version: '2.6' 16 | - name: npm install 17 | run: | 18 | npm install 19 | env: 20 | CI: true 21 | - uses: MeilCli/danger-action@v6 22 | with: 23 | plugins_file: 'Gemfile' 24 | danger_file: 'Dangerfile' 25 | danger_id: 'danger-pr' 26 | env: 27 | DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} 28 | -------------------------------------------------------------------------------- /.github/workflows/ci-base-merge.yml: -------------------------------------------------------------------------------- 1 | on: 2 | workflow_call: 3 | 4 | jobs: 5 | merge: 6 | runs-on: ubuntu-latest 7 | if: github.event_name == 'pull_request' && github.actor == 'MeilCli' 8 | steps: 9 | - run: sleep 10s 10 | name: wait for API&DB synchronized 11 | if: github.event.pull_request.title == 'update actions' 12 | - uses: actions/github-script@v7 13 | if: github.event.pull_request.title == 'update actions' 14 | with: 15 | github-token: ${{ secrets.MEILCLI_BOT }} 16 | script: | 17 | github.rest.pulls.merge( 18 | { 19 | pull_number: context.payload.pull_request.number, 20 | owner: context.repo.owner, 21 | repo: context.repo.repo 22 | } 23 | ) 24 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'npm update checker' 2 | description: 'npm new package version checker' 3 | author: 'MeilCli' 4 | branding: 5 | icon: arrow-up 6 | color: blue 7 | inputs: 8 | execute_directories: 9 | description: 'execute directories of npm outdated command' 10 | depth: 11 | description: 'max depth for checking dependency tree' 12 | output_text_style: 13 | description: 'output text style, value: short or long' 14 | required: true 15 | default: 'short' 16 | outputs: 17 | has_npm_update: 18 | description: 'has new package version information' 19 | npm_update_text: 20 | description: 'new package version information text, styled by output_text_style' 21 | npm_update_json: 22 | description: 'new package version information json' 23 | runs: 24 | using: 'node20' 25 | main: 'dist/index.js' 26 | -------------------------------------------------------------------------------- /.github/workflows/report.yml: -------------------------------------------------------------------------------- 1 | name: Report 2 | 3 | on: 4 | workflow_run: 5 | workflows: ['CI-Master', 'CI-PR'] 6 | types: 7 | - completed 8 | jobs: 9 | lint: 10 | runs-on: ubuntu-latest 11 | if: github.event.workflow_run.conclusion == 'success' 12 | steps: 13 | - run: sleep 10s 14 | name: wait for API&DB synchronized 15 | - name: Download artifact 16 | uses: dawidd6/action-download-artifact@v6 17 | with: 18 | workflow: ci.yml 19 | run_id: ${{ github.event.workflow_run.id }} 20 | name: result 21 | - name: Transform report file 22 | uses: MeilCli/common-lint-reporter/transformer/eslint@v1 23 | with: 24 | report_files: | 25 | eslint_report.json 26 | - name: Report lint result 27 | uses: MeilCli/common-lint-reporter@v1 28 | with: 29 | report_type: 'check_run' 30 | report_name: 'Lint Report' 31 | -------------------------------------------------------------------------------- /.github/workflows/ci-base-approve.yml: -------------------------------------------------------------------------------- 1 | on: 2 | workflow_call: 3 | 4 | jobs: 5 | approve: 6 | runs-on: ubuntu-latest 7 | if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' 8 | steps: 9 | - id: metadata 10 | uses: dependabot/fetch-metadata@v1 11 | with: 12 | github-token: '${{ secrets.GITHUB_TOKEN }}' 13 | - uses: actions/github-script@v7 14 | if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' 15 | with: 16 | github-token: ${{ secrets.MEILCLI_BOT }} 17 | script: | 18 | github.rest.pulls.createReview( 19 | { 20 | pull_number: context.payload.pull_request.number, 21 | owner: context.repo.owner, 22 | repo: context.repo.repo, 23 | event: 'APPROVE' 24 | } 25 | ) 26 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | Thanks for thinking of contributing this repository. 3 | 4 | ## How Can I Contribute? 5 | ### Reporting Issue 6 | If you want report issue, you do not have to think deeply. Let's report according to the prepared Issue Template. 7 | 8 | ### Pull Request 9 | If you found cleary issue solution, please create pull request. In creating pull request, you should use prepared develop environment. 10 | 11 | 1. Download [Visual Studio Code](https://code.visualstudio.com/) 12 | 1. Fork this repository and clone forked repository to your PC 13 | 1. Checkout new branch from master 14 | 1. Open forked repository by Visual Studio Code and install recommendation extensions 15 | - `dbaeumer.vscode-eslint` and `esbenp.prettier-vscode` should be installed, used by format codes 16 | - `bierner.markdown-preview-github-styles` is optional recommendation, used by preview markdown 17 | 1. Writing codes 18 | 1. Do debug build use `npm run build` 19 | 1. Commit and push 20 | - Do not need to run `npm run pack`, because automated by CI 21 | 1. Create Pull Request -------------------------------------------------------------------------------- /src/json.ts: -------------------------------------------------------------------------------- 1 | export interface OutdatedPackage { 2 | readonly name: string; 3 | readonly current: string; 4 | readonly wanted: string; 5 | readonly latest: string; 6 | readonly homepage: string; 7 | } 8 | 9 | export function toOutdatedPackages(value: string): OutdatedPackage[] { 10 | interface Package { 11 | readonly current: string; 12 | readonly wanted: string; 13 | readonly latest: string; 14 | readonly homepage: string; 15 | } 16 | if (value.trim().length == 0) { 17 | return []; 18 | } 19 | 20 | const json = JSON.parse(value); 21 | const map = new Map(); 22 | 23 | Object.keys(json).map((x) => { 24 | map.set(x, json[x] as Package); 25 | }); 26 | 27 | const result: OutdatedPackage[] = []; 28 | map.forEach((value: Package, key: string) => { 29 | result.push({ 30 | name: key, 31 | current: value.current, 32 | wanted: value.wanted, 33 | latest: value.latest, 34 | homepage: value.homepage, 35 | }); 36 | }); 37 | 38 | return result; 39 | } 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-2022 meil 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/workflows/metrics.yml: -------------------------------------------------------------------------------- 1 | name: Metrics 2 | on: 3 | push: { branches: ['master', 'main'] } 4 | jobs: 5 | github-metrics: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: lowlighter/metrics@latest 9 | with: 10 | token: ${{ secrets.METRICS_TOKEN }} 11 | filename: metrics_contributors.svg 12 | repo: npm-update-check-action 13 | template: repository 14 | base: '' 15 | output_action: gist 16 | committer_gist: ${{ secrets.METRICS_GIST }} 17 | plugin_contributors: yes 18 | plugin_contributors_sections: contributors,categories 19 | plugin_contributors_categories: | 20 | { 21 | "📚 Documentation":["**/*.md"], 22 | "💻 Code":["**/*.ts"] 23 | } 24 | 25 | - uses: lowlighter/metrics@latest 26 | with: 27 | token: ${{ secrets.METRICS_TOKEN }} 28 | filename: metrics_licenses.svg 29 | repo: npm-update-check-action 30 | template: repository 31 | base: '' 32 | output_action: gist 33 | committer_gist: ${{ secrets.METRICS_GIST }} 34 | plugin_licenses: yes 35 | plugin_licenses_setup: npm ci 36 | plugin_licenses_ratio: yes 37 | plugin_licenses_legal: yes 38 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | bump: 7 | description: 'bump type, major or minor or patch or empty string' 8 | default: '' 9 | dry_run: 10 | description: 'dry run, true or false' 11 | default: 'false' 12 | draft: 13 | description: 'draft, true or false' 14 | default: 'false' 15 | pre_release: 16 | description: 'pre release, true or false' 17 | default: 'false' 18 | schedule: 19 | # UTC: every 1st and 15th day of month at 9:00 20 | # JST: every 1st and 15th day of month at 0:00 21 | - cron: '0 9 1,15 * *' 22 | 23 | jobs: 24 | release: 25 | runs-on: ubuntu-latest 26 | steps: 27 | - uses: actions/checkout@v4 28 | with: 29 | fetch-depth: 0 30 | - uses: actions/setup-node@v4 31 | with: 32 | node-version: 20 33 | - run: npm install 34 | - run: npm run build 35 | - run: npm run test 36 | - uses: MeilCli/bump-release-action@master 37 | with: 38 | config_path: '.github/bump.yml' 39 | bump: ${{ github.event.inputs.bump }} 40 | dry_run: ${{ github.event.inputs.dry_run }} 41 | draft: ${{ github.event.inputs.draft }} 42 | pre_release: ${{ github.event.inputs.pre_release }} 43 | -------------------------------------------------------------------------------- /.github/workflows/ci-base-build.yml: -------------------------------------------------------------------------------- 1 | on: 2 | workflow_call: 3 | 4 | jobs: 5 | build: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v4 9 | - uses: actions/setup-node@v4 10 | with: 11 | node-version: 20 12 | - uses: actions/cache@v4 13 | with: 14 | path: node_modules 15 | key: ${{ runner.OS }}-build-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }} 16 | restore-keys: | 17 | ${{ runner.OS }}-build-${{ hashFiles('package.json') }}- 18 | ${{ runner.OS }}-build- 19 | - run: npm install 20 | - run: npm run build 21 | - run: npm run test 22 | - run: npm run lint:report 23 | continue-on-error: true 24 | - uses: actions/upload-artifact@v4 25 | with: 26 | name: result 27 | path: | 28 | eslint_report.json 29 | - run: npm run pack 30 | if: github.event_name != 'pull_request' 31 | - name: Create Pull Request 32 | if: github.event_name != 'pull_request' 33 | uses: peter-evans/create-pull-request@v6 34 | with: 35 | token: ${{ secrets.MEILCLI_BOT }} 36 | commit-message: 'update actions' 37 | title: 'update actions' 38 | labels: 'Action' 39 | assignees: 'MeilCli' 40 | branch: 'update/action' 41 | -------------------------------------------------------------------------------- /__test__/main.test.ts: -------------------------------------------------------------------------------- 1 | import { toOutdatedPackages } from "../src/json"; 2 | 3 | test("json parse", () => { 4 | const json = `{ 5 | "@actions/core": { 6 | "current": "1.1.0", 7 | "wanted": "1.1.1", 8 | "latest": "1.1.1", 9 | "location": "node_modules\\\\@actions\\\\core", 10 | "type": "dependencies", 11 | "homepage": "https://github.com/actions/toolkit/tree/master/packages/core" 12 | }, 13 | "@types/node": { 14 | "current": "12.7.5", 15 | "wanted": "12.7.8", 16 | "latest": "12.7.8", 17 | "location": "node_modules\\\\@types\\\\node", 18 | "type": "devDependencies", 19 | "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme" 20 | } 21 | }`; 22 | 23 | const result = toOutdatedPackages(json); 24 | expect(result.length).toBe(2); 25 | 26 | expect(result[0].name).toBe("@actions/core"); 27 | expect(result[0].current).toBe("1.1.0"); 28 | expect(result[0].wanted).toBe("1.1.1"); 29 | expect(result[0].latest).toBe("1.1.1"); 30 | expect(result[0].homepage).toBe("https://github.com/actions/toolkit/tree/master/packages/core"); 31 | 32 | expect(result[1].name).toBe("@types/node"); 33 | expect(result[1].current).toBe("12.7.5"); 34 | expect(result[1].wanted).toBe("12.7.8"); 35 | expect(result[1].latest).toBe("12.7.8"); 36 | expect(result[1].homepage).toBe("https://github.com/DefinitelyTyped/DefinitelyTyped#readme"); 37 | }); 38 | 39 | test("no-value json parse", () => { 40 | const json = ""; 41 | 42 | const result = toOutdatedPackages(json); 43 | expect(result.length).toBe(0); 44 | }); 45 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "npm-update-check-action", 3 | "version": "1.0.0", 4 | "description": "npm package update checker for GitHub actions", 5 | "main": "lib/main.js", 6 | "scripts": { 7 | "build": "tsc", 8 | "pack": "ncc build", 9 | "test": "jest", 10 | "lint": "eslint src/**/*.ts", 11 | "lint:report": "eslint --output-file eslint_report.json --format json src/**/*.ts" 12 | }, 13 | "keywords": [], 14 | "author": "", 15 | "license": "MIT", 16 | "devDependencies": { 17 | "@types/jest": "^29.5.14", 18 | "@types/node": "^20.19.0", 19 | "@typescript-eslint/eslint-plugin": "^8.50.0", 20 | "@typescript-eslint/parser": "^8.50.0", 21 | "@vercel/ncc": "^0.38.4", 22 | "eslint": "^9.39.2", 23 | "eslint-config-prettier": "^10.1.8", 24 | "eslint-plugin-prettier": "^5.5.4", 25 | "jest": "^29.7.0", 26 | "jest-circus": "^29.6.4", 27 | "prettier": "^3.7.4", 28 | "ts-jest": "^29.4.6", 29 | "typescript": "^5.9.3" 30 | }, 31 | "dependencies": { 32 | "@actions/core": "^1.11.1", 33 | "@actions/exec": "^1.1.1", 34 | "@actions/io": "^1.1.3" 35 | }, 36 | "jest": { 37 | "clearMocks": true, 38 | "moduleFileExtensions": [ 39 | "js", 40 | "ts" 41 | ], 42 | "testEnvironment": "node", 43 | "testMatch": [ 44 | "**/*.test.ts" 45 | ], 46 | "testRunner": "jest-circus/runner", 47 | "transform": { 48 | "^.+\\.ts$": "ts-jest" 49 | }, 50 | "verbose": true 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /.github/bump.yml: -------------------------------------------------------------------------------- 1 | release: 2 | title-prefix: 'v' 3 | initial-version: '4.0.0' 4 | tag-prefix: 'v' 5 | commit-note-replacers: 6 | - replace-prefix: 'breaking: ' 7 | new-prefix: '' 8 | - replace-prefix: 'feature: ' 9 | new-prefix: '' 10 | - replace-prefix: 'change: ' 11 | new-prefix: '' 12 | - replace-prefix: 'fix: ' 13 | new-prefix: '' 14 | - replace-prefix: 'document: ' 15 | new-prefix: '' 16 | - replace-prefix: 'dependency: ' 17 | new-prefix: '' 18 | branch: 19 | version-branch-prefix: 'v' 20 | categories: 21 | - title: 'Breaking Changes!' 22 | labels: 23 | - 'BreakingChange' 24 | commits: 25 | - 'breaking:' 26 | changes-prefix: ':warning: ' 27 | - title: 'Changes' 28 | labels: 29 | - 'Feature' 30 | commits: 31 | - 'feature:' 32 | changes-prefix: ':gift: ' 33 | - title: 'Changes' 34 | labels: 35 | - Maintenance 36 | commits: 37 | - 'change:' 38 | changes-prefix: ':hammer: ' 39 | - title: 'Bug Fixes' 40 | labels: 41 | - 'Bug' 42 | commits: 43 | - 'fix:' 44 | changes-prefix: ':ambulance: ' 45 | - title: 'Changes' 46 | labels: 47 | - 'Documentation' 48 | commits: 49 | - 'document:' 50 | changes-prefix: ':blue_book: ' 51 | - title: 'Dependency Updates' 52 | labels: 53 | - 'Dependencies' 54 | skip-label: 'Development' 55 | commits: 56 | - 'dependency:' 57 | changes-prefix: ':green_book: ' 58 | bump: 59 | default: 'patch' 60 | major: 61 | labels: 62 | - 'BreakingChange' 63 | commits: 64 | - 'breaking:' 65 | minor: 66 | labels: 67 | - 'Feature' 68 | commits: 69 | - 'feature:' 70 | -------------------------------------------------------------------------------- /eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import typescriptEslint from "@typescript-eslint/eslint-plugin"; 2 | import globals from "globals"; 3 | import tsParser from "@typescript-eslint/parser"; 4 | import path from "node:path"; 5 | import { fileURLToPath } from "node:url"; 6 | import js from "@eslint/js"; 7 | import { FlatCompat } from "@eslint/eslintrc"; 8 | 9 | const __filename = fileURLToPath(import.meta.url); 10 | const __dirname = path.dirname(__filename); 11 | const compat = new FlatCompat({ 12 | baseDirectory: __dirname, 13 | recommendedConfig: js.configs.recommended, 14 | allConfig: js.configs.all, 15 | }); 16 | 17 | export default [ 18 | ...compat.extends( 19 | "eslint:recommended", 20 | "plugin:@typescript-eslint/eslint-recommended", 21 | "plugin:@typescript-eslint/recommended", 22 | "plugin:prettier/recommended", 23 | "prettier", 24 | ), 25 | { 26 | plugins: { 27 | "@typescript-eslint": typescriptEslint, 28 | }, 29 | 30 | languageOptions: { 31 | globals: { 32 | ...globals.node, 33 | }, 34 | 35 | parser: tsParser, 36 | ecmaVersion: 5, 37 | sourceType: "module", 38 | 39 | parserOptions: { 40 | project: "./tsconfig.eslint.json", 41 | }, 42 | }, 43 | 44 | rules: { 45 | "no-empty-function": "off", 46 | "@typescript-eslint/no-empty-function": ["off"], 47 | "@typescript-eslint/explicit-module-boundary-types": "off", 48 | "@typescript-eslint/explicit-function-return-type": "off", 49 | 50 | "prettier/prettier": [ 51 | "error", 52 | { 53 | tabWidth: 4, 54 | endOfLine: "auto", 55 | }, 56 | ], 57 | }, 58 | }, 59 | ]; 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # npm-update-check-action 2 | [![CI-Master](https://github.com/MeilCli/npm-update-check-action/actions/workflows/ci-master.yml/badge.svg)](https://github.com/MeilCli/npm-update-check-action/actions/workflows/ci-master.yml) 3 | npm new package version check action for GitHub Actions. 4 | 5 | ## Required 6 | This action must execute after `npm install` for your dependencies. 7 | 8 | ## Example 9 | Slack notification example, using [8398a7/action-slack](https://github.com/8398a7/action-slack): 10 | 11 | ```yaml 12 | name: Check Package 13 | 14 | on: 15 | schedule: 16 | - cron: '0 8 * * 5' # every friday AM 8:00 17 | jobs: 18 | npm: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v4 22 | - run: npm install 23 | - uses: MeilCli/npm-update-check-action@v5 24 | id: outdated 25 | - uses: 8398a7/action-slack@v2 26 | if: steps.outdated.outputs.has_npm_update != 'false' 27 | with: 28 | status: ${{ job.status }} 29 | text: ${{ steps.outdated.outputs.npm_update_text }} 30 | author_name: GitHub Actions 31 | env: 32 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 33 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} 34 | ``` 35 | You can also pin to a [specific release](https://github.com/MeilCli/npm-update-check-action/releases) version in the format `@v5.x.x` 36 | 37 | ## input 38 | - `execute_directories` 39 | - optional 40 | - execute directories of npm outdated command 41 | - if multiple directories, write multiline 42 | - `depth` 43 | - optional 44 | - max depth for checking dependency tree 45 | - `output_text_style` 46 | - optional 47 | - output text style 48 | - value: `short` or `long`, default: `short` 49 | 50 | ## output 51 | - `has_npm_update` 52 | - has new package version information 53 | - value: `true` or `false` 54 | - `npm_update_text` 55 | - new package version information text, styled by `output_text_style` 56 | - `npm_update_json` 57 | - new package version information json 58 | 59 | ## Contributes 60 | [](https://github.com/MeilCli/npm-update-check-action/graphs/contributors) 61 | 62 | ### Could you want to contribute? 63 | see [Contributing.md](./.github/CONTRIBUTING.md) 64 | 65 | ## License 66 | [](LICENSE) 67 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { OutdatedPackage, toOutdatedPackages } from "./json"; 2 | import * as core from "@actions/core"; 3 | import * as exec from "@actions/exec"; 4 | import * as io from "@actions/io"; 5 | import * as os from "os"; 6 | import { ExecOptions } from "@actions/exec/lib/interfaces"; 7 | 8 | interface Option { 9 | readonly executeDirectories: string[] | null; 10 | readonly depth: number | null; 11 | readonly outputTextStyle: "short" | "long"; 12 | } 13 | 14 | async function getOption(): Promise