Skip to content

Commit

Permalink
Merge pull request #38 from boldare/chore/github-actions
Browse files Browse the repository at this point in the history
docs: workflow for publishing new release versions
  • Loading branch information
sebastianmusial committed Mar 14, 2024
2 parents c41b78a + 45e77db commit 2b75421
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Publish package to GitHub Packages
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to GitHub Packages
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://npm.pkg.github.com'
scope: '@boldare'
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.BOLDARE_GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion libs/ai-assistant/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@boldare/ai-assistant",
"version": "0.0.2-dev.3",
"version": "0.0.2-dev.5",
"private": false,
"dependencies": {
"tslib": "^2.3.0",
"openai": "^4.26.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,18 @@ describe('AssistantMemoryService', () => {
);
});

it('should log error', async () => {
const error = new Error('error');
const sourcePath = './.env';
const readFileSpy = jest
.spyOn(fs.promises, 'readFile')
.mockRejectedValue(error);
const loggerSpy = jest.spyOn(assistantMemoryService['logger'], 'error');

await assistantMemoryService.saveAssistantId('456');

expect(readFileSpy).toHaveBeenCalledWith(sourcePath);
expect(loggerSpy).toHaveBeenCalledWith(`Can't save variable: ${error}`);
});
});
});

0 comments on commit 2b75421

Please sign in to comment.