Skip to content

Commit d356418

Browse files
committed
Initial commit
fix
0 parents  commit d356418

27 files changed

+8428
-0
lines changed

.changeset/config.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": [],
11+
"privatePackages": {
12+
"tag": false,
13+
"version": false
14+
}
15+
}

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @vercel/ci-cd-workflow

.github/workflows/ci.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
name: typecheck | lint | test
12+
runs-on: ubuntu-latest
13+
env:
14+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
15+
TURBO_TEAM: vercel
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
node-version: [18.x, 20.x, 22.x]
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- uses: pnpm/action-setup@v4
27+
name: Install pnpm
28+
id: pnpm-setup
29+
with:
30+
version: 9.4.0
31+
run_install: false
32+
33+
- name: Install Node.js ${{ matrix.node-version }}
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: ${{ matrix.node-version }}
37+
cache: 'pnpm'
38+
39+
- name: Install Dependencies
40+
id: pnpm-install
41+
run: pnpm install --frozen-lockfile
42+
43+
- name: Run CI
44+
run: pnpm turbo typecheck lint test

.github/workflows/release.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
11+
env:
12+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
13+
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
14+
15+
jobs:
16+
release:
17+
name: Release
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
token: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
24+
25+
- uses: pnpm/action-setup@v4
26+
name: Install pnpm
27+
id: pnpm-setup
28+
with:
29+
version: 9.4.0
30+
run_install: false
31+
32+
- name: Install Dependencies
33+
id: pnpm-install
34+
run: pnpm install --frozen-lockfile
35+
36+
- name: Create Release PR or Publish Packages
37+
uses: changesets/action@v1
38+
with:
39+
publish: pnpm release
40+
version: pnpm version-packages
41+
commit: 'chore: update package versions'
42+
title: 'chore: update package versions'
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
45+
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}

.gitignore

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# dependencies
2+
node_modules
3+
**/node_modules
4+
.pnp
5+
.pnp.js
6+
.swc
7+
8+
# testing
9+
coverage
10+
11+
# misc
12+
.env*
13+
.DS_Store
14+
*.pem
15+
-*.log
16+
-dist
17+
dist/
18+
19+
# debug
20+
npm-debug.log*
21+
yarn-debug.log*
22+
yarn-error.log*
23+
.pnpm-debug.log*
24+
25+
# Vercel
26+
.vercel
27+
28+
# Next.js
29+
.next
30+
31+
# turbo
32+
.turbo
33+
34+
# E2E Tests
35+
e2e-test-results/

