Skip to content

Changes entry 1

Changes entry 1 #17

Workflow file for this run

name: CI
on:
pull_request:
branches:
- main
permissions:
contents: write
pull-requests: write
repository-projects: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Install modules
run: pnpm install
- name: Check for automated commit
run: echo $(git diff-tree --no-commit-id --name-only -r HEAD)
- name: Check changed files
uses: actions/github-script@v6
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.number }}
with:
script: |
const { execSync } = require('child_process')
const { commits } = context.payload.pull_request
console.log(commits)
const rawFiles = execSync(`git diff --name-only HEAD HEAD~${commits}`).toString()
console.log('rawFiles', rawFiles)
const files = rawFiles.split('\n').filter(Boolean)
console.log(files)
const fs = require('fs');
const tsGraph = require('@andriyorehov/ts-graph');
const owners = fs.readFileSync('owners.json', 'utf8');
const ownersObj = JSON.parse(owners);
for (const owner of ownersObj) {
for (const entries of owner.owns) {
console.log(Object.keys(tsGraph.getTreeByFile(entries).flatTree));
}
}
execSync(`gh pr edit ${process.env.PR_NUMBER} --add-reviewer andriyor`)