StackOverflow: Fetch and Post StackOverflow Questions #179
This file contains hidden or 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: "StackOverflow: Fetch and Post StackOverflow Questions" | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 * * * *" | |
jobs: | |
fetch_and_post_questions: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up Python | |
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
with: | |
python-version: '3.13' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
- name: Restore statefile cache | |
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
id: restore_cache | |
with: | |
path: state.txt | |
key: stackoverflow-state- | |
restore-keys: stackoverflow-state- | |
- name: Fetch and post questions | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
run: | | |
if [ -z "${SLACK_WEBHOOK_URL}" ]; then | |
echo "SLACK_WEBHOOK_URL secret is not set. Skipping the action." | |
else | |
python stackoverflow/action.py | |
fi | |
- name: Save statefile cache | |
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
if: always() | |
id: save_cache | |
with: | |
path: state.txt | |
key: stackoverflow-state-${{ github.run_id }} |