.node-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.x

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
auto-install-peers = false

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Vercel
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# `@vercel/repository-dispatch`
2+
3+
Utilities and types for working with [`repository_dispatch`](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#repository_dispatch) events triggered by Vercel.
4+
[Learn more](https://vercel.com/docs/git/vercel-for-github#repository-dispatch)

package.json

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "repository-dispatch",
3+
"version": "0.0.0",
4+
"description": "Vercel repository-dispatch monorepo",
5+
"bugs": {
6+
"url": "https://github.com/vercel/repository-dispatch/issues"
7+
},
8+
"repository": {
9+
"type": "git",
10+
"url": "https://github.com/vercel/repository-dispatch"
11+
},
12+
"license": "MIT",
13+
"scripts": {
14+
"changeset": "changeset",
15+
"checks": "turbo run lint test typecheck",
16+
"format": "prettier --write \"**/*.{ts,tsx,md,json,jsonc}\"",
17+
"lint": "turbo lint",
18+
"release": "pnpm changeset publish",
19+
"test": "turbo test",
20+
"typecheck": "turbo typecheck",
21+
"version-packages": "changeset version"
22+
},
23+
"lint-staged": {
24+
"*": [
25+
"prettier --write \"**/*.{ts,tsx,md,json,jsonc}\""
26+
]
27+
},
28+
"prettier": "@vercel/style-guide/prettier",
29+
"devDependencies": {
30+
"@changesets/cli": "^2.27.12",
31+
"@vercel/style-guide": "^6.0.0",
32+
"cross-env": "^7.0.3",
33+
"husky": "^9.1.7",
34+
"lint-staged": "^15.4.3",
35+
"prettier": "^3.4.2",
36+
"syncpack": "^13.0.1",
37+
"turbo": "2.4.3",
38+
"typescript": "5.7.3"
39+
},
40+
"packageManager": "[email protected]",
41+
"engines": {
42+
"node": "20.x",
43+
"pnpm": "9.4.0"
44+
}
45+
}
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `eslint-config-custom`
2+
3+
Collection of internal eslint configurations

packages/eslint-config-custom/base.js

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
const { resolve } = require('node:path');
2+
const project = resolve(process.cwd(), 'tsconfig.json');
3+
4+
module.exports = {
5+
parserOptions: {
6+
project: ['./tsconfig.json'],
7+
},
8+
extends: [
9+
'@vercel/style-guide/eslint/browser',
10+
'@vercel/style-guide/eslint/node',
11+
'@vercel/style-guide/eslint/typescript',
12+
].map((config) => require.resolve(config)),
13+
14+
ignorePatterns: ['dist'],
15+
rules: {
16+
'eslint-comments/require-description': 'off',
17+
'@typescript-eslint/no-confusing-void-expression': 'off',
18+
camelcase: [
19+
'error',
20+
{
21+
allow: ['^UNSAFE_', '^unstable_', '^experimental_'],
22+
ignoreDestructuring: false,
23+
properties: 'never',
24+
},
25+
],
26+
},
27+
settings: {
28+
'import/resolver': {
29+
typescript: {
30+
project,
31+
},
32+
},
33+
},
34+
overrides: [
35+
{
36+
files: ['**/*.test.ts', '**/*.test.tsx'],
37+
rules: {
38+
'eslint-comments/require-description': 'off',
39+
},
40+
},
41+
],
42+
};
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "eslint-config-custom",
3+
"version": "0.0.0",
4+
"private": true,
5+
"devDependencies": {
6+
"@typescript-eslint/parser": "^8.29.0",
7+
"@vercel/style-guide": "^5.2.0",
8+
"eslint": "^8.57.0",
9+
"eslint-config-prettier": "^10.0.1"
10+
},
11+
"publishConfig": {
12+
"access": "restricted"
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['custom/base'],
3+
};
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"name": "@vercel/repository-dispatch",
3+
"version": "0.0.1",
4+
"private": false,
5+
"description": "Utilities for working with dispatch events triggered by Vercel",
6+
"keywords": [
7+
"GitHub",
8+
"Vercel"
9+
],
10+
"homepage": "https://vercel.com/docs/git/vercel-for-github#repository-dispatch",
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/vercel/repository-dispatch.git",
14+
"directory": "packages/repository-dispatch"
15+
},
16+
"sideEffects": false,
17+
"type": "module",
18+
"exports": {
19+
"./context": "./src/context.ts",
20+
"./types": "./src/types.ts",
21+
"./data": "./src/data/index.ts",
22+
"./data/common": "./src/data/common.ts",
23+
"./data/deployment": "./src/data/deployment.ts"
24+
},
25+
"typesVersions": {
26+
"*": {
27+
"context": [
28+
"src/context.ts"
29+
],
30+
"types": [
31+
"src/types.ts"
32+
],
33+
"data": [
34+
"src/data/index.ts"
35+
],
36+
"data/common": [
37+
"src/data/common.ts"
38+
],
39+
"data/deployment": [
40+
"src/data/deployment.ts"
41+
]
42+
}
43+
},
44+
"scripts": {
45+
"lint": "eslint src --ext .ts,.tsx",
46+
"lint-fix": "eslint . --fix",
47+
"test": "cross-env TZ=UTC jest --passWithNoTests",
48+
"typecheck": "tsc --noEmit"
49+
},
50+
"dependencies": {
51+
"@actions/github": "^6.0.0"
52+
},
53+
"devDependencies": {
54+
"eslint-config-custom": "workspace:*",
55+
"jest": "^29.7.0",
56+
"jest-environment-jsdom": "29.2.2",
57+
"ts-config": "workspace:*",
58+
"ts-node": "~10.9.2",
59+
"tsx": "^4.6.2",
60+
"typescript": "5.7.3"
61+
}
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const EVENT_PREFIX = 'vercel' as const;
2+
3+
export const DEPLOYMENT_ENVIRONMENTS = {
4+
production: 'production',
5+
preview: 'preview',
6+
} as const;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { context } from '@actions/github';
2+
import type { DispatchDeploymentEventType } from './types';
3+
import type { DispatchDeploymentEvent } from './data/deployment';
4+
5+
type Context = typeof context;
6+
7+
export interface RepositoryDispatchContext extends Context {
8+
eventName: 'repository_dispatch';
9+
payload: {
10+
action: DispatchDeploymentEventType;
11+
client_payload: DispatchDeploymentEvent;
12+
};
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Interface shared across all dispatched events
3+
*/
4+
export interface DispatchDataCommon {
5+
project: {
6+
name: string;
7+
id: string;
8+
};
9+
environment: string;
10+
git: {
11+
ref: string;
12+
sha: string;
13+
};
14+
}

0 commit comments

Comments
 (0)