Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI Pipeline

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "20"

- name: Install dependencies
run: npm install

# - name: Run tests
# run: npm run test

- name: Build Next.js app
run: npm run build

build-docker:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
container:
image: gcr.io/kaniko-project/executor:latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Kaniko Configuration
run: |
mkdir -p /kaniko/.docker
echo '{
"auths": {
"${{ secrets.REGISTRY_URL }}": {
"username": "${{ secrets.REGISTRY_USERNAME }}",
"password": "${{ secrets.REGISTRY_PASSWORD }}"
}
}
}' > /kaniko/.docker/config.json

- name: Build and Push Docker Image
run: |
/kaniko/executor \
--context . \
--dockerfile ./Dockerfile \
--destination ${{ secrets.REGISTRY_URL }}/my-app:${{ github.sha }}
Comment on lines +34 to +59

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 10 months ago

To fix the issue, we need to explicitly define the permissions for the workflow and its jobs. Since the workflow primarily interacts with the repository contents (e.g., checking out code), the minimal required permission is contents: read. This permission should be added at the root level of the workflow to apply to all jobs unless overridden. If specific jobs require additional permissions, they can define their own permissions block.


Suggested changeset 1
.github/workflows/ci.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -10,2 +10,5 @@
 
+permissions:
+  contents: read
+
 jobs:
EOF
@@ -10,2 +10,5 @@

permissions:
contents: read

jobs:
Copilot is powered by AI and may make mistakes. Always verify output.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ yarn-error.log*
next-env.d.ts

# jetBrains
.idea
.idea
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files.associations": {
"*.yaml": "home-assistant"
}
}
15 changes: 15 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const nextJest = require('next/jest');

const createJestConfig = nextJest({
dir: './',
});

const customJestConfig = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testEnvironment: 'jest-environment-jsdom',
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
};

module.exports = createJestConfig(customJestConfig);
1 change: 1 addition & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom';
Loading