diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 5cf30d95..29d0d660 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -2,12 +2,12 @@ Please read and follow the instructions before submitting an issue: -- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue. +- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/main/README.md). It may contain information that helps you solve your issue. - Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue). - Please, ensure your issue is not related to CORS or Mixed Content Issue (only relevant for browsers) - If you aren't sure that the issue is caused by axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios). - If you're reporting a bug, ensure it isn't already fixed in the latest Axios version. -- If you need a new feature there's a chance it's already implemented in a [library](https://github.com/axios/axios/blob/master/ECOSYSTEM.md) or you can implement it using [interceptors](https://github.com/axios/axios#interceptors). +- If you need a new feature there's a chance it's already implemented in a [library](https://github.com/axios/axios/blob/main/ECOSYSTEM.md) or you can implement it using [interceptors](https://github.com/axios/axios#interceptors). - Don't remove any title of the issue template, or it will be treated as invalid by the bot. **⚠️👆 Delete the instructions before submitting the issue 👆⚠️** @@ -23,8 +23,9 @@ If you're reporting a bug, include the relevant code and stack traces to debug i If you're requesting a feature, include some context and examples of code using it. #### Environment - - **Axios Version [e.g. 1.7.0]** - - **Target platform [e.g Node / Browser / React Native version where Axios is running]** - - **Adapter [e.g. FETCH / XHR / HTTP]** - - Additional Library/Framework Versions [e.g. React 16.7] - - OS: [e.g. iOS 12.1.0, OSX 10.13.4] + +- **Axios Version [e.g. 1.7.0]** +- **Target platform [e.g Node / Browser / React Native version where Axios is running]** +- **Adapter [e.g. FETCH / XHR / HTTP]** +- Additional Library/Framework Versions [e.g. React 16.7] +- OS: [e.g. iOS 12.1.0, OSX 10.13.4] diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml deleted file mode 100644 index 133996f3..00000000 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: '🐛 Bug Report' -description: Report a reproducible bug. -labels: ['possible bug'] -body: - - type: markdown - attributes: - value: 'Please read and follow the instructions before submitting an issue:' - - type: markdown - attributes: - value: | - - Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue. - - Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue). - - If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios). - - Ensure it isn't already fixed in the latest Axios version. - - type: markdown - attributes: - value: '⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️' - - type: textarea - id: description - attributes: - label: 'Describe the bug' - description: A clear and concise description of what the bug is. - validations: - required: true - - type: textarea - id: reproduce - attributes: - label: 'To Reproduce' - description: | - Code snippet to reproduce, ideally if you can provide a live example in https://codesandbox.io/ sandbox or a repository that illustrates the issue. - (You can use https://codesandbox.io/p/sandbox/zen-knuth-9hvhzq as a node sandbox template, or https://codesandbox.io/s/axios-browser-issue-2l8jec as a browser template) - **If your problem is not reproducible, please file under Support or Usage Question** - validations: - required: false - - type: textarea - id: code-snippet - attributes: - label: 'Code snippet' - render: js - validations: - required: false - - type: textarea - id: expected - attributes: - label: 'Expected behavior' - description: A clear and concise description of what you expected to happen. - validations: - required: false - - type: markdown - attributes: - value: Environment - - type: input - id: axios-version - attributes: - label: 'Axios Version' - placeholder: 'e.g. 0.18.0' - - type: input - id: adapter-version - attributes: - label: 'Adapter Version' - placeholder: 'e.g. XHR/HTTP' - - type: input - id: browser - attributes: - label: 'Browser' - placeholder: 'e.g. Chrome, Safari' - - type: input - id: browser-version - attributes: - label: 'Browser Version' - placeholder: 'e.g. 42' - - type: input - id: node-version - attributes: - label: 'Node.js Version' - description: 'node --version' - placeholder: 'e.g. 13.0.1' - - type: input - id: os - attributes: - label: 'OS' - placeholder: 'e.g. iOS 16.0.2, OSX 12.6.0' - - type: textarea - id: other-version - attributes: - label: 'Additional Library Versions' - placeholder: | - e.g. - React 16.7, - React Native 0.58.0 - render: bash - validations: - required: false - - type: textarea - id: additional-context - attributes: - label: 'Additional context/Screenshots' - description: Add any other context about the problem here. If applicable, add screenshots to help explain. - render: bash - validations: - required: false - diff --git a/.github/ISSUE_TEMPLATE/DOCUMENTATION.yml b/.github/ISSUE_TEMPLATE/DOCUMENTATION.yml deleted file mode 100644 index 2b2d7a48..00000000 --- a/.github/ISSUE_TEMPLATE/DOCUMENTATION.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: '📝 Documentation' -description: Report an error or area that needs clarification. -labels: ['documentation'] -body: - - type: markdown - attributes: - value: 'If you found an area that needs clarification, feel free to open a PR or list the section/content that could be improved below' - - type: markdown - attributes: - value: '⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️' - - type: textarea - id: content - attributes: - label: 'Section/Content To Improve' - description: Quote or link to section - validations: - required: true - - type: textarea - id: solution - attributes: - label: 'Suggested Improvement' - description: Identify what is confusing or incorrect and what could make it better - validations: - required: true - - type: textarea - id: files - attributes: - label: 'Relevant File(s)' - placeholder: e.g. README.md - render: bash diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml deleted file mode 100644 index 0d79af20..00000000 --- a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: '✨ Feature Request' -description: Suggest an idea or feature. -labels: ['feature'] -body: - - type: markdown - attributes: - value: 'Please read and follow the instructions before submitting an issue:' - - type: markdown - attributes: - value: | - - Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue. - - Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue). - - If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios). - - type: markdown - attributes: - value: '⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️' - - type: textarea - id: description - attributes: - label: 'Is your feature request related to a problem? Please describe.' - description: A clear and concise description of what the problem is. - placeholder: I'm always frustrated when [...] - validations: - required: true - - type: textarea - id: solution - attributes: - label: Describe the solution you'd like - description: A clear and concise description of what you want to happen. - validations: - required: false - - type: textarea - id: alternative - attributes: - label: Describe alternatives you've considered - description: A clear and concise description of any alternative solutions or features you've considered. - validations: - required: false - - type: textarea - id: additional-context - attributes: - label: 'Additional context/Screenshots' - description: Add any other context or screenshots about the feature request here. - render: bash - validations: - required: false diff --git a/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.yml b/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.yml deleted file mode 100644 index 82ca8496..00000000 --- a/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.yml +++ /dev/null @@ -1,92 +0,0 @@ -name: '🤔 Support or Usage Question' -description: Get help using Axios. -labels: ['question'] -body: - - type: markdown - attributes: - value: 'Please read and follow the instructions before submitting an issue:' - - type: markdown - attributes: - value: | - - Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue. - - Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue). - - If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios). - - If you're reporting a bug, ensure it isn't already fixed in the latest Axios version. - - type: markdown - attributes: - value: '⚠️👆 Feel free to delete these instructions before submitting the issue 👆⚠️' - - type: textarea - id: description - attributes: - label: 'Describe the issue' - description: A clear and concise description of what the issue is. - validations: - required: true - - type: textarea - id: example - attributes: - label: 'Example Code' - description: Code snippet to illustrate your question - render: js - validations: - required: false - - type: textarea - id: expected - attributes: - label: 'Expected behavior' - description: A clear and concise description of what you expected to happen. - validations: - required: false - - type: markdown - attributes: - value: Environment - - type: input - id: axios-version - attributes: - label: 'Axios Version' - placeholder: 'e.g. 0.18.0' - - type: input - id: adapter-version - attributes: - label: 'Adapter Version' - placeholder: 'e.g. XHR/HTTP' - - type: input - id: browser - attributes: - label: 'Browser' - placeholder: 'e.g. Chrome, Safari' - - type: input - id: browser-version - attributes: - label: 'Browser Version' - placeholder: 'e.g. 42' - - type: input - id: node-version - attributes: - label: 'Node.js Version' - description: 'node --version' - placeholder: 'e.g. 13.0.1' - - type: input - id: os - attributes: - label: 'OS' - placeholder: 'e.g. iOS 16.0.2, OSX 12.6.0' - - type: textarea - id: other-version - attributes: - label: 'Additional Library Versions' - placeholder: | - e.g. - React 16.7, - React Native 0.58.0 - render: bash - validations: - required: false - - type: textarea - id: additional-context - attributes: - label: 'Additional context/Screenshots' - description: Add any other context about the problem here. If applicable, add screenshots to help explain. - render: bash - validations: - required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 0086358d..00000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1 +0,0 @@ -blank_issues_enabled: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 092611e2..791c8dc1 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,13 +1,14 @@ - + diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index 8bc244d1..00000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,34 +0,0 @@ - -"pr::docs": - - changed-files: - - any-glob-to-any-file: '**.md' - -"pr::code": - - changed-files: - - any-glob-to-any-file: 'lib/**.js' - -"pr::types": - - changed-files: - - any-glob-to-any-file: ['index.d.ts', 'index.d.cts'] - -"pr::tests": - - changed-files: - - any-glob-to-any-file: 'test/**.js' - -"pr::github": - - changed-files: - - any-glob-to-any-file: '.github/**' - -"pr::examples": - - changed-files: - - any-glob-to-any-file: 'examples/**.js' - -"pr::ci": - - changed-files: - - any-glob-to-any-file: ['bin/**', 'rollup.config.js'] - -"pr::feature": - - head-branch: ['feature', 'feat'] - -"pr::fix": - - head-branch: ['fix', 'bug'] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 3055e7c5..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: 'CI' - -on: - push: - branches: - - '*' - - '*/*' - - '**' - - '!sponsors' - pull_request: - branches: - - '*' - - '*/*' - - '**' - - '!sponsors' - -permissions: - contents: read - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [12.x, 14.x, 16.x, 18.x, 20.x, 22.x, 24.x] - fail-fast: false - - steps: - - uses: actions/checkout@v6 - with: - persist-credentials: true - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v47 - - name: List all changed files - run: | - for file in ${{ steps.changed-files.outputs.all_changed_files }}; do - echo "$file was changed" - done - - name: Check changes - id: changed-ignored - uses: tj-actions/changed-files@v47 - with: - files: | - **.md - sandbox/** - examples/** - .github/** - templates/** - bin/** - - name: Setup node - uses: actions/setup-node@v6 - with: - node-version: ${{ matrix.node-version }} - cache: npm - if: steps.changed-ignored.outputs.only_modified == 'false' - - run: npm ci - if: steps.changed-ignored.outputs.only_modified == 'false' - - run: npm run build - if: steps.changed-ignored.outputs.only_modified == 'false' - - name: Run Server tests - run: npm run test:node - if: steps.changed-ignored.outputs.only_modified == 'false' - # We run browser tests only on one version of the node, since client tests do not depend on the server environment. - - name: Run browser tests - run: npm run test:browser - if: steps.changed-ignored.outputs.only_modified == 'false' && matrix.node-version == '22.x' - - name: Run package tests - run: npm run test:package - if: steps.changed-ignored.outputs.only_modified == 'false' diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 854d1322..00000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: 'CodeQL' - -on: - push: - branches: - - '*' - - '*/*' - - '**' - - '!sponsors' - pull_request: - branches: - - '*' - - '*/*' - - '**' - - '!sponsors' - schedule: - - cron: '21 23 * * 5' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'javascript' ] - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - with: - persist-credentials: false - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v4 - with: - languages: ${{ matrix.language }} - queries: security-extended,security-and-quality - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v4 diff --git a/.github/workflows/depsreview.yaml b/.github/workflows/depsreview.yaml deleted file mode 100644 index 640af43a..00000000 --- a/.github/workflows/depsreview.yaml +++ /dev/null @@ -1,16 +0,0 @@ -name: 'Dependency Review' -on: [pull_request] - -permissions: - contents: read - -jobs: - dependency-review: - runs-on: ubuntu-latest - steps: - - name: 'Checkout Repository' - uses: actions/checkout@v6 - with: - persist-credentials: false - - name: 'Dependency Review' - uses: actions/dependency-review-action@v4 diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml deleted file mode 100644 index e7aa2206..00000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: "PR Labeler" -on: - pull_request_target: - workflow_dispatch: - inputs: - prs: - required: false - description: "pr number" - -jobs: - labeler: - permissions: - contents: read - pull-requests: write - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - name: git config - run: | - git config user.name "${GITHUB_ACTOR}" - git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - - name: Set PR number - id: set-pr - run: | - echo "Using PR number: ${{ github.event.inputs.prs || github.event.pull_request.number }}" - echo "pr=${{ github.event.inputs.prs || github.event.pull_request.number }}" >> $GITHUB_OUTPUT - - - uses: actions/labeler@v6 - with: - pr-number: ${{ steps.set-pr.outputs.pr }} diff --git a/.github/workflows/notify.yml b/.github/workflows/notify.yml deleted file mode 100644 index ce74d3e3..00000000 --- a/.github/workflows/notify.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: notify - -on: - #workflow_run: - # workflows: ["publish"] - # types: - # - completed - #repository_dispatch: - # types: [ notify ] - #release: - # types: [published] - # branches: - # - main - # - 'v**' - #push: - # tags: - # - 'v[0-9]+.[0-9]+.[0-9]+' - # branches: - # - main - # - 'v**' - - workflow_dispatch: - inputs: - tag: - required: false -jobs: - notify: - runs-on: ubuntu-latest - #if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} - steps: - #- name: Dump GitHub context - # env: - # GITHUB_CONTEXT: ${{ toJson(github) }} - # run: echo "$GITHUB_CONTEXT" - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - name: git config - run: | - git config user.name "${GITHUB_ACTOR}" - git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - - name: Setup node - uses: actions/setup-node@v6 - with: - node-version: 18 - cache: npm - - run: npm ci - - name: Notify published PRs - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: node ./bin/actions/notify_published.js --tag ${{ github.event.inputs.tag || github.event.release.tag_name }} diff --git a/.github/workflows/npm-tag.yml b/.github/workflows/npm-tag.yml deleted file mode 100644 index 94dc78c8..00000000 --- a/.github/workflows/npm-tag.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: NPM Tag -on: - workflow_dispatch: - inputs: - version: - required: true - tag: - required: true - default: "latest" -jobs: - publish: - runs-on: ubuntu-latest - permissions: - contents: write - id-token: write - steps: - - uses: actions/checkout@v6 - - name: git config - run: | - git config user.name "${GITHUB_ACTOR}" - git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - - uses: actions/setup-node@v6 - with: - node-version: 18 - registry-url: https://registry.npmjs.org/ - ############# TAG RELEASE ############## - - name: Tag release - run: npm dist-tag add axios@${{ github.event.inputs.version }} ${{ github.event.inputs.tag }} - env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index f221b0e0..00000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: Release PR -on: - workflow_dispatch: - inputs: - type: - type: choice - description: Choose release type - options: - - auto - - patch - - minor - - major - default: auto - beta: - type: boolean - description: Prerelease - default: false -jobs: - releaseIt: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - name: git config - run: | - git config user.name "${GITHUB_ACTOR}" - git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - - name: Setup node - uses: actions/setup-node@v6 - with: - node-version: 16 - cache: npm - - run: npm ci - - run: npm run build - - name: Prepare release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - TYPE_ARG: ${{ fromJSON('{"auto":"", "patch":"patch", "minor":"minor", "major":"major"}')[github.event.inputs.type] }} - BETA_ARG: ${{ github.event.inputs.beta == 'true' && '--preRelease=beta' || '' }} - run: npm run release -- $TYPE_ARG --ci --verbose --no-git.push --no-git.commit --no-git.tag --no-github $BETA_ARG $DRY_ARG - - name: Show git status - if: failure() - run: git status && git diff - - name: Add contributors list to CHANGELOG.md - run: npm run release:changelog:fix - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: get-npm-version - id: package-version - uses: martinbeentjes/npm-get-version-action@main - - name: Extract release notes - id: extract-release-notes - uses: ffurrer2/extract-release-notes@v3 - - name: Generate PR body - id: body - uses: mathiasvr/command-output@v1 - with: - run: node ./bin/pr.js - - name: Create pull request - uses: peter-evans/create-pull-request@v7 - id: cpr - with: - branch: release - delete-branch: true - commit-message: 'chore(release): v${{ steps.package-version.outputs.current-version}}' - title: '[Release] v${{ steps.package-version.outputs.current-version}}' - body: | - ${{ steps.body.outputs.stdout }} - ## Release notes: - ${{ steps.extract-release-notes.outputs.release_notes }} - labels: | - release - bot - signoff: false - #team-reviewers: | - # owners - # maintainers - #assignees: jasonsaayman - #reviewers: jasonsaayman - draft: false - - name: Show PR link - if: ${{ steps.cpr.outputs.pull-request-url }} - run: | - echo "Axios Release v${{ steps.package-version.outputs.current-version}}' pull request - ${{ steps.cpr.outputs.pull-request-url }}" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a877b7f7..f371c7d4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,85 +1,41 @@ -name: Publish +name: Publish package to NPM + on: - pull_request: - types: - - closed - branches: - - main - - 'v**' - workflow_dispatch: + push: + tags: + - "v*.*.*" + +permissions: + contents: write + id-token: write + jobs: publish: - if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged == true && github.event.pull_request.head.label == 'axios:release') runs-on: ubuntu-latest - permissions: - contents: write - id-token: write + steps: - - name: "Release PR info" - if: github.event_name != 'workflow_dispatch' - run: echo "PR ${{ github.event.number }}" - - uses: actions/checkout@v6 - - name: git config - run: | - git config user.name "${GITHUB_ACTOR}" - git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - - uses: actions/setup-node@v6 - with: - node-version: 18 - registry-url: https://registry.npmjs.org/ - - run: npm ci - - run: npm run build - - name: get-npm-version - id: package-version - uses: martinbeentjes/npm-get-version-action@main - - name: Extract release notes - id: extract-release-notes - uses: ffurrer2/extract-release-notes@v3 - - name: Check versions - run: node ./bin/check-build-version.js - ############# TAG RELEASE ############## - - name: "Push tag v${{ steps.package-version.outputs.current-version }}" - uses: rickstaa/action-create-tag@v1 - id: tag_version - with: - tag: "v${{ steps.package-version.outputs.current-version }}" - ############# RESOLVE NPM TAG ############## - - name: NPM TAG - id: 'npm_tag' - run: node ./bin/resolveNPMTag.js - ############# GITHUB RELEASE ############## - - name: "Create a GitHub release v${{ steps.package-version.outputs.current-version }}" - uses: ncipollo/release-action@v1 - with: - tag: "v${{ steps.package-version.outputs.current-version }}" - name: "Release v${{ steps.package-version.outputs.current-version }}" - body: | - ## Release notes: - ${{ steps.extract-release-notes.outputs.release_notes }} - ############# NPM RELEASE ############## - - name: Publish the release to NPM - run: npm publish --provenance --access public --tag ${{ steps.npm_tag.outputs.tag || 'latest' }} - env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} - notify: - needs: [publish] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - name: git config - run: | - git config user.name "${GITHUB_ACTOR}" - git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - - name: Setup node + - name: Checkout repo + uses: actions/checkout@v6 + - name: Setup Node.js uses: actions/setup-node@v6 with: - node-version: 18 + node-version: 24.x cache: npm - - run: npm ci - ############# Add release comments and tags to published PRs ############## - - name: Notify published PRs + registry-url: "https://registry.npmjs.org" + - name: Install dependencies + run: npm ci + - name: Build project + run: npm run build + - name: Publish to NPM + run: npm publish --provenance --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Create release tag on GitHub env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: node ./bin/actions/notify_published.js --tag ${{ github.event.inputs.tag || github.event.release.tag_name }} + TAG: ${{ github.ref_name }} + run: | + gh release create "$TAG" \ + --repo="$GITHUB_REPOSITORY" \ + --title="${GITHUB_REPOSITORY#*/} ${TAG#v}" \ + --generate-notes diff --git a/.github/workflows/release-branch.yml b/.github/workflows/release-branch.yml new file mode 100644 index 00000000..3f32c697 --- /dev/null +++ b/.github/workflows/release-branch.yml @@ -0,0 +1,72 @@ +name: Create release branch + +on: + workflow_dispatch: + inputs: + type: + type: choice + description: Choose release type + options: + - auto + - patch + - minor + - major + default: auto + beta: + type: boolean + description: Prerelease + default: false + +permissions: + contents: write + pull-requests: write + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v6 + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version: 24.x + cache: npm + - name: Install dependencies + run: npm ci + - name: Bump version + id: bump_version + uses: phips28/gh-action-bump-version@v9 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + version-type: ${{ github.event.inputs.type }} + default: ${{ github.event.inputs.beta == true && 'prerelease' || 'patch' }} + commit-message: "chore(release): prepare release ${{version}}" + tag-prefix: "v" + skip-tag: true + skip-push: true + - name: Build project + run: npm run build + - name: Run unit tests + run: npm run test:node + - name: Run package tests + run: npm run test:package + - name: Run browser tests + run: npm run test:browser + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "chore(release): prepare release ${{ steps.bump_version.outputs.newTag }}" + branch: "release/${{ steps.bump_version.outputs.newTag }}" + title: "chore(release): prepare release ${{ steps.bump_version.outputs.newTag }}" + body: "This PR prepares the release ${{ steps.bump_version.outputs.newTag }}." + base: main + maintainer-can-modify: true + draft: false + labels: | + type::automated-pr + priority::high + commit::chore diff --git a/.github/workflows/run-ci.yml b/.github/workflows/run-ci.yml new file mode 100644 index 00000000..f7de2e50 --- /dev/null +++ b/.github/workflows/run-ci.yml @@ -0,0 +1,61 @@ +name: Continuous integration + +on: + pull_request: + branches: + - "*" + - "*/*" + - "**" + - "!sponsors" + - "!release/**" + +permissions: + contents: read + security-events: write + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + ci: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x, 14.x, 16.x, 18.x, 20.x, 22.x, 24.x] + fail-fast: false + + steps: + - name: Checkout repo + uses: actions/checkout@v6 + with: + persist-credentials: true + - name: Setup node + uses: actions/setup-node@v6 + with: + node-version: ${{ matrix.node-version }} + cache: npm + - name: Install dependencies + run: npm ci + - name: Build project + run: npm run build + - name: Run unit tests + run: npm run test:node + - name: Run package tests + run: npm run test:package + - name: Run browser tests + run: npm run test:browser + if: matrix.node-version == '24.x' + - name: Dependency Review + uses: actions/dependency-review-action@v4 + if: matrix.node-version == '24.x' + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: javascript + queries: security-extended,security-and-quality + if: matrix.node-version == '24.x' + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 + if: matrix.node-version == '24.x' diff --git a/.github/workflows/sponsors.yml b/.github/workflows/sponsors.yml deleted file mode 100644 index 5df13dcb..00000000 --- a/.github/workflows/sponsors.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Update Readme sponsor list -on: - workflow_dispatch: - repository_dispatch: - types: - - webhook - schedule: - # Run at 0000 daily - - cron: '0 1 * * *' -jobs: - sponsors: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - name: git config - run: | - git config user.name "${GITHUB_ACTOR}" - git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - - name: Setup node - uses: actions/setup-node@v6 - with: - node-version: 16 - cache: npm - - run: npm ci - - name: Check sponsors updates - id: sponsors - run: node ./bin/sponsors.js - - name: Notify status - if: ${{ steps.sponsors.outputs.changed == 'true'}} - run: | - echo "Sponsor block has changed. Creating PR with updates..." - - name: Read sponsors.md file content - if: ${{ steps.sponsors.outputs.changed == 'true'}} - id: read_file - run: | - echo 'CONTENT<> $GITHUB_ENV - cat ./temp/sponsors.md >> $GITHUB_ENV - echo 'EOF' >> $GITHUB_ENV - shell: bash - - name: Echo - run: | - echo "$CONTENT" - - name: Create pull request - if: ${{ steps.sponsors.outputs.changed == 'true'}} - uses: peter-evans/create-pull-request@v7 - id: cpr - with: - branch: sponsors - delete-branch: true - commit-message: 'chore(sponsor): update sponsor block' - title: '[Chore] Update sponsor block' - body: | - **New sponsor block update:** - ${{ env.CONTENT }} - labels: | - pr::docs - bot - automerge - signoff: false - #team-reviewers: | - # owners - # maintainers - #assignees: jasonsaayman - #reviewers: jasonsaayman - draft: false - - name: Show PR link - if: ${{ steps.sponsors.outputs.changed == 'true'}} - run: | - echo "Sponsor block has changed. Creating PR..." - echo "Axios Release v${{ steps.package-version.outputs.current-version}}' pull request - ${{ steps.cpr.outputs.pull-request-url }}" diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index 50a4e465..00000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: 'Close Stale' - -on: - schedule: - - cron: '0 0 * * 1' - -jobs: - stale: - permissions: - issues: write # for actions/stale to close stale issues - pull-requests: write # for actions/stale to close stale PRs - runs-on: ubuntu-latest - steps: - - name: Close Stale Issues - uses: actions/stale@v10 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: | - Hello! :wave: - - This issue is being automatically marked as stale because it has not been updated in a while. Please confirm that the issue is still present and reproducible. If no updates or new comments are received the issue will be closed in a few days. - - Thanks. - stale-pr-message: | - Hello! :wave: - - This pull request is being automatically marked as stale because it has not been updated in a while. Please confirm that the issue is still present and reproducible. If no updates or new comments are received the pull request will be closed in a few days. - - Thanks. - stale-issue-label: 'status:stale' - stale-pr-label: 'status:stale' - only-labels: 'status:more info needed' - days-before-stale: 30 - days-before-close: 14 diff --git a/.github/workflows/update-sponsor-block.yml b/.github/workflows/update-sponsor-block.yml new file mode 100644 index 00000000..827acc36 --- /dev/null +++ b/.github/workflows/update-sponsor-block.yml @@ -0,0 +1,64 @@ +name: Update readme sponsor block + +on: + workflow_dispatch: + repository_dispatch: + types: + - webhook + schedule: + - cron: "0 1 * * *" + +permissions: + contents: write + pull-requests: write + +jobs: + sponsors: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + - name: git config + run: | + git config user.name "${GITHUB_ACTOR}" + git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" + - name: Setup node + uses: actions/setup-node@v6 + with: + node-version: 24.x + cache: npm + - name: Install dependencies + run: npm ci + - name: Check if sponsors require updates + id: sponsors-requires-update + run: node ../../bin/update-sponsors.js + - name: Read sponsors.md file content + run: | + echo 'CONTENT<> $GITHUB_ENV + cat ./temp/sponsors.md >> $GITHUB_ENV + echo 'EOF' >> $GITHUB_ENV + shell: bash + if: steps.sponsors-requires-update.outputs.changed == 'true' + - name: Echo sponsors content + run: | + echo "$CONTENT" + if: steps.sponsors-requires-update.outputs.changed == 'true' + - name: Create pull request + uses: peter-evans/create-pull-request@v7 + with: + branch: sponsors + delete-branch: true + commit-message: "chore(sponsor): update sponsor block" + title: "[Chore] Update sponsor block" + body: | + **New sponsor block update:** + ${{ env.CONTENT }} + labels: | + commit::docs + priority::high + type::automated-pr + signoff: false + draft: false + if: steps.sponsors-requires-update.outputs.changed == 'true' diff --git a/bin/sponsors.js b/bin/sponsors.js index e130a307..73af873e 100644 --- a/bin/sponsors.js +++ b/bin/sponsors.js @@ -1,41 +1,48 @@ import fs from "fs/promises"; -import _axios from '../index.js'; -import {exec} from "./repo.js"; -import {colorize} from "./helpers/colorize.js"; +import _axios from "../index.js"; +import { exec } from "./repo.js"; +import { colorize } from "./helpers/colorize.js"; const axios = _axios.create({ headers: { - "User-Agent": 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36' - } + "User-Agent": + "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36", + }, }); const getWithRetry = (url, retries = 3) => { let counter = 0; const doRequest = async () => { try { - return await axios.get(url) + return await axios.get(url); } catch (err) { if (counter++ >= retries) { throw err; } - await new Promise(resolve => setTimeout(resolve, counter ** counter * 1000)); + await new Promise((resolve) => + setTimeout(resolve, counter ** counter * 1000), + ); return doRequest(); } - } + }; return doRequest(); }; -const updateReadmeSponsors = async (url, path, marker = '') => { +const updateReadmeSponsors = async ( + url, + path, + marker = "", +) => { let fileContent = (await fs.readFile(path)).toString(); const index = fileContent.indexOf(marker); - if(index >= 0) { + if (index >= 0) { const readmeContent = fileContent.slice(index); - let {data: sponsorContent} = await getWithRetry(url); - sponsorContent += '\n'; + let { data: sponsorContent } = await getWithRetry(url); + sponsorContent += "\n"; const currentSponsorContent = fileContent.slice(0, index); @@ -47,18 +54,22 @@ const updateReadmeSponsors = async (url, path, marker = '