Skip to content
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

Merge changes #11

Merged
merged 4 commits into from
Jun 8, 2023
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
46 changes: 46 additions & 0 deletions .github/workflows/ai-security-check-for-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: AI Security Check for Pull Requests

on:
pull_request:
branches:
- main

jobs:
ai_security_check_for_pull_requests:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v2
Comment on lines +13 to +14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 OpenAI

The actions/checkout@v2 action is already set up in the workflow file. No need to add it again.


- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 16
Comment on lines +16 to +19
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 OpenAI

The actions/setup-node@v2 action installs Node.js and sets up the environment for running npm commands. The version of Node.js used here is 16.0.0. This version may not be compatible with all dependencies. Consider using a version that is compatible with all dependencies or specify the exact version required by the dependencies.

Suggested change
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 16
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: <exact version required by dependencies>


- name: Install dependencies
run: npm ci

- name: Finding security and privacy code vulnerabilities
id: ai_security_check
uses: obetomuniz/[email protected]
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_REPOSITORY: ${{ github.repository }}
GH_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.number }}
OPENAI_TOKEN: ${{ secrets.OCO_OPENAI_API_KEY }}

Comment on lines +24 to +32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 OpenAI

The obetomuniz/[email protected] action checks for security and privacy code vulnerabilities in pull requests using an AI tool. It requires access to the GitHub token and OpenAI API key. Ensure that these secrets are properly configured in the repository's settings. Also, consider adding a step to check if the secrets are available before running the action.

Suggested change
- name: Finding security and privacy code vulnerabilities
id: ai_security_check
uses: obetomuniz/[email protected]
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_REPOSITORY: ${{ github.repository }}
GH_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.number }}
OPENAI_TOKEN: ${{ secrets.OCO_OPENAI_API_KEY }}
- name: Check secrets
run: |
if [ -z "${{ secrets.GH_TOKEN }}" ]; then
echo "GH_TOKEN secret is missing";
exit 1;
fi
if [ -z "${{ secrets.OCO_OPENAI_API_KEY }}" ]; then
echo "OCO_OPENAI_API_KEY secret is missing";
exit 1;
fi
- name: Finding security and privacy code vulnerabilities
id: ai_security_check
uses: obetomuniz/[email protected]
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_REPOSITORY: ${{ github.repository }}
GH_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.number }}
OPENAI_TOKEN: ${{ secrets.OCO_OPENAI_API_KEY }}

- name: Comment on pull request
uses: actions/github-script@v6
env:
PR_COMMENT: ${{ steps.ai_security_check.outputs.pr_comment }}
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const prComment = process.env.PR_COMMENT || "No security or privacy issues found.";
const { data } = await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: prComment
});
Comment on lines +34 to +46
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 OpenAI

The actions/github-script@v6 action comments on the pull request with the results of the AI security check. The comment body is set to the output of the previous step. Consider adding a check to ensure that the comment body is not empty before commenting on the pull request.

Suggested change
uses: actions/github-script@v6
env:
PR_COMMENT: ${{ steps.ai_security_check.outputs.pr_comment }}
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const prComment = process.env.PR_COMMENT || "No security or privacy issues found.";
const { data } = await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: prComment
});
- name: Comment on pull request
if: steps.ai_security_check.outputs.pr_comment != ''
uses: actions/github-script@v6
env:
PR_COMMENT: ${{ steps.ai_security_check.outputs.pr_comment }}
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const prComment = process.env.PR_COMMENT || "No security or privacy issues found.";
const { data } = await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: prComment
});

19 changes: 9 additions & 10 deletions .github/workflows/md_links.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@

name: Check Links

on:
push:
push:

jobs:
markdown-link-check:
name: Check markdown files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Markdown links check
uses: ruzickap/action-my-markdown-link-checker@v1
markdown-link-check:
name: Check markdown files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Markdown links check
uses: ruzickap/action-my-markdown-link-checker@v1.1.0
12 changes: 6 additions & 6 deletions .github/workflows/md_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: Lint MarkDown
on: [push]

jobs:
markdownlint:
runs-on: ubuntu-latest
steps:
- uses: "articulate/actions-markdownlint@v1"
with:
config: "markdownlint.json"
markdownlint:
runs-on: ubuntu-latest
steps:
- uses: "articulate/actions-markdownlint@v1.1.0"
with:
config: "markdownlint.json"
22 changes: 22 additions & 0 deletions .github/workflows/openai-pr-description.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: OpenAI PR Description Generator

on:
pull_request:
types:
- opened
- synchronize

permissions:
pull-requests: write
contents: read

jobs:
pull-request:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Ant0wan/[email protected]
with:
api-key: ${{ secrets.OCO_OPENAI_API_KEY }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29 changes: 29 additions & 0 deletions .github/workflows/openai-pr-reviewer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Code Review

permissions:
contents: read
pull-requests: write

on:
pull_request:
pull_request_review_comment:
types: [created]

concurrency:
group: ${{ github.repository }}-${{ github.event.number || github.head_ref ||
github.sha }}-${{ github.workflow }}-${{ github.event_name ==
'pull_request_review_comment' && 'pr_comment' || 'pr' }}
cancel-in-progress: ${{ github.event_name != 'pull_request_review_comment' }}

jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: fluxninja/openai-pr-reviewer@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OCO_OPENAI_API_KEY }}
with:
debug: false
review_simple_changes: false
review_comment_lgtm: false