diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..9242848 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @smashedr diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..f72beb8 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +ko_fi: cssnr diff --git a/.github/ISSUE_TEMPLATE/0-bug.yaml b/.github/ISSUE_TEMPLATE/0-bug.yaml index 581df1e..bca7768 100644 --- a/.github/ISSUE_TEMPLATE/0-bug.yaml +++ b/.github/ISSUE_TEMPLATE/0-bug.yaml @@ -1,5 +1,5 @@ name: "⚠️ Report an Issue" -description: "Something Not Working Right? Please let us know..." +description: "Please let us know if something is not working right..." labels: ["bug"] assignees: - smashedr @@ -10,17 +10,17 @@ body: validations: required: false attributes: - label: Repo Link - description: Please provide a link to the repository or workflow you are having issues with if possible. + label: URL + description: Please provide a link to the repository or workflow in question if possible. - type: textarea id: description validations: required: true attributes: - label: Details - description: Please describe the issue you are experiencing and how to reproduce. - placeholder: Provide as many details as you can... + label: Issue Description + description: Please describe the issue you are experiencing and how it can be reproduced. + placeholder: Provide as many details as possible... - type: textarea id: logs @@ -29,9 +29,11 @@ body: attributes: label: Log Output description: Paste any relevant logs or output in this box. + placeholder: This text is automatically wrapped in a code block. render: shell - type: markdown attributes: value: | - All issues/bugs that we can verify will be fixed. Thank you for taking the time to make this report! + Any issues or bugs that can be verified will be fixed! + Thank you very much for taking the time to make this report... diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index f4660a7..8a97a99 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,17 +1,17 @@ blank_issues_enabled: true contact_links: - name: "💡 Request a Feature" - about: Request a New Feature or Enhancement in the Discussions. + about: Request a new feature or enhancement in a discussions. url: https://github.com/cssnr/draft-release-action/discussions/new?category=feature-requests - name: "❔ Ask a Question" - about: Ask a General Question or start a Discussions. + about: Ask a general question or start a discussions. url: https://github.com/cssnr/draft-release-action/discussions/new?category=q-a - name: "💬 Join Discord" - about: Chat with us about Issues, Features, Questions and More. + about: Chat with us about general questions, issues or suggestions. url: https://discord.gg/wXy6m2X8wY - name: "📝 Submit Feedback" - about: Send General Feedback. + about: Send general feedback through the website. url: https://cssnr.github.io/feedback diff --git a/.github/workflows/labeler.yaml b/.github/workflows/labeler.yaml new file mode 100644 index 0000000..e2212d8 --- /dev/null +++ b/.github/workflows/labeler.yaml @@ -0,0 +1,47 @@ +name: "PR Labeler" + +on: + pull_request_target: + +permissions: + pull-requests: write + +jobs: + labeler: + name: "Labeler" + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - name: "Checkout Configs" + uses: actions/checkout@v5 + with: + repository: cssnr/configs + ref: master + path: .configs + sparse-checkout-cone-mode: false + sparse-checkout: | + labels/** + + - name: "Debug" + continue-on-error: true + run: | + echo "::group::labels.yaml" + cat .configs/labels/labels.yaml + echo "::endgroup::" + + echo "::group::labeler.yaml" + cat .configs/labels/labeler.yaml + echo "::endgroup::" + + - name: "Label Creator" + continue-on-error: true + uses: cssnr/label-creator-action@master + with: + file: .configs/labels/labels.yaml + + - name: "Labeler" + uses: actions/labeler@v6 + with: + sync-labels: true + configuration-path: .configs/labels/labeler.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index cf2c8e3..e87af07 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -18,22 +18,17 @@ jobs: steps: - name: "Checkout" - uses: actions/checkout@v4 + uses: actions/checkout@v5 - - name: "Debug event.json" - continue-on-error: true - run: | - cat "${GITHUB_EVENT_PATH}" - - - name: "Setup Node 22" - uses: actions/setup-node@v4 + - name: "Setup Node 24" + uses: actions/setup-node@v5 with: - node-version: 22 - #cache: npm + node-version: 24 - name: "Install" + id: install run: | - npm install + npm ci - name: "ESLint" id: eslint @@ -77,73 +72,6 @@ jobs: uses: cssnr/check-build-action@master - name: "ESLint Annotate" - if: ${{ failure() && steps.eslint.outcome != 'success' }} + if: ${{ !cancelled() && steps.eslint.outcome != 'success' }} + continue-on-error: true uses: ataylorme/eslint-annotate-action@v3 - - #- name: "Vale" - # if: ${{ !cancelled() }} - # uses: errata-ai/vale-action@v2.1.1 - - #- name: "SonarQube" - # uses: SonarSource/sonarqube-scan-action@v4 - # env: - # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - #build: - # name: "Build" - # runs-on: ubuntu-latest - # timeout-minutes: 5 - # permissions: - # pull-requests: write - # - # steps: - # - name: "Checkout" - # uses: actions/checkout@v4 - # - # - name: "Debug event.json" - # continue-on-error: true - # run: | - # cat "${GITHUB_EVENT_PATH}" - # - # - name: "Debug" - # continue-on-error: true - # run: | - # echo "github.actor: ${{ github.actor }}" - # echo "github.triggering_actor: ${{ github.triggering_actor }}" - # echo "github.event.pull_request.head.user.login: ${{ github.event.pull_request.head.user.login }}" - # - # - name: "Setup Node 22" - # uses: actions/setup-node@v4 - # with: - # node-version: 22 - # #cache: npm - # - # - name: "Install" - # run: | - # npm install - # - # - name: "Build" - # run: | - # npm run build - # - # - name: "Verify" - # run: | - # git status --porcelain dist/ - # if [ ! -d "dist" ];then - # echo "Missing dist directory; run 'npm run build' then add, commit and push the 'dist' folder." - # exit 1 - # fi - # if [ -n "$(git status --porcelain dist)" ];then - # echo "Build was not run; run 'npm run build' then add, commit and push the 'dist' folder." - # exit 1 - # fi - # - # - name: "Verify Failed" - # if: ${{ failure() && github.event_name == 'pull_request' }} - # env: - # GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # run: | - # echo "Adding comment to PR number: ${{ github.event.number }}" - # comment='@${{ github.triggering_actor }} - run `npm run build` then add, commit and push the `dist` folder.' - # echo "${comment}" - # gh pr comment ${{ github.event.number }} --body "${comment}" diff --git a/.github/workflows/mirror.yaml b/.github/workflows/mirror.yaml index a77edae..00bdae6 100644 --- a/.github/workflows/mirror.yaml +++ b/.github/workflows/mirror.yaml @@ -18,7 +18,7 @@ jobs: steps: - name: "Checkout" - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 @@ -27,6 +27,5 @@ jobs: with: host: https://codeberg.org create: true - owner: "shaner" username: "shaner" password: ${{ secrets.CODEBERG_TOKEN }} diff --git a/.github/workflows/pull.yaml b/.github/workflows/pull.yaml index 870dd48..dbd0036 100644 --- a/.github/workflows/pull.yaml +++ b/.github/workflows/pull.yaml @@ -17,43 +17,8 @@ jobs: steps: - name: "Checkout" - uses: actions/checkout@v4 + uses: actions/checkout@v5 - - name: "Get Commit Action" - id: commit + - name: "NPM Outdated Check" continue-on-error: true - uses: cssnr/get-commit-action@master - with: - sha: ${{ github.event.pull_request.head.sha }} - selector: "commit.message" - - - name: "Debug" - env: - COMMIT_MESSAGE: ${{ steps.commit.outputs.result }} - run: | - echo "COMMIT_MESSAGE: ${COMMIT_MESSAGE}" - echo "${COMMIT_MESSAGE}" | od -c - - #- name: "NPM Outdated Check" - # continue-on-error: true - # uses: cssnr/npm-outdated-action@master - - - name: "ChatGPT CodeReview" - if: ${{ contains(steps.commit.outputs.result, '#gpt') }} - continue-on-error: true - uses: anc95/ChatGPT-CodeReview@main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - LANGUAGE: English - OPENAI_API_ENDPOINT: https://api.openai.com/v1 - MODEL: gpt-4o-mini - PROMPT: | - Check the following code diff for errors and improvements. - Please focus on simple quality responses. - top_p: 1 - temperature: 1 - max_tokens: 10000 - MAX_PATCH_LENGTH: 10000 - IGNORE_PATTERNS: "/node_modules,/dist/" - #INCLUDE_PATTERNS: "**.yaml" + uses: cssnr/npm-outdated-action@master diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 487a507..da8faac 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -4,15 +4,15 @@ on: workflow_dispatch: #schedule: # - cron: "18 18 * * 1,3,5" - push: - branches: ["**"] - paths: - - "dist/**" - - "src/**" - - "package*.json" - - "requirements*.txt" - - ".github/workflows/test.yaml" - - "action.yml" + #push: + # branches: ["**"] + # paths: + # - "dist/**" + # - "src/**" + # - "package*.json" + # - "requirements*.txt" + # - ".github/workflows/test.yaml" + # - "action.yml" concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.prettierrc.json b/.prettierrc.json index 34dae84..4541eb0 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -2,6 +2,7 @@ "trailingComma": "es5", "semi": false, "singleQuote": true, + "printWidth": 90, "overrides": [ { "files": ["**/*.html", "**/*.yaml", "**/*.yml"], @@ -10,7 +11,7 @@ } }, { - "files": ["**/*.js", "**/*.css", "**/*.scss"], + "files": ["**/*.js", "**/*.mjs", "**/*.css", "**/*.scss"], "options": { "tabWidth": 4 } diff --git a/README.md b/README.md index 7dbe39c..aec3f04 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,22 @@ [![GitHub Tag Major](https://img.shields.io/github/v/tag/cssnr/draft-release-action?sort=semver&filter=!v*.*&logo=git&logoColor=white&labelColor=585858&label=%20)](https://github.com/cssnr/draft-release-action/tags) -[![GitHub Tag Minor](https://img.shields.io/github/v/tag/cssnr/draft-release-action?sort=semver&filter=!v*.*.*&logo=git&logoColor=white&labelColor=585858&label=%20)](https://github.com/cssnr/draft-release-action/tags) +[![GitHub Tag Minor](https://img.shields.io/github/v/tag/cssnr/draft-release-action?sort=semver&filter=!v*.*.*&logo=git&logoColor=white&labelColor=585858&label=%20)](https://github.com/cssnr/draft-release-action/releases) [![GitHub Release Version](https://img.shields.io/github/v/release/cssnr/draft-release-action?logo=git&logoColor=white&labelColor=585858&label=%20)](https://github.com/cssnr/draft-release-action/releases/latest) -[![GitHub Dist Size](https://img.shields.io/github/size/cssnr/draft-release-action/dist%2Findex.js?label=dist%20size)](https://github.com/cssnr/draft-release-action/blob/master/src/index.js) -[![Workflow Release](https://img.shields.io/github/actions/workflow/status/cssnr/draft-release-action/release.yaml?logo=github&label=release)](https://github.com/cssnr/draft-release-action/actions/workflows/release.yaml) -[![Workflow Test](https://img.shields.io/github/actions/workflow/status/cssnr/draft-release-action/test.yaml?logo=github&label=test)](https://github.com/cssnr/draft-release-action/actions/workflows/test.yaml) -[![Workflow lint](https://img.shields.io/github/actions/workflow/status/cssnr/draft-release-action/lint.yaml?logo=github&label=lint)](https://github.com/cssnr/draft-release-action/actions/workflows/lint.yaml) +[![GitHub Dist Size](https://img.shields.io/github/size/cssnr/draft-release-action/dist%2Findex.js?logo=bookstack&logoColor=white&label=dist%20size)](https://github.com/cssnr/draft-release-action/blob/master/src/index.js) +[![Workflow Release](https://img.shields.io/github/actions/workflow/status/cssnr/draft-release-action/release.yaml?logo=cachet&label=release)](https://github.com/cssnr/draft-release-action/actions/workflows/release.yaml) +[![Workflow Test](https://img.shields.io/github/actions/workflow/status/cssnr/draft-release-action/test.yaml?logo=cachet&label=test)](https://github.com/cssnr/draft-release-action/actions/workflows/test.yaml) +[![Workflow Lint](https://img.shields.io/github/actions/workflow/status/cssnr/draft-release-action/lint.yaml?logo=cachet&label=lint)](https://github.com/cssnr/draft-release-action/actions/workflows/lint.yaml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=cssnr_draft-release-action&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=cssnr_draft-release-action) -[![GitHub Last Commit](https://img.shields.io/github/last-commit/cssnr/draft-release-action?logo=github&label=updated)](https://github.com/cssnr/draft-release-action/graphs/commit-activity) +[![GitHub Last Commit](https://img.shields.io/github/last-commit/cssnr/draft-release-action?logo=github&label=updated)](https://github.com/cssnr/draft-release-action/pulse) [![Codeberg Last Commit](https://img.shields.io/gitea/last-commit/cssnr/draft-release-action/master?gitea_url=https%3A%2F%2Fcodeberg.org%2F&logo=codeberg&logoColor=white&label=updated)](https://codeberg.org/cssnr/draft-release-action) +[![GitHub Contributors](https://img.shields.io/github/contributors/cssnr/draft-release-action?logo=github)](https://github.com/cssnr/draft-release-action/graphs/contributors) +[![GitHub Repo Size](https://img.shields.io/github/repo-size/cssnr/draft-release-action?logo=bookstack&logoColor=white&label=repo%20size)](https://github.com/cssnr/draft-release-action?tab=readme-ov-file#readme) [![GitHub Top Language](https://img.shields.io/github/languages/top/cssnr/draft-release-action?logo=htmx)](https://github.com/cssnr/draft-release-action) -[![GitHub repo size](https://img.shields.io/github/repo-size/cssnr/draft-release-action?logo=bookstack&logoColor=white&label=repo%20size)](https://github.com/cssnr/draft-release-action) -[![GitHub Discussions](https://img.shields.io/github/discussions/cssnr/draft-release-action)](https://github.com/cssnr/draft-release-action/discussions) [![GitHub Forks](https://img.shields.io/github/forks/cssnr/draft-release-action?style=flat&logo=github)](https://github.com/cssnr/draft-release-action/forks) +[![GitHub Discussions](https://img.shields.io/github/discussions/cssnr/draft-release-action?logo=github)](https://github.com/cssnr/draft-release-action/discussions) [![GitHub Repo Stars](https://img.shields.io/github/stars/cssnr/draft-release-action?style=flat&logo=github)](https://github.com/cssnr/draft-release-action/stargazers) [![GitHub Org Stars](https://img.shields.io/github/stars/cssnr?style=flat&logo=github&label=org%20stars)](https://cssnr.github.io/) [![Discord](https://img.shields.io/discord/899171661457293343?logo=discord&logoColor=white&label=discord&color=7289da)](https://discord.gg/wXy6m2X8wY) +[![Ko-fi](https://img.shields.io/badge/Ko--fi-72a5f2?logo=kofi&label=support)](https://ko-fi.com/cssnr) # Draft Release Action @@ -167,9 +169,12 @@ For more information, see the CSSNR [SUPPORT.md](https://github.com/cssnr/.githu # Contributing -Currently, the best way to contribute to this project is to star this project on GitHub. +Please consider making a donation to support the development of this project +and [additional](https://cssnr.com/) open source projects. -For more information, see the CSSNR [CONTRIBUTING.md](https://github.com/cssnr/.github/blob/master/.github/CONTRIBUTING.md#contributing). +[![Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/cssnr) + +If you would like to submit a PR, please review the [CONTRIBUTING.md](#contributing-ov-file). Additionally, you can support other GitHub Actions I have published: @@ -185,5 +190,8 @@ Additionally, you can support other GitHub Actions I have published: - [Docker Tags Action](https://github.com/cssnr/docker-tags-action?tab=readme-ov-file#readme) - [Package Changelog Action](https://github.com/cssnr/package-changelog-action?tab=readme-ov-file#readme) - [NPM Outdated Check Action](https://github.com/cssnr/npm-outdated-action?tab=readme-ov-file#readme) +- [Label Creator Action](https://github.com/cssnr/label-creator-action?tab=readme-ov-file#readme) +- [Algolia Crawler Action](https://github.com/cssnr/algolia-crawler-action?tab=readme-ov-file#readme) +- [Upload Release Action](https://github.com/cssnr/upload-release-action?tab=readme-ov-file#readme) -For a full list of current projects to support visit: [https://cssnr.github.io/](https://cssnr.github.io/) +For a full list of current projects visit: [https://cssnr.github.io/](https://cssnr.github.io/) diff --git a/dist/index.js b/dist/index.js index 21fdc8a..20f919a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1882,6 +1882,7 @@ class Context { this.action = process.env.GITHUB_ACTION; this.actor = process.env.GITHUB_ACTOR; this.job = process.env.GITHUB_JOB; + this.runAttempt = parseInt(process.env.GITHUB_RUN_ATTEMPT, 10); this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10); this.runId = parseInt(process.env.GITHUB_RUN_ID, 10); this.apiUrl = (_a = process.env.GITHUB_API_URL) !== null && _a !== void 0 ? _a : `https://api.github.com`; @@ -3569,13 +3570,28 @@ var import_graphql = __nccwpck_require__(7); var import_auth_token = __nccwpck_require__(7864); // pkg/dist-src/version.js -var VERSION = "5.2.1"; +var VERSION = "5.2.2"; // pkg/dist-src/index.js var noop = () => { }; var consoleWarn = console.warn.bind(console); var consoleError = console.error.bind(console); +function createLogger(logger = {}) { + if (typeof logger.debug !== "function") { + logger.debug = noop; + } + if (typeof logger.info !== "function") { + logger.info = noop; + } + if (typeof logger.warn !== "function") { + logger.warn = consoleWarn; + } + if (typeof logger.error !== "function") { + logger.error = consoleError; + } + return logger; +} var userAgentTrail = `octokit-core.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`; var Octokit = class { static { @@ -3649,15 +3665,7 @@ var Octokit = class { } this.request = import_request.request.defaults(requestDefaults); this.graphql = (0, import_graphql.withCustomRequest)(this.request).defaults(requestDefaults); - this.log = Object.assign( - { - debug: noop, - info: noop, - warn: consoleWarn, - error: consoleError - }, - options.log - ); + this.log = createLogger(options.log); this.hook = hook; if (!options.authStrategy) { if (!options.auth) { @@ -7403,6 +7411,9 @@ function onceStrict (fn) { /***/ 9379: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const ANY = Symbol('SemVer ANY') // hoisted class for cyclic dependency class Comparator { @@ -7551,6 +7562,9 @@ const Range = __nccwpck_require__(6782) /***/ 6782: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const SPACE_CHARACTERS = /\s+/g // hoisted class for cyclic dependency @@ -8112,9 +8126,12 @@ const testSet = (set, version, options) => { /***/ 7163: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const debug = __nccwpck_require__(1159) const { MAX_LENGTH, MAX_SAFE_INTEGER } = __nccwpck_require__(5101) -const { safeRe: re, safeSrc: src, t } = __nccwpck_require__(5471) +const { safeRe: re, t } = __nccwpck_require__(5471) const parseOptions = __nccwpck_require__(356) const { compareIdentifiers } = __nccwpck_require__(3348) @@ -8296,8 +8313,7 @@ class SemVer { } // Avoid an invalid semver results if (identifier) { - const r = new RegExp(`^${this.options.loose ? src[t.PRERELEASELOOSE] : src[t.PRERELEASE]}$`) - const match = `-${identifier}`.match(r) + const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]) if (!match || match[1] !== identifier) { throw new Error(`invalid identifier: ${identifier}`) } @@ -8437,6 +8453,9 @@ module.exports = SemVer /***/ 1799: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const parse = __nccwpck_require__(6353) const clean = (version, options) => { const s = parse(version.trim().replace(/^[=v]+/, ''), options) @@ -8450,6 +8469,9 @@ module.exports = clean /***/ 8646: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const eq = __nccwpck_require__(5082) const neq = __nccwpck_require__(4974) const gt = __nccwpck_require__(6599) @@ -8509,6 +8531,9 @@ module.exports = cmp /***/ 5385: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const SemVer = __nccwpck_require__(7163) const parse = __nccwpck_require__(6353) const { safeRe: re, t } = __nccwpck_require__(5471) @@ -8576,6 +8601,9 @@ module.exports = coerce /***/ 7648: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const SemVer = __nccwpck_require__(7163) const compareBuild = (a, b, loose) => { const versionA = new SemVer(a, loose) @@ -8590,6 +8618,9 @@ module.exports = compareBuild /***/ 6874: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const compare = __nccwpck_require__(8469) const compareLoose = (a, b) => compare(a, b, true) module.exports = compareLoose @@ -8600,6 +8631,9 @@ module.exports = compareLoose /***/ 8469: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const SemVer = __nccwpck_require__(7163) const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose)) @@ -8612,6 +8646,9 @@ module.exports = compare /***/ 711: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const parse = __nccwpck_require__(6353) const diff = (version1, version2) => { @@ -8677,6 +8714,9 @@ module.exports = diff /***/ 5082: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const compare = __nccwpck_require__(8469) const eq = (a, b, loose) => compare(a, b, loose) === 0 module.exports = eq @@ -8687,6 +8727,9 @@ module.exports = eq /***/ 6599: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const compare = __nccwpck_require__(8469) const gt = (a, b, loose) => compare(a, b, loose) > 0 module.exports = gt @@ -8697,6 +8740,9 @@ module.exports = gt /***/ 1236: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const compare = __nccwpck_require__(8469) const gte = (a, b, loose) => compare(a, b, loose) >= 0 module.exports = gte @@ -8707,6 +8753,9 @@ module.exports = gte /***/ 2338: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const SemVer = __nccwpck_require__(7163) const inc = (version, release, options, identifier, identifierBase) => { @@ -8733,6 +8782,9 @@ module.exports = inc /***/ 3872: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const compare = __nccwpck_require__(8469) const lt = (a, b, loose) => compare(a, b, loose) < 0 module.exports = lt @@ -8743,6 +8795,9 @@ module.exports = lt /***/ 6717: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const compare = __nccwpck_require__(8469) const lte = (a, b, loose) => compare(a, b, loose) <= 0 module.exports = lte @@ -8753,6 +8808,9 @@ module.exports = lte /***/ 8511: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const SemVer = __nccwpck_require__(7163) const major = (a, loose) => new SemVer(a, loose).major module.exports = major @@ -8763,6 +8821,9 @@ module.exports = major /***/ 2603: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const SemVer = __nccwpck_require__(7163) const minor = (a, loose) => new SemVer(a, loose).minor module.exports = minor @@ -8773,6 +8834,9 @@ module.exports = minor /***/ 4974: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const compare = __nccwpck_require__(8469) const neq = (a, b, loose) => compare(a, b, loose) !== 0 module.exports = neq @@ -8783,6 +8847,9 @@ module.exports = neq /***/ 6353: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const SemVer = __nccwpck_require__(7163) const parse = (version, options, throwErrors = false) => { if (version instanceof SemVer) { @@ -8806,6 +8873,9 @@ module.exports = parse /***/ 8756: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const SemVer = __nccwpck_require__(7163) const patch = (a, loose) => new SemVer(a, loose).patch module.exports = patch @@ -8816,6 +8886,9 @@ module.exports = patch /***/ 5714: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const parse = __nccwpck_require__(6353) const prerelease = (version, options) => { const parsed = parse(version, options) @@ -8829,6 +8902,9 @@ module.exports = prerelease /***/ 2173: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const compare = __nccwpck_require__(8469) const rcompare = (a, b, loose) => compare(b, a, loose) module.exports = rcompare @@ -8839,6 +8915,9 @@ module.exports = rcompare /***/ 7192: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const compareBuild = __nccwpck_require__(7648) const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) module.exports = rsort @@ -8849,6 +8928,9 @@ module.exports = rsort /***/ 8011: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const Range = __nccwpck_require__(6782) const satisfies = (version, range, options) => { try { @@ -8866,6 +8948,9 @@ module.exports = satisfies /***/ 9872: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const compareBuild = __nccwpck_require__(7648) const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) module.exports = sort @@ -8876,6 +8961,9 @@ module.exports = sort /***/ 8780: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const parse = __nccwpck_require__(6353) const valid = (version, options) => { const v = parse(version, options) @@ -8889,6 +8977,9 @@ module.exports = valid /***/ 2088: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + // just pre-load all the stuff that index.js lazily exports const internalRe = __nccwpck_require__(5471) const constants = __nccwpck_require__(5101) @@ -8985,6 +9076,9 @@ module.exports = { /***/ 5101: /***/ ((module) => { +"use strict"; + + // Note: this is the semver.org version of the spec that it implements // Not necessarily the package version of this code. const SEMVER_SPEC_VERSION = '2.0.0' @@ -9027,6 +9121,9 @@ module.exports = { /***/ 1159: /***/ ((module) => { +"use strict"; + + const debug = ( typeof process === 'object' && process.env && @@ -9043,6 +9140,9 @@ module.exports = debug /***/ 3348: /***/ ((module) => { +"use strict"; + + const numeric = /^[0-9]+$/ const compareIdentifiers = (a, b) => { const anum = numeric.test(a) @@ -9073,6 +9173,9 @@ module.exports = { /***/ 1383: /***/ ((module) => { +"use strict"; + + class LRUCache { constructor () { this.max = 1000 @@ -9120,6 +9223,9 @@ module.exports = LRUCache /***/ 356: /***/ ((module) => { +"use strict"; + + // parse out just the options we care about const looseOption = Object.freeze({ loose: true }) const emptyOpts = Object.freeze({ }) @@ -9142,6 +9248,9 @@ module.exports = parseOptions /***/ 5471: /***/ ((module, exports, __nccwpck_require__) => { +"use strict"; + + const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, @@ -9220,12 +9329,14 @@ createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + // ## Pre-release Version Identifier // A numeric identifier, or a non-numeric identifier. +// Non-numberic identifiers include numberic identifiers but can be longer. +// Therefore non-numberic identifiers must go first. -createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] -}|${src[t.NONNUMERICIDENTIFIER]})`) +createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER] +}|${src[t.NUMERICIDENTIFIER]})`) -createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] -}|${src[t.NONNUMERICIDENTIFIER]})`) +createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER] +}|${src[t.NUMERICIDENTIFIERLOOSE]})`) // ## Pre-release Version // Hyphen, followed by one or more dot-separated pre-release version @@ -9368,6 +9479,9 @@ createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$') /***/ 2276: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + // Determine if version is greater than all the versions possible in the range. const outside = __nccwpck_require__(280) const gtr = (version, range, options) => outside(version, range, '>', options) @@ -9379,6 +9493,9 @@ module.exports = gtr /***/ 3465: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const Range = __nccwpck_require__(6782) const intersects = (r1, r2, options) => { r1 = new Range(r1, options) @@ -9393,6 +9510,9 @@ module.exports = intersects /***/ 5213: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const outside = __nccwpck_require__(280) // Determine if version is less than all the versions possible in the range const ltr = (version, range, options) => outside(version, range, '<', options) @@ -9404,6 +9524,9 @@ module.exports = ltr /***/ 5574: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const SemVer = __nccwpck_require__(7163) const Range = __nccwpck_require__(6782) @@ -9436,6 +9559,9 @@ module.exports = maxSatisfying /***/ 8595: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const SemVer = __nccwpck_require__(7163) const Range = __nccwpck_require__(6782) const minSatisfying = (versions, range, options) => { @@ -9467,6 +9593,9 @@ module.exports = minSatisfying /***/ 1866: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const SemVer = __nccwpck_require__(7163) const Range = __nccwpck_require__(6782) const gt = __nccwpck_require__(6599) @@ -9535,6 +9664,9 @@ module.exports = minVersion /***/ 280: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const SemVer = __nccwpck_require__(7163) const Comparator = __nccwpck_require__(9379) const { ANY } = Comparator @@ -9622,6 +9754,9 @@ module.exports = outside /***/ 2028: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + // given a set of versions and a range, create a "simplified" range // that includes the same versions that the original range does // If the original range is shorter than the simplified one, return that. @@ -9676,6 +9811,9 @@ module.exports = (versions, range, options) => { /***/ 1489: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const Range = __nccwpck_require__(6782) const Comparator = __nccwpck_require__(9379) const { ANY } = Comparator @@ -9930,6 +10068,9 @@ module.exports = subset /***/ 4750: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const Range = __nccwpck_require__(6782) // Mostly just for testing and legacy API reasons @@ -9945,6 +10086,9 @@ module.exports = toComparators /***/ 4737: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + + const Range = __nccwpck_require__(6782) const validRange = (range, options) => { try { @@ -34412,14 +34556,14 @@ const script_id = '' console.log('github.context.ref:', github.context.ref) core.endGroup() // Debug - // Config - const config = getConfig() - core.startGroup('Config') - console.log(config) - core.endGroup() // Config + // Inputs + const inputs = getInputs() + core.startGroup('Inputs') + console.log(inputs) + core.endGroup() // Inputs // Process - const response = await processRelease(config) + const response = await processRelease(inputs) core.startGroup('Response') console.log(response) core.endGroup() // Response @@ -34430,10 +34574,10 @@ const script_id = '' core.setOutput('url', response.data.html_url) // Summary - if (config.summary) { + if (inputs.summary) { core.info('📝 Writing Job Summary') try { - await addSummary(config, response) + await addSummary(inputs, response) } catch (e) { console.log(e) core.error(`Error writing Job Summary ${e.message}`) @@ -34450,11 +34594,11 @@ const script_id = '' /** * Process Release - * @param {Config} config + * @param {Inputs} inputs * @return {Promise} */ -async function processRelease(config) { - const octokit = github.getOctokit(config.token) +async function processRelease(inputs) { + const octokit = github.getOctokit(inputs.token) // TODO: Get more than 2 releases and process all drafts... const releases = await octokit.rest.repos.listReleases({ ...github.context.repo, @@ -34474,11 +34618,7 @@ async function processRelease(config) { console.log('latest.tag_name:', latest?.tag_name) console.log('previous.tag_name:', previous?.tag_name) // if (latest.draft && latest.body.includes(script_id)) { - if ( - latest.draft && - latest.author.id === bot_id && - latest.body.includes(script_id) - ) { + if (latest.draft && latest.author.id === bot_id && latest.body.includes(script_id)) { core.info(`⛔ Deleting Latest Draft: \u001b[31;1m${latest.tag_name}`) const response = await octokit.rest.repos.deleteRelease({ ...github.context.repo, @@ -34488,15 +34628,9 @@ async function processRelease(config) { latest = previous } - const tag_name = semver.inc( - latest.tag_name, - config.semver, - config.identifier - ) + const tag_name = semver.inc(latest.tag_name, inputs.semver, inputs.identifier) if (!tag_name) { - throw new Error( - `Unable to parse ${config.semver} from ${latest.tag_name}` - ) + throw new Error(`Unable to parse ${inputs.semver} from ${latest.tag_name}`) } core.info(`Creating New Draft: \u001b[33;1m${tag_name}`) @@ -34504,7 +34638,7 @@ async function processRelease(config) { ...github.context.repo, tag_name, draft: true, - prerelease: config.prerelease, + prerelease: inputs.prerelease, generate_release_notes: true, body: `\n\n\n\n${script_id}`, }) @@ -34514,11 +34648,11 @@ async function processRelease(config) { /** * Add Summary - * @param {Config} config + * @param {Inputs} inputs * @param {Object} response * @return {Promise} */ -async function addSummary(config, response) { +async function addSummary(inputs, response) { core.summary.addRaw('## Draft Release Action\n\n') console.log('response.status:', response.status) const result = response.status @@ -34528,11 +34662,11 @@ async function addSummary(config, response) { `${result} \`${response.data.tag_name}\`.\n\n${response.data.html_url}\n\n` ) - delete config.token - const yaml = Object.entries(config) + delete inputs.token + const yaml = Object.entries(inputs) .map(([k, v]) => `${k}: ${JSON.stringify(v)}`) .join('\n') - core.summary.addRaw('
Config') + core.summary.addRaw('
Inputs') core.summary.addCodeBlock(yaml, 'yaml') core.summary.addRaw('
\n') @@ -34543,16 +34677,16 @@ async function addSummary(config, response) { } /** - * Get Config - * @typedef {Object} Config + * Get Inputs + * @typedef {Object} Inputs * @property {String} semver * @property {String} identifier * @property {Boolean} prerelease * @property {Boolean} summary * @property {String} token - * @return {Config} + * @return {Inputs} */ -function getConfig() { +function getInputs() { return { semver: core.getInput('semver', { required: true }), identifier: core.getInput('identifier'), diff --git a/eslint.config.mjs b/eslint.config.mjs index f4edbec..74cf080 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,23 +1,21 @@ import js from '@eslint/js' export default [ - js.configs.recommended, - { - languageOptions: { - ecmaVersion: 'latest', - sourceType: 'module', + js.configs.recommended, + { + languageOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + }, + settings: { + env: { + node: true, + es2021: true, + }, + }, + rules: { + 'no-undef': 'off', + 'no-extra-semi': 'off', + }, }, - settings: { - env: { - browser: true, - es2021: true, - jquery: true, - webextensions: true, - }, - }, - rules: { - 'no-undef': 'off', - 'no-extra-semi': 'off', - }, - }, ] diff --git a/package-lock.json b/package-lock.json index 1078f85..0c89562 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,14 +7,14 @@ "name": "draft-release-action", "dependencies": { "@actions/core": "^1.11.1", - "@actions/github": "^6.0.0", - "semver": "^7.7.1" + "@actions/github": "^6.0.1", + "semver": "^7.7.2" }, "devDependencies": { - "@eslint/js": "^9.23.0", - "@vercel/ncc": "^0.38.3", - "eslint": "^9.23.0", - "prettier": "^3.5.3" + "@eslint/js": "^9.36.0", + "@vercel/ncc": "^0.38.4", + "eslint": "^9.36.0", + "prettier": "^3.6.2" } }, "node_modules/@actions/core": { @@ -37,15 +37,18 @@ } }, "node_modules/@actions/github": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz", - "integrity": "sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.1.tgz", + "integrity": "sha512-xbZVcaqD4XnQAe35qSQqskb3SqIAfRyLBrHMd/8TuL7hJSz2QtbDwnNM8zWx4zO5l2fnGtseNE3MbEvD7BxVMw==", "license": "MIT", "dependencies": { "@actions/http-client": "^2.2.0", "@octokit/core": "^5.0.1", - "@octokit/plugin-paginate-rest": "^9.0.0", - "@octokit/plugin-rest-endpoint-methods": "^10.0.0" + "@octokit/plugin-paginate-rest": "^9.2.2", + "@octokit/plugin-rest-endpoint-methods": "^10.4.0", + "@octokit/request": "^8.4.1", + "@octokit/request-error": "^5.1.1", + "undici": "^5.28.5" } }, "node_modules/@actions/http-client": { @@ -65,9 +68,9 @@ "license": "MIT" }, "node_modules/@eslint-community/eslint-utils": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.5.1.tgz", - "integrity": "sha512-soEIOALTfTK6EjmKMMoLugwaP0rzkad90iIWd1hMO9ARkSAyjfMfkRRhLvD5qH7vvM0Cg72pieUfR6yh6XxC4w==", + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz", + "integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==", "dev": true, "license": "MIT", "dependencies": { @@ -107,9 +110,9 @@ } }, "node_modules/@eslint/config-array": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.2.tgz", - "integrity": "sha512-GNKqxfHG2ySmJOBSHg7LxeUx4xpuCoFjacmlCoYWEbaPXLwvfIjixRI12xCQZeULksQb23uiA8F40w5TojpV7w==", + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.0.tgz", + "integrity": "sha512-ENIdc4iLu0d93HeYirvKmrzshzofPw6VkZRKQGe9Nv46ZnWUzcF1xV01dcvEg/1wXUR61OmmlSfyeyO7EvjLxQ==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -122,9 +125,9 @@ } }, "node_modules/@eslint/config-helpers": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.2.0.tgz", - "integrity": "sha512-yJLLmLexii32mGrhW29qvU3QBVTu0GUmEf/J4XsBtVhp4JkIUFN/BjWqTF63yRvGApIDpZm5fa97LtYtINmfeQ==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.3.1.tgz", + "integrity": "sha512-xR93k9WhrDYpXHORXpxVL5oHj3Era7wo6k/Wd8/IsQNnZUTzkGS29lyn3nAT05v6ltUuTFVCCYDEGfy2Or/sPA==", "dev": true, "license": "Apache-2.0", "engines": { @@ -132,9 +135,9 @@ } }, "node_modules/@eslint/core": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.12.0.tgz", - "integrity": "sha512-cmrR6pytBuSMTaBweKoGMwu3EiHiEC+DoyupPmlZ0HxBJBtIxwe+j/E4XPIKNx+Q74c8lXKPwYawBf5glsTkHg==", + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.15.2.tgz", + "integrity": "sha512-78Md3/Rrxh83gCxoUc0EiciuOHsIITzLy53m3d9UyiW8y9Dj2D29FeETqyKA+BRK76tnTp6RXWb3pCay8Oyomg==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -169,13 +172,16 @@ } }, "node_modules/@eslint/js": { - "version": "9.23.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.23.0.tgz", - "integrity": "sha512-35MJ8vCPU0ZMxo7zfev2pypqTwWTofFZO6m4KAtdoFhRpLJUpHTZZ+KB3C7Hb1d7bULYwO4lJXGCi5Se+8OMbw==", + "version": "9.36.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.36.0.tgz", + "integrity": "sha512-uhCbYtYynH30iZErszX78U+nR3pJU3RHGQ57NXy5QupD4SBVwDeU8TNBy+MjMngc1UyIW9noKqsRqfjQTBU2dw==", "dev": true, "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" } }, "node_modules/@eslint/object-schema": { @@ -189,13 +195,13 @@ } }, "node_modules/@eslint/plugin-kit": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.7.tgz", - "integrity": "sha512-JubJ5B2pJ4k4yGxaNLdbjrnk9d/iDz6/q8wOilpIowd6PJPgaxCuHBnBszq7Ce2TyMrywm5r4PnKm6V3iiZF+g==", + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.5.tgz", + "integrity": "sha512-Z5kJ+wU3oA7MMIqVR9tyZRtjYPr4OC004Q4Rw7pgOKUOKkJfZ3O24nz3WYfGRpMDNmcOi3TwQOmgm7B7Tpii0w==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@eslint/core": "^0.12.0", + "@eslint/core": "^0.15.2", "levn": "^0.4.1" }, "engines": { @@ -222,33 +228,19 @@ } }, "node_modules/@humanfs/node": { - "version": "0.16.6", - "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", - "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "version": "0.16.7", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz", + "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==", "dev": true, "license": "Apache-2.0", "dependencies": { "@humanfs/core": "^0.19.1", - "@humanwhocodes/retry": "^0.3.0" + "@humanwhocodes/retry": "^0.4.0" }, "engines": { "node": ">=18.18.0" } }, - "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", - "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=18.18" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -264,9 +256,9 @@ } }, "node_modules/@humanwhocodes/retry": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.2.tgz", - "integrity": "sha512-xeO57FpIu4p1Ri3Jq/EXq4ClRm86dVF2z/+kvFnyqVYRavTZmaFaUBbWCOuuTh0o/g7DSsk6kc2vrS4Vl5oPOQ==", + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", "dev": true, "license": "Apache-2.0", "engines": { @@ -287,9 +279,9 @@ } }, "node_modules/@octokit/core": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.1.tgz", - "integrity": "sha512-dKYCMuPO1bmrpuogcjQ8z7ICCH3FP6WmxpwC03yjzGfZhj9fTJg6+bS1+UAplekbN2C+M61UNllGOOoAfGCrdQ==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.2.tgz", + "integrity": "sha512-/g2d4sW9nUDJOMz3mabVQvOGhVa4e/BN/Um7yca9Bb2XTzPPnfTWHWQg+IsEYO7M3Vx+EXvaM/I2pJWIMun1bg==", "license": "MIT", "dependencies": { "@octokit/auth-token": "^4.0.0", @@ -436,9 +428,9 @@ } }, "node_modules/@types/estree": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", - "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", "dev": true, "license": "MIT" }, @@ -450,9 +442,9 @@ "license": "MIT" }, "node_modules/@vercel/ncc": { - "version": "0.38.3", - "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.3.tgz", - "integrity": "sha512-rnK6hJBS6mwc+Bkab+PGPs9OiS0i/3kdTO+CkI8V0/VrW3vmz7O2Pxjw/owOlmo6PKEIxRSeZKv/kuL9itnpYA==", + "version": "0.38.4", + "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.4.tgz", + "integrity": "sha512-8LwjnlP39s08C08J5NstzriPvW1SP8Zfpp1BvC2sI35kPeZnHfxVkCwu4/+Wodgnd60UtT1n8K8zw+Mp7J9JmQ==", "dev": true, "license": "MIT", "bin": { @@ -460,9 +452,9 @@ } }, "node_modules/acorn": { - "version": "8.14.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", - "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", "bin": { @@ -536,9 +528,9 @@ "license": "Apache-2.0" }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, "license": "MIT", "dependencies": { @@ -616,9 +608,9 @@ } }, "node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", "dev": true, "license": "MIT", "dependencies": { @@ -660,20 +652,20 @@ } }, "node_modules/eslint": { - "version": "9.23.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.23.0.tgz", - "integrity": "sha512-jV7AbNoFPAY1EkFYpLq5bslU9NLNO8xnEeQXwErNibVryjk67wHVmddTBilc5srIttJDBrB0eMHKZBFbSIABCw==", + "version": "9.36.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.36.0.tgz", + "integrity": "sha512-hB4FIzXovouYzwzECDcUkJ4OcfOEkXTv2zRY6B9bkwjx/cprAq0uvm1nl7zvQ0/TsUk0zQiN4uPfJpB9m+rPMQ==", "dev": true, "license": "MIT", "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.19.2", - "@eslint/config-helpers": "^0.2.0", - "@eslint/core": "^0.12.0", + "@eslint/config-array": "^0.21.0", + "@eslint/config-helpers": "^0.3.1", + "@eslint/core": "^0.15.2", "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "9.23.0", - "@eslint/plugin-kit": "^0.2.7", + "@eslint/js": "9.36.0", + "@eslint/plugin-kit": "^0.3.5", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", @@ -684,9 +676,9 @@ "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^8.3.0", - "eslint-visitor-keys": "^4.2.0", - "espree": "^10.3.0", + "eslint-scope": "^8.4.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -721,9 +713,9 @@ } }, "node_modules/eslint-scope": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.3.0.tgz", - "integrity": "sha512-pUNxi75F8MJ/GdeKtVLSbYg4ZI34J6C0C7sbL4YOp2exGwen7ZsuBqKzUhXd0qMQ362yET3z+uPwKeg/0C2XCQ==", + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", "dev": true, "license": "BSD-2-Clause", "dependencies": { @@ -738,9 +730,9 @@ } }, "node_modules/eslint-visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", - "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", "dev": true, "license": "Apache-2.0", "engines": { @@ -751,15 +743,15 @@ } }, "node_modules/espree": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", - "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "acorn": "^8.14.0", + "acorn": "^8.15.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.2.0" + "eslint-visitor-keys": "^4.2.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1200,9 +1192,9 @@ } }, "node_modules/prettier": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz", - "integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz", + "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==", "dev": true, "license": "MIT", "bin": { @@ -1236,9 +1228,9 @@ } }, "node_modules/semver": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", - "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", "license": "ISC", "bin": { "semver": "bin/semver.js" diff --git a/package.json b/package.json index 2cc07e0..b8264fa 100644 --- a/package.json +++ b/package.json @@ -6,18 +6,18 @@ "build:watch": "npm run build -- --watch", "lint": "npx eslint src", "lint:report": "npm run lint -- --output-file eslint_report.json --format json", - "prettier": "npx prettier --write .", - "prettier:check": "npx prettier --check ." + "prettier:check": "npx prettier --check .", + "prettier:write": "npx prettier --write ." }, "dependencies": { "@actions/core": "^1.11.1", - "@actions/github": "^6.0.0", - "semver": "^7.7.1" + "@actions/github": "^6.0.1", + "semver": "^7.7.2" }, "devDependencies": { - "@eslint/js": "^9.23.0", - "@vercel/ncc": "^0.38.3", - "eslint": "^9.23.0", - "prettier": "^3.5.3" + "@eslint/js": "^9.36.0", + "@vercel/ncc": "^0.38.4", + "eslint": "^9.36.0", + "prettier": "^3.6.2" } } diff --git a/src/index.js b/src/index.js index 7b50640..a2d02ec 100644 --- a/src/index.js +++ b/src/index.js @@ -24,14 +24,14 @@ const script_id = '' console.log('github.context.ref:', github.context.ref) core.endGroup() // Debug - // Config - const config = getConfig() - core.startGroup('Config') - console.log(config) - core.endGroup() // Config + // Inputs + const inputs = getInputs() + core.startGroup('Inputs') + console.log(inputs) + core.endGroup() // Inputs // Process - const response = await processRelease(config) + const response = await processRelease(inputs) core.startGroup('Response') console.log(response) core.endGroup() // Response @@ -42,10 +42,10 @@ const script_id = '' core.setOutput('url', response.data.html_url) // Summary - if (config.summary) { + if (inputs.summary) { core.info('📝 Writing Job Summary') try { - await addSummary(config, response) + await addSummary(inputs, response) } catch (e) { console.log(e) core.error(`Error writing Job Summary ${e.message}`) @@ -62,11 +62,11 @@ const script_id = '' /** * Process Release - * @param {Config} config + * @param {Inputs} inputs * @return {Promise} */ -async function processRelease(config) { - const octokit = github.getOctokit(config.token) +async function processRelease(inputs) { + const octokit = github.getOctokit(inputs.token) // TODO: Get more than 2 releases and process all drafts... const releases = await octokit.rest.repos.listReleases({ ...github.context.repo, @@ -86,11 +86,7 @@ async function processRelease(config) { console.log('latest.tag_name:', latest?.tag_name) console.log('previous.tag_name:', previous?.tag_name) // if (latest.draft && latest.body.includes(script_id)) { - if ( - latest.draft && - latest.author.id === bot_id && - latest.body.includes(script_id) - ) { + if (latest.draft && latest.author.id === bot_id && latest.body.includes(script_id)) { core.info(`⛔ Deleting Latest Draft: \u001b[31;1m${latest.tag_name}`) const response = await octokit.rest.repos.deleteRelease({ ...github.context.repo, @@ -100,15 +96,9 @@ async function processRelease(config) { latest = previous } - const tag_name = semver.inc( - latest.tag_name, - config.semver, - config.identifier - ) + const tag_name = semver.inc(latest.tag_name, inputs.semver, inputs.identifier) if (!tag_name) { - throw new Error( - `Unable to parse ${config.semver} from ${latest.tag_name}` - ) + throw new Error(`Unable to parse ${inputs.semver} from ${latest.tag_name}`) } core.info(`Creating New Draft: \u001b[33;1m${tag_name}`) @@ -116,7 +106,7 @@ async function processRelease(config) { ...github.context.repo, tag_name, draft: true, - prerelease: config.prerelease, + prerelease: inputs.prerelease, generate_release_notes: true, body: `\n\n\n\n${script_id}`, }) @@ -126,11 +116,11 @@ async function processRelease(config) { /** * Add Summary - * @param {Config} config + * @param {Inputs} inputs * @param {Object} response * @return {Promise} */ -async function addSummary(config, response) { +async function addSummary(inputs, response) { core.summary.addRaw('## Draft Release Action\n\n') console.log('response.status:', response.status) const result = response.status @@ -140,11 +130,11 @@ async function addSummary(config, response) { `${result} \`${response.data.tag_name}\`.\n\n${response.data.html_url}\n\n` ) - delete config.token - const yaml = Object.entries(config) + delete inputs.token + const yaml = Object.entries(inputs) .map(([k, v]) => `${k}: ${JSON.stringify(v)}`) .join('\n') - core.summary.addRaw('
Config') + core.summary.addRaw('
Inputs') core.summary.addCodeBlock(yaml, 'yaml') core.summary.addRaw('
\n') @@ -155,16 +145,16 @@ async function addSummary(config, response) { } /** - * Get Config - * @typedef {Object} Config + * Get Inputs + * @typedef {Object} Inputs * @property {String} semver * @property {String} identifier * @property {Boolean} prerelease * @property {Boolean} summary * @property {String} token - * @return {Config} + * @return {Inputs} */ -function getConfig() { +function getInputs() { return { semver: core.getInput('semver', { required: true }), identifier: core.getInput('identifier'),