Daily Topic Modeling on Elasticsearch Index #504
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: Daily Topic Modeling on Elasticsearch Index | |
on: | |
schedule: | |
- cron: "30 3 * * *" | |
workflow_dispatch: | |
repository_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
execute_and_commit: | |
runs-on: ubuntu-latest | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
ES_CLOUD_ID: ${{ secrets.ES_CLOUD_ID }} | |
ES_USERNAME: ${{ secrets.ES_USERNAME }} | |
ES_PASSWORD: ${{ secrets.ES_PASSWORD }} | |
ES_INDEX: ${{ secrets.ES_INDEX }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.10.x | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Execute Python script | |
run: python generate_topic_modeling_csv.py | |
- name: Configure Git | |
run: | | |
git config user.email "${{ secrets.GIT_AUTHOR_EMAIL }}" | |
git config user.name "${{ secrets.GIT_AUTHOR_NAME }}" | |
- name: Add and commit changes | |
run: | | |
git add . | |
if git diff --staged --quiet; then | |
echo "No changes to commit" | |
else | |
git pull | |
git commit -m "Updated csv files with topics from latest ES docs" | |
git push | |
fi |