Skip to content

Commit 299cde9

Browse files
Jiralitesdanialraza
authored andcommitted
ci: disallow changes to these directories
1 parent 699c3df commit 299cde9

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Validate only supported API version changes
2+
on:
3+
pull_request:
4+
branches: '**'
5+
paths:
6+
- gateway/v6.ts
7+
- gateway/v8.ts
8+
- payloads/v6/**/*
9+
- payloads/v8/**/*
10+
- rest/v6/**/*
11+
- rest/v8/**/*
12+
- utils/v8.ts
13+
- v6.ts
14+
- v8.ts
15+
jobs:
16+
validate:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout Project
20+
uses: actions/checkout@v4
21+
22+
- name: Use Node.js v18
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: 18
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Request changes
31+
run: node ./scripts/actions/unsupported-api-version-changes.mjs
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { readFile } from 'node:fs/promises';
2+
import process from "node:process";
3+
import { Octokit } from '@octokit/action';
4+
5+
const octokit = new Octokit();
6+
const [OWNER, REPOSITORY] = process.env.GITHUB_REPOSITORY.split('/');
7+
8+
/** @type {import('@octokit/webhooks-types').PullRequestOpenedEvent | import('@octokit/webhooks-types').PullRequestSynchronizeEvent} */
9+
const prEvent = JSON.parse(await readFile(process.env.GITHUB_EVENT_PATH, 'utf8'));
10+
const { pull_request: { number } } = prEvent;
11+
12+
await octokit.pulls.createReview({
13+
event: "REQUEST_CHANGES",
14+
body: "Please only update supported API versions.",
15+
owner: OWNER,
16+
repo: REPOSITORY,
17+
pull_number: number,
18+
});

0 commit comments

Comments
 (0)