-
Notifications
You must be signed in to change notification settings - Fork 23
package lock check #147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
package lock check #147
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| name: Check Package Lock File | ||
|
|
||
| concurrency: | ||
| group: check-package-lock-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - "**" # Run on push to any branch | ||
| pull_request: | ||
| branches: | ||
| - "**" # Run on PR to any branch | ||
|
|
||
| jobs: | ||
| verify-package-lock: | ||
| name: Verify package-lock.json exists | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Check if package-lock.json exists | ||
| run: | | ||
| if [ ! -f "package-lock.json" ]; then | ||
| echo "ERROR: package-lock.json file is missing from the repository" | ||
| echo "This file is required to ensure consistent dependency versions across all environments" | ||
| echo "Please ensure package-lock.json is committed with your changes" | ||
| exit 1 | ||
| fi | ||
| echo "SUCCESS: package-lock.json file is present" | ||
|
|
||
| - name: Verify package-lock.json is not empty | ||
| run: | | ||
| if [ ! -s "package-lock.json" ]; then | ||
| echo "ERROR: package-lock.json file exists but is empty" | ||
| echo "Please run 'npm install' to regenerate the lock file" | ||
| exit 1 | ||
| fi | ||
| echo "SUCCESS: package-lock.json file is valid and not empty" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI about 1 month ago
To fix the problem, explicitly set the GITHUB_TOKEN permissions to the minimum required for this workflow. Since it only checks out the repository and reads
package-lock.json, it only needs read access to repository contents.The best fix without changing functionality is to add a
permissionsblock withcontents: read. You can add this at the workflow root (so it applies to all jobs) or under the specific job. Following the CodeQL recommendation and keeping the change minimal, add a top-levelpermissionsblock after theon:section. Concretely, in.github/workflows/check-package-lock.yml, insert:between the
on:block (ending at line 13) and thejobs:key at line 15. No imports or other definitions are needed.