Discussion auto-responder #106
This file contains 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
name: Discussion auto-responder | |
on: | |
discussion: | |
types: [created] | |
env: | |
GH_SERVICE_ACC_DISCUSSIONS_TOKEN: ${{ secrets.GH_SERVICE_ACC_DISCUSSIONS_TOKEN }} | |
OPENAI_API_SECRET: ${{ secrets.OPENAI_API_SECRET }} | |
jobs: | |
on_discussion_open: | |
runs-on: ubuntu-latest | |
permissions: | |
discussions: write | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js 20.5 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.5.x | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- name: Load Yarn cache | |
uses: actions/cache@v3 | |
id: yarn_cache_id | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn | |
- name: Node modules cache | |
uses: actions/cache@v3 | |
id: node_modules_cache_id | |
with: | |
path: | | |
node_modules | |
*/*/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- name: Install Dependencies | |
if: steps.yarn_cache_id.outputs.cache-hit != 'true' || steps.node_modules_cache_id.outputs.cache-hit != 'true' | |
run: yarn install --immutable | |
- name: Run responder script | |
run: yarn ci:autorespond | |
env: | |
DISCUSSION_NODE_ID: ${{ github.event.discussion.node_id }} | |
DISCUSSION_BODY: ${{ github.event.discussion.body }} |