Skip to content

Commit 1589881

Browse files
authored
Merge pull request #6 from ysk8hori/fix/needs-checkout
v0.2.1-alpha-0 workflowでチェックアウトしたものを使用する
2 parents ec0fbae + 8feff05 commit 1589881

File tree

5 files changed

+20
-18
lines changed

5 files changed

+20
-18
lines changed

.github/workflows/test-no-params.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ jobs:
99
runs-on: ubuntu-latest
1010
name: Test no params
1111
steps:
12-
- uses: ysk8hori/delta-typescript-graph-action@v0.1.17
12+
- name: Checkout
13+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
14+
- uses: ysk8hori/delta-typescript-graph-action@v0.2.1-alpha-0

.github/workflows/test-with-params.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ jobs:
99
runs-on: ubuntu-latest
1010
name: Test with params
1111
steps:
12+
- name: Checkout
13+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
1214
- name: Delta Typescript Graph
1315
id: tsg
14-
uses: ysk8hori/delta-typescript-graph-action@v0.1.17
16+
uses: ysk8hori/delta-typescript-graph-action@v0.2.1-alpha-0
1517
with:
1618
access-token: ${{ secrets.GITHUB_TOKEN }}
1719
tsconfig-root: './src'

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ jobs:
9898
runs-on: ubuntu-latest
9999
name: Delta TypeScript Graph
100100
steps:
101+
- name: Checkout
102+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # specify latest version
101103
- uses: ysk8hori/delta-typescript-graph-action@v...
102104
```
103105

dist/index.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216139,19 +216139,18 @@ const github_1 = __importDefault(__nccwpck_require__(978));
216139216139
*/
216140216140
function getFullGraph() {
216141216141
return __awaiter(this, void 0, void 0, function* () {
216142-
const { repoDir } = yield github_1.default.cloneRepo();
216143216142
// head の Graph を生成するために head に checkout する
216144-
(0, child_process_1.execSync)(`git fetch origin ${github_1.default.getHeadSha()}`, { cwd: repoDir });
216145-
(0, child_process_1.execSync)(`git checkout ${github_1.default.getHeadSha()}`, { cwd: repoDir });
216143+
(0, child_process_1.execSync)(`git fetch origin ${github_1.default.getHeadSha()}`);
216144+
(0, child_process_1.execSync)(`git checkout ${github_1.default.getHeadSha()}`);
216146216145
// head の Graph を生成
216147-
const { graph: fullHeadGraph, meta } = (0, createGraph_1.createGraph)(path_1.default.resolve(repoDir, (0, config_1.getTsconfigRoot)()));
216146+
const { graph: fullHeadGraph, meta } = (0, createGraph_1.createGraph)(path_1.default.resolve((0, config_1.getTsconfigRoot)()));
216148216147
(0, log_1.log)('fullHeadGraph.nodes.length:', fullHeadGraph.nodes.length);
216149216148
(0, log_1.log)('fullHeadGraph.relations.length:', fullHeadGraph.relations.length);
216150216149
// base の Graph を生成するために base に checkout する
216151-
(0, child_process_1.execSync)(`git fetch origin ${github_1.default.getBaseSha()}`, { cwd: repoDir });
216152-
(0, child_process_1.execSync)(`git checkout ${github_1.default.getBaseSha()}`, { cwd: repoDir });
216150+
(0, child_process_1.execSync)(`git fetch origin ${github_1.default.getBaseSha()}`);
216151+
(0, child_process_1.execSync)(`git checkout ${github_1.default.getBaseSha()}`);
216153216152
// base の Graph を生成
216154-
const { graph: fullBaseGraph } = (0, createGraph_1.createGraph)(path_1.default.resolve(repoDir, (0, config_1.getTsconfigRoot)()));
216153+
const { graph: fullBaseGraph } = (0, createGraph_1.createGraph)(path_1.default.resolve((0, config_1.getTsconfigRoot)()));
216155216154
(0, log_1.log)('fullBaseGraph.nodes.length:', fullBaseGraph.nodes.length);
216156216155
(0, log_1.log)('fullBaseGraph.relations.length:', fullBaseGraph.relations.length);
216157216156
return { fullHeadGraph, fullBaseGraph, meta };

src/getFullGraph.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,20 @@ import github from './github';
1414
* また、処理に時間がかかるため Promise を返す。
1515
*/
1616
export default async function getFullGraph() {
17-
const { repoDir } = await github.cloneRepo();
1817
// head の Graph を生成するために head に checkout する
19-
execSync(`git fetch origin ${github.getHeadSha()}`, { cwd: repoDir });
20-
execSync(`git checkout ${github.getHeadSha()}`, { cwd: repoDir });
18+
execSync(`git fetch origin ${github.getHeadSha()}`);
19+
execSync(`git checkout ${github.getHeadSha()}`);
2120
// head の Graph を生成
2221
const { graph: fullHeadGraph, meta } = createGraph(
23-
path.resolve(repoDir, getTsconfigRoot()),
22+
path.resolve(getTsconfigRoot()),
2423
);
2524
log('fullHeadGraph.nodes.length:', fullHeadGraph.nodes.length);
2625
log('fullHeadGraph.relations.length:', fullHeadGraph.relations.length);
2726
// base の Graph を生成するために base に checkout する
28-
execSync(`git fetch origin ${github.getBaseSha()}`, { cwd: repoDir });
29-
execSync(`git checkout ${github.getBaseSha()}`, { cwd: repoDir });
27+
execSync(`git fetch origin ${github.getBaseSha()}`);
28+
execSync(`git checkout ${github.getBaseSha()}`);
3029
// base の Graph を生成
31-
const { graph: fullBaseGraph } = createGraph(
32-
path.resolve(repoDir, getTsconfigRoot()),
33-
);
30+
const { graph: fullBaseGraph } = createGraph(path.resolve(getTsconfigRoot()));
3431
log('fullBaseGraph.nodes.length:', fullBaseGraph.nodes.length);
3532
log('fullBaseGraph.relations.length:', fullBaseGraph.relations.length);
3633
return { fullHeadGraph, fullBaseGraph, meta };

0 commit comments

Comments
 (0)