forked from Codecademy/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (49 loc) · 1.59 KB
/
push.yml
File metadata and controls
55 lines (49 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Push
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: Codecademy/run-on-yarn@v2.0.0
with:
command: ${{ matrix.command }}
strategy:
fail-fast: false
matrix:
command: ["compile", "format:verify", "lint:js", "lint:md", "test"]
ai-moderation-comment: # just a POC for hackathon, not prod ready!
if: github.repository_owner == 'codecademy-docs' # dont run on a fork that doesnt have openai key
name: AI moderation comment
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # important for changed-files action
- name: Get newly added files in content dir
id: changed-files
uses: tj-actions/changed-files@v35
with:
files: 'content/**/*.md'
- name: Echo the list of new md files in content dir
run: |
for file in ${{ steps.changed-files.outputs.added_files }}; do
echo "$file was added\n"
done
# TODO: stop the job if there are no files in the list
- name: Ask OpenAI
id: openai
uses: codecademy-docs/openai-moderation-action@main
with:
OPEN_AI_API_KEY: ${{ secrets.OPEN_AI_API_KEY }}
filepaths: ${{ steps.changed-files.outputs.added_files }}
- name: Comment PR
uses: thollander/actions-comment-pull-request@v2
with:
message: |
The ai response: ${{ steps.openai.outputs.message }}
on:
push:
branches:
- main
pull_request: