comment-regularly #99
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: comment-regularly | |
on: | |
schedule: | |
- cron: '45 05 * * 5' | |
workflow_dispatch: | |
inputs: | |
group_id: | |
description: 'VK group id' | |
required: false | |
default: 'stawclub' | |
time: | |
description: 'Expect new post at' | |
required: false | |
default: '06:00' | |
jobs: | |
comment: | |
env: | |
VK_TOKEN: ${{ secrets.VK_TOKEN }} | |
VK_BOT_KEY: ${{ secrets.VK_BOT_KEY }} | |
NOTIFIEE_ID: ${{ secrets.NOTIFIEE_ID }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests pygments | |
- name: Run the script with arguments provided via GUI | |
if: ${{ github.event.inputs.group_id != '' }} | |
run: | | |
python3 cli.py -vvv --no-keyring --plus --github-workaround \ | |
--token "$VK_TOKEN" \ | |
--group-id "${{ github.event.inputs.group_id }}" \ | |
--posted-at "${{ github.event.inputs.time }}" | |
- name: Notify about workflow being triggered | |
if: ${{ github.event.inputs.group_id == '' }} | |
run: | | |
python3 notify.py --bot-key "$VK_BOT_KEY" --no-keyring \ | |
--include-time --user-id "$NOTIFIEE_ID" \ | |
"Workflow has started, waiting for new post" | |
- name: Run the script on schedule for the closest 'HH:00' time | |
if: ${{ github.event.inputs.group_id == '' }} | |
run: | | |
python3 cli.py -vvv --no-keyring --token "$VK_TOKEN" \ | |
--medal --soon-and-sharp |