Skip to content

Commit

Permalink
Remove lane name from attribute and use from init task
Browse files Browse the repository at this point in the history
  • Loading branch information
AshanFernando committed Aug 8, 2024
1 parent 93fa4cb commit acabb02
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
- name: Initialize Bit
uses: bit-tasks/init@v2
with:
ws-dir: 'test-data'
ws-dir: '<WORKSPACE_DIR_PATH>'
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
Expand All @@ -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
Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -58,10 +54,9 @@ jobs:
uses: bit-tasks/init@v2
with:
ws-dir: '<WORKSPACE_DIR_PATH>'
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
Expand Down
3 changes: 0 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
8 changes: 1 addition & 7 deletions scripts/lane-branch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit acabb02

Please sign in to comment.