Skip to content

Commit

Permalink
Merge pull request #933 from Green-Software-Foundation/if-check-new-line
Browse files Browse the repository at this point in the history
Fix removing the last empty line in the package.json
  • Loading branch information
narekhovhannisyan authored Aug 6, 2024
2 parents c0c6b29 + 7e6f61b commit c7cab7f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
38 changes: 37 additions & 1 deletion .github/workflows/release-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
PRE_RELEASE: ${{ github.event.release.prerelease}}

jobs:
release-commit-pr:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -28,9 +28,45 @@ jobs:
- name: Run unit tests
run: npm test

integration-tests:
runs-on: ubuntu-latest
needs: unit-tests
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/

- name: Install dependencies
run: npm ci

- name: Run integration tests
run: npm run if-check -- -d manifests/outputs

publish:
runs-on: ubuntu-latest
needs: integration-tests
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/

- name: Install dependencies
run: npm ci

- name: Initialize git user email
run: git config --global user.email "${{ vars.RELEASE_USER_EMAIL }}"

Expand Down
3 changes: 3 additions & 0 deletions src/__mocks__/fs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ export const writeFile = async (pathToFile: string, content: string) => {
}
};

export const appendFile = (file: string, appendContent: string) =>
`${file}${appendContent}`;

export const stat = async (filePath: string) => {
if (filePath === 'true') {
return true;
Expand Down
1 change: 1 addition & 0 deletions src/if-env/util/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export const updatePackageJsonDependencies = async (
packageJsonPath,
JSON.stringify(parsedPackageJson, null, 2)
);
await fs.appendFile(packageJsonPath, '\n');
};

/**
Expand Down

0 comments on commit c7cab7f

Please sign in to comment.