From b67e4c0e6df5d266f17ceae1b6d26264313076d8 Mon Sep 17 00:00:00 2001 From: Ron Netzer Date: Sun, 6 Mar 2022 19:53:23 +0200 Subject: [PATCH] fix(utils): workspace file path is not resolved (#34) --- .github/workflows/main.yml | 29 +++++++------------------- packages/nx-affected-matrix/action.yml | 1 + packages/utils/src/lib/fs.ts | 2 +- 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index db4bbf9e..9f8e0217 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,12 +15,6 @@ jobs: hasChanges: ${{ steps.affected.outputs.hasChanges }} matrix: ${{ steps.affected.outputs.matrix }} steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - uses: e-square-io/.github/.github/actions/npm-ci@main - - name: Calculate Affected Projects uses: e-square-io/nx-affected-matrix@v2 id: affected @@ -67,9 +61,6 @@ jobs: if: ${{ fromJSON(needs.setup.outputs.hasChanges) && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') }} needs: [setup, execute] runs-on: ubuntu-latest - outputs: - hasChanges: ${{ steps.affected.outputs.hasChanges || needs.setup.outputs.hasChanges }} - matrix: ${{ steps.affected.outputs.matrix || needs.setup.outputs.matrix }} steps: - uses: actions/checkout@v2 @@ -85,17 +76,13 @@ jobs: with: targets: build maxDistribution: 1 - debug: true +# debug: true e2e-execute: - name: E2E nx-distributed-task [${{ matrix.target }} (${{ matrix.distribution }})] - if: ${{ fromJSON(needs.e2e-distribute.outputs.hasChanges) && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && contains(needs.setup.outputs.matrix, 'nx-distributed-task') }} - needs: [setup,e2e-distribute] + name: E2E nx-distributed-task + if: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && contains(needs.setup.outputs.matrix, 'nx-distributed-task') }} + needs: [setup, execute] runs-on: ubuntu-latest - continue-on-error: ${{ matrix.target == 'test' }} - strategy: - fail-fast: false - matrix: ${{ fromJSON(needs.e2e-distribute.outputs.matrix) }} steps: - name: Checkout uses: actions/checkout@v2 @@ -111,10 +98,10 @@ jobs: uses: ./dist/packages/nx-distributed-task id: run with: - target: ${{ matrix.target }} - distribution: ${{ matrix.distribution }} - projects: ${{ matrix.projects }} - debug: true + target: build + distribution: 1 + projects: 'nx-affected-matrix' +# debug: true release: name: Release version diff --git a/packages/nx-affected-matrix/action.yml b/packages/nx-affected-matrix/action.yml index 1850078f..2db02dbc 100644 --- a/packages/nx-affected-matrix/action.yml +++ b/packages/nx-affected-matrix/action.yml @@ -75,5 +75,6 @@ runs: const { default: setEnv } = require('${{ github.action_path }}/set-env.js'); const { default: main } = require('${{ github.action_path }}/main.js'); + console.log(JSON.stringify(process.env, null, 2)); setEnv(${{ toJSON(inputs) }}, process); await main(context, core); diff --git a/packages/utils/src/lib/fs.ts b/packages/utils/src/lib/fs.ts index e18c0b84..a1f154b5 100644 --- a/packages/utils/src/lib/fs.ts +++ b/packages/utils/src/lib/fs.ts @@ -50,7 +50,7 @@ export class GHTree implements Tree { } resolve(path: string): string { - return resolve(this.root, path); + return resolve(this.root, path.startsWith('/') ? path.slice(1) : path); } getLockFilePath(): string | void {