diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ce2972a..225c1ab 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,7 +22,8 @@ jobs: - name: Initialize Bit uses: bit-tasks/init@v2 with: - ws-dir: 'test-data' + ws-dir: '' + lane-name: ${{ github.event.inputs.lane_name }} - name: Creating a bare scope run: mkdir org.scope-name && cd org.scope-name && bit init --bare - name: Start the server and test @@ -34,7 +35,6 @@ jobs: - name: Bit Lane Branch uses: bit-tasks/lane-branch@main with: - lane-name: ${{ github.event.inputs.lane_name }} branch-name: 'main' skip-push: 'true' - name: Bit Lanes diff --git a/README.md b/README.md index 07600e9..54dfb45 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,6 @@ This task synchronize updates to a Bit lane with its respective Git Branch. As t **Optional** The workspace directory path from the root. Default `"Dir specified in Init Task or ./"`. -### `lane-name` - -**Required** The source Bit lane name where the updates are fetched from. - ### `branch-name` **Optional** The destination Bit branch name where the component updates are sync to. Default `lane-name`. @@ -58,10 +54,9 @@ jobs: uses: bit-tasks/init@v2 with: ws-dir: '' + lane-name: ${{ github.event.inputs.lane_name }} - name: Bit Lane Branch uses: bit-tasks/lane-branch@v1 - with: - lane-name: ${{ github.event.inputs.lane_name }} ``` # Contributor Guide diff --git a/action.yml b/action.yml index 051a4d5..b36437f 100644 --- a/action.yml +++ b/action.yml @@ -7,9 +7,6 @@ inputs: ws-dir: description: "Workspace json file directory path" required: false - lane-name: - description: "The source Bit lane name where the updates are fetched from" - required: true branch-name: description: "The destination Git branch name where the updates are sync to" required: false diff --git a/index.ts b/index.ts index e4f7008..837352e 100644 --- a/index.ts +++ b/index.ts @@ -3,14 +3,14 @@ import run from "./scripts/lane-branch"; try { const wsDir: string = core.getInput("ws-dir") || process.env.WSDIR || "./"; - const laneName: string = core.getInput("lane-name"); - const branchName: string = core.getInput("branch-name") || laneName; + const laneName = process.env.LANE_NAME; + const branchName: string = core.getInput("branch-name") || laneName || process.env.GITHUB_REF?.split("/").slice(-1)[0] || 'main'; const skipPush: boolean = core.getInput("skip-push") === "true" ? true : false; const skipCI: boolean = core.getInput("skip-ci") === "false" ? false : true; - if (!laneName) { - throw new Error("Lane name is not found"); + if (!process.env.LANE_NAME) { + throw new Error("Lane is not found"); } if (laneName === "main") { diff --git a/scripts/lane-branch.ts b/scripts/lane-branch.ts index 36236c1..6dd139a 100644 --- a/scripts/lane-branch.ts +++ b/scripts/lane-branch.ts @@ -10,24 +10,18 @@ const run = async ( wsdir: string ) => { - await exec(`bit lane import ${laneName}`, [], { cwd: wsdir }); - - // Remove snap hashes and lane details from .Bitmap - await exec("bit init --reset-lane-new", [], { cwd: wsdir }); + await exec("bit status --strict", [], { cwd: wsdir }); // Git operations await exec(`git config --global user.name "${gitUserName}"`, [], { cwd: wsdir, }); - await exec(`git config --global user.email "${gitUserEmail}"`, [], { cwd: wsdir, }); - await exec(`git checkout -b ${branchName}`, [], { cwd: wsdir, }); - await exec("git add .", [], { cwd: wsdir }); try {