respec-web-services icon indicating copy to clipboard operation
respec-web-services copied to clipboard

Add path / file to the github commit APIs

Open jnurthen opened this issue 1 year ago • 3 comments

The GH commits API includes path in https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28

path string Only commits containing this file path will be returned.

Our repository contains multiple specifications and we would like to filter the GH commits so only commits against the particular repo are included in the changelog / commit history (perhaps other places too).

I'm happy to work on this but am having difficulty building respec-web-services to be able to work on this. Can you please help.

jnurthen avatar Jul 30 '24 22:07 jnurthen

Sorry for the wait!

I'm happy to work on this but am having difficulty building respec-web-services to be able to work on this. Can you please help.

Let me add the quick instructions here, will add professionally written ones in Readme later.

Set up dev toolchain

Pre-requisites: Node v20

cd /path/to/respec-web-services
corepack enable # enables pnpm support; corepack comes built-in with Node
pnpm i
mkdir -p data # create a directory for data if it doesn't exist; it's .gitignored

Set up required env variables

cp .env.sample .env

We only require two values here correctly: DATA_DIR (/path/to/respec-web-services/data) and GH_TOKEN (to access GitHub API).

Start developing

Call from project root:

# start build process
pnpm build:watch

# in another terminal, start the Node web server
node build/app.js # runs server on port 8000 by default, can pass PORT env variable
# or, if you want live reload the Node server during dev:
nodemon -w build build/app.js

Then you can curl or Postman or visit URLs in browser to send requests.

Let me know if you face any difficulties. Feel free to ping in W3C #respec Slack for sync communication.

sidvishnoi avatar Jul 31 '24 12:07 sidvishnoi

Note that the commits endpoint calls GitHub's GraphQL API for commits, not the REST API.

Relevant GraphQL Query in respec-web-services: https://github.com/speced/respec-web-services/blob/a6fa5e0095ca22a62db1b788055532e34a17342d/routes/github/lib/commits.ts#L121-L145

sidvishnoi avatar Jul 31 '24 12:07 sidvishnoi

Thanks - the instructions are missing the following (for when you write the instructions) but I have an environment now.

pnpm update-data-sources

jnurthen avatar Jul 31 '24 21:07 jnurthen

Closed by https://github.com/speced/respec-web-services/issues/435

sidvishnoi avatar Aug 23 '24 16:08 sidvishnoi