Skip to content

Commit 6fca160

Browse files
committed
Init fetchet
0 parents  commit 6fca160

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+11761
-0
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
groups:
6+
github-actions:
7+
patterns:
8+
- "*"
9+
schedule:
10+
interval: "weekly"

.github/labeler.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"pr::docs":
2+
- changed-files:
3+
- any-glob-to-any-file: "**.md"
4+
5+
"pr::code":
6+
- changed-files:
7+
- any-glob-to-any-file: ["src/**/*.js", "src/**/*.ts"]
8+
9+
"pr::types":
10+
- changed-files:
11+
- any-glob-to-any-file: ["types.ts"]
12+
13+
"pr::tests":
14+
- changed-files:
15+
- any-glob-to-any-file:
16+
["tests/**.js", "tests/**.ts", "**/*.test.js", "**/*.test.ts"]
17+
18+
"pr::github":
19+
- changed-files:
20+
- any-glob-to-any-file: ".github/**"
21+
22+
"pr::ci":
23+
- changed-files:
24+
- any-glob-to-any-file:
25+
["tsconfig.json", "tsup.config.ts", "vite.config.ts"]
26+
27+
"pr::feature":
28+
- head-branch: ["feature", "feat"]
29+
30+
"pr::patch":
31+
- head-branch: ["update", "edit"]
32+
33+
"pr::fix":
34+
- head-branch: ["fix", "bug"]

.github/workflows/codeql.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches:
6+
- "*"
7+
- "*/*"
8+
- "**"
9+
pull_request:
10+
branches:
11+
- "*"
12+
- "*/*"
13+
- "**"
14+
schedule:
15+
- cron: "21 23 * * 5"
16+
17+
jobs:
18+
analyze:
19+
name: Analyze
20+
runs-on: ubuntu-latest
21+
permissions:
22+
actions: read
23+
contents: read
24+
security-events: write
25+
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
language: ["javascript", "typescript"]
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
with:
35+
persist-credentials: false
36+
37+
- name: Initialize CodeQL
38+
uses: github/codeql-action/init@v3
39+
with:
40+
languages: ${{ matrix.language }}
41+
queries: security-extended,security-and-quality
42+
43+
- name: Perform CodeQL Analysis
44+
uses: github/codeql-action/analyze@v3

.github/workflows/dep-review.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: "Dependency Review"
2+
on: [pull_request]
3+
4+
permissions:
5+
contents: read
6+
7+
jobs:
8+
dependency-review:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: "Checkout Repository"
12+
uses: actions/checkout@v4
13+
with:
14+
persist-credentials: false
15+
- name: "Dependency Review"
16+
uses: actions/dependency-review-action@v4

.github/workflows/labeler.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: "PR Labeler"
2+
on:
3+
pull_request_target:
4+
workflow_dispatch:
5+
inputs:
6+
prs:
7+
required: false
8+
description: "pr number"
9+
10+
jobs:
11+
labeler:
12+
permissions:
13+
contents: read
14+
pull-requests: write
15+
issues: write
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
- name: git config
22+
run: |
23+
git config user.name "${GITHUB_ACTOR}"
24+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
25+
- name: Set PR number
26+
id: set-pr
27+
run: |
28+
echo "Using PR number: ${{ github.event.inputs.prs || github.event.pull_request.number }}"
29+
echo "pr=${{ github.event.inputs.prs || github.event.pull_request.number }}" >> $GITHUB_OUTPUT
30+
31+
- uses: actions/labeler@v5
32+
with:
33+
pr-number: ${{ steps.set-pr.outputs.pr }}

.github/workflows/lint.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: "Lint"
2+
3+
on:
4+
push:
5+
branches:
6+
- "*"
7+
- "*/*"
8+
- "**"
9+
pull_request:
10+
branches:
11+
- "*"
12+
- "*/*"
13+
- "**"
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
21+
strategy:
22+
matrix:
23+
# TODO: Add older node versions: 12, 14, 16, 18
24+
node-version: [20.x, 22.x, 24.x]
25+
fail-fast: false
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
persist-credentials: true
31+
- name: Get changed files
32+
id: changed-files
33+
uses: tj-actions/changed-files@v46
34+
- name: List all changed files
35+
run: |
36+
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
37+
echo "$file was changed"
38+
done
39+
- name: Check changes
40+
id: changed-ignored
41+
uses: tj-actions/changed-files@v46
42+
with:
43+
files: |
44+
**.md
45+
.github/**
46+
docs/**
47+
bin/**
48+
- name: Setup node
49+
uses: actions/setup-node@v4
50+
with:
51+
node-version: ${{ matrix.node-version }}
52+
cache: npm
53+
if: steps.changed-ignored.outputs.only_modified == 'false'
54+
- run: npm ci
55+
if: steps.changed-ignored.outputs.only_modified == 'false'
56+
- run: npm run lint
57+
if: steps.changed-ignored.outputs.only_modified == 'false'
58+
- run: echo "✅ Linting completed successfully on Node.js ${{ matrix.node-version }}!"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: "PR Validation"
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
validate-dist:
9+
if: github.event.pull_request.head.repo.full_name != github.repository
10+
runs-on: ubuntu-latest
11+
permissions:
12+
pull-requests: write
13+
steps:
14+
- uses: dorny/paths-filter@v3
15+
id: filter
16+
with:
17+
filters: |
18+
dist:
19+
- 'dist/**'
20+
21+
- name: Comment if dist/ was changed
22+
if: steps.filter.outputs.dist == 'true'
23+
uses: peter-evans/create-or-update-comment@v4
24+
with:
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
issue-number: ${{ github.event.pull_request.number }}
27+
body: |
28+
⚠️ **Warning**: Modifications detected inside the dist/ folder.
29+
Since these files are created automatically during our release builds, please do not edit them directly.
30+
To keep the project consistent, kindly revert any changes to dist/ in your pull request.
31+
validate-docs-api-reference:
32+
if: github.event.pull_request.head.repo.full_name != github.repository
33+
runs-on: ubuntu-latest
34+
permissions:
35+
pull-requests: write
36+
steps:
37+
- uses: dorny/paths-filter@v3
38+
id: filter
39+
with:
40+
filters: |
41+
api-docs:
42+
- 'docs/api-reference/**'
43+
44+
- name: Comment if docs/api-reference/ was changed
45+
if: steps.filter.outputs.api-docs == 'true'
46+
uses: peter-evans/create-or-update-comment@v4
47+
with:
48+
token: ${{ secrets.GITHUB_TOKEN }}
49+
issue-number: ${{ github.event.pull_request.number }}
50+
body: |
51+
⚠️ **Warning**: You've modified files in `docs/api-reference/`.
52+
These files are generated automatically during our release builds, please do not edit them directly.
53+
To keep the project consistent, kindly revert any changes to docs/api-reference/ in your pull request.

.github/workflows/publish.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Publish
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
branches:
7+
- main
8+
- "v**"
9+
workflow_dispatch:
10+
jobs:
11+
publish:
12+
if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged == true && github.event.pull_request.head.label == 'fetchet:release')
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
id-token: write
17+
steps:
18+
- name: "Release PR info"
19+
if: github.event_name != 'workflow_dispatch'
20+
run: echo "PR ${{ github.event.number }}"
21+
- uses: actions/checkout@v4
22+
- name: git config
23+
run: |
24+
git config user.name "${GITHUB_ACTOR}"
25+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: 18
29+
registry-url: https://registry.npmjs.org/
30+
- run: npm ci
31+
- name: get-npm-version
32+
id: package-version
33+
uses: martinbeentjes/npm-get-version-action@main
34+
- name: Extract release notes
35+
id: extract-release-notes
36+
uses: ffurrer2/extract-release-notes@v2
37+
# TODO: Check/verify versions
38+
# Tag Release
39+
- name: "Push tag v${{ steps.package-version.outputs.current-version }}"
40+
uses: rickstaa/action-create-tag@v1
41+
id: tag_version
42+
with:
43+
tag: "v${{ steps.package-version.outputs.current-version }}"
44+
# Resolve NPM Tag
45+
- name: NPM TAG
46+
id: "npm_tag"
47+
run: |
48+
version="${{ steps.package-version.outputs.current-version }}"
49+
if [[ "$version" == *-* ]]; then
50+
echo "tag=beta" >> $GITHUB_OUTPUT
51+
else
52+
echo "tag=latest" >> $GITHUB_OUTPUT
53+
fi
54+
- name: Set fallback tag if empty
55+
id: fallback_tag
56+
run: |
57+
echo "tag=${{ steps.npm_tag.outputs.tag || 'latest' }}" >> $GITHUB_OUTPUT
58+
# GitHub Release
59+
- name: "Create a GitHub release v${{ steps.package-version.outputs.current-version }}"
60+
uses: ncipollo/release-action@v1
61+
with:
62+
tag: "v${{ steps.package-version.outputs.current-version }}"
63+
name: "Release v${{ steps.package-version.outputs.current-version }}"
64+
body: |
65+
## Release notes:
66+
${{ steps.extract-release-notes.outputs.release_notes }}
67+
# NPM Release
68+
- name: Publish the release to NPM
69+
run: npm publish --provenance --access public --tag ${{ steps.fallback_tag.outputs.tag }}
70+
env:
71+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
72+
# TODO: notify release notify - add release comments and tags to published PRs:

0 commit comments

Comments
 (0)