diff --git a/.github/workflows/import_meetup_events.yml b/.github/workflows/import_meetup_events.yml new file mode 100644 index 00000000..11a8710a --- /dev/null +++ b/.github/workflows/import_meetup_events.yml @@ -0,0 +1,69 @@ +name: Import Meetup Events + +on: + workflow_dispatch: + schedule: + - cron: '0 6 * * *' # every day at 6am GMT + +jobs: + import-meetup: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Download iCal file + run: | + mkdir -p tools/files + curl -L "https://www.meetup.com/women-coding-community/events/ical/" -o tools/files/meetup.ics + + - name: Cache pip + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('tools/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r tools/requirements.txt + + - name: Run Meetup import script + run: | + cd tools + python meetup_import.py + + - name: Merge imported events into events.yml + run: | + if [ -s _data/imported_events.yml ]; then + cat _data/imported_events.yml >> _data/events.yml + : > _data/imported_events.yml + echo "New events have been added to events.yml and imported_events.yml has been reset." + else + echo "No new events to import." + fi + + - name: Create or Update Pull Request + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ secrets.MEETUP_IMPORT_ACTIONS_TOKEN }} + commit-message: "Automated import of Meetup events" + branch: "automation/import-meetup-events" + team-reviewers: "Women-Coding-Community/leaders" + title: "Automated import of Meetup events" + body: | + This PR was created automatically by a GitHub Action to import upcoming Meetup events. + Only `_data/events.yml` should be updated. + + Please review the changes `_data/events.yml` and ensure that everything is parsed correctly before merging. + labels: | + automation +