Skip to content

Commit

Permalink
Fix code snippet job (#484)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Rey authored Oct 17, 2023
1 parent 9e898f9 commit d5d4645
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/massa-web3-code-snippets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ on:
jobs:
generate-code-snippets:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/massa-web3/

permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository.
Expand Down
5 changes: 3 additions & 2 deletions scripts/transform-code-snippet-tests.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { readdir, readFile, writeFile } from 'fs';
import { join } from 'path';
const massaWeb3Path = 'packages/massa-web3';

const testCodeSnippetDirectory = './test/code-snippets';
const testCodeSnippetDirectory = `${massaWeb3Path}/test/code-snippets`;

// Extract import statements from the content
const extractImports = (content) => {
Expand Down Expand Up @@ -51,7 +52,7 @@ readdir(testCodeSnippetDirectory, (err, files) => {
const snippetContent = `${importStatements}\n\n${transformedContent}`;

const newFilePath = join(
'./code-snippets',
`${massaWeb3Path}/code-snippets`,
fileName.replace('.spec', ''),
);
writeFile(newFilePath, snippetContent, 'utf8', (err) => {
Expand Down

0 comments on commit d5d4645

Please sign in to comment.