Skip to content

Commit

Permalink
ci: remove branch filter (#519)
Browse files Browse the repository at this point in the history
* ci: remove branch filter

Signed-off-by: Vincenzo Scamporlino <[email protected]>

* ci: always verify noop workspace

Signed-off-by: Vincenzo Scamporlino <[email protected]>

---------

Signed-off-by: Vincenzo Scamporlino <[email protected]>
  • Loading branch information
vinzscam authored Jun 4, 2024
1 parent b6a8292 commit 1120e30
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: CI

on:
pull_request:
paths:
- "workspaces/**"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
32 changes: 16 additions & 16 deletions scripts/ci/list-workspaces-with-changes.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { execFile as execFileCb } from 'child_process';
import { promises as fs } from 'fs';
import { promisify } from 'util';
import { resolve as resolvePath } from 'path';
import { EOL } from 'os';
import { execFile as execFileCb } from "child_process";
import { promises as fs } from "fs";
import { promisify } from "util";
import { resolve as resolvePath } from "path";
import { EOL } from "os";

import * as url from 'url';
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
import * as url from "url";
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));

const parentRef = process.env.COMMIT_SHA_BEFORE || 'origin/main';
const parentRef = process.env.COMMIT_SHA_BEFORE || "origin/main";

const execFile = promisify(execFileCb);

Expand All @@ -23,32 +23,32 @@ async function runPlain(cmd, ...args) {
throw error;
}
throw new Error(
`Command '${[cmd, ...args].join(' ')}' failed with code ${error.code}`
`Command '${[cmd, ...args].join(" ")}' failed with code ${error.code}`
);
}
}

async function main() {
if (!process.env.GITHUB_OUTPUT) {
throw new Error('GITHUB_OUTPUT environment variable not set');
throw new Error("GITHUB_OUTPUT environment variable not set");
}

const repoRoot = resolvePath(__dirname, '..', '..');
const repoRoot = resolvePath(__dirname, "..", "..");
process.chdir(repoRoot);

const diff = await runPlain('git', 'diff', '--name-only', parentRef);
const diff = await runPlain("git", "diff", "--name-only", parentRef);

const packageList = diff.split('\n');
const packageList = diff.split("\n");

const workspaces = new Set();
const workspaces = new Set(["noop"]);
for (const path of packageList) {
const match = path.match(/^workspaces\/([^/]+)\//);
if (match) {
workspaces.add(match[1]);
}
}

console.log('workspaces found with changes:', Array.from(workspaces));
console.log("workspaces found with changes:", Array.from(workspaces));

for (const workspace of workspaces) {
if (
Expand All @@ -60,7 +60,7 @@ async function main() {
}
}

console.log('workspaces that exist:', Array.from(workspaces));
console.log("workspaces that exist:", Array.from(workspaces));

await fs.appendFile(
process.env.GITHUB_OUTPUT,
Expand Down

0 comments on commit 1120e30

Please sign in to comment.