|
| 1 | +name: Import Meetup Events |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + schedule: |
| 6 | + - cron: '0 6 * * *' # every day at 6am GMT |
| 7 | + |
| 8 | +jobs: |
| 9 | + import-meetup: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Checkout repository |
| 14 | + uses: actions/checkout@v5 |
| 15 | + |
| 16 | + - name: Set up Python |
| 17 | + uses: actions/setup-python@v5 |
| 18 | + with: |
| 19 | + python-version: '3.12' |
| 20 | + |
| 21 | + - name: Download iCal file |
| 22 | + run: | |
| 23 | + mkdir -p tools/files |
| 24 | + curl -L "https://www.meetup.com/women-coding-community/events/ical/" -o tools/files/meetup.ics |
| 25 | + |
| 26 | + - name: Cache pip |
| 27 | + uses: actions/cache@v4 |
| 28 | + with: |
| 29 | + path: ~/.cache/pip |
| 30 | + key: ${{ runner.os }}-pip-${{ hashFiles('tools/requirements.txt') }} |
| 31 | + restore-keys: | |
| 32 | + ${{ runner.os }}-pip- |
| 33 | +
|
| 34 | + - name: Install dependencies |
| 35 | + run: | |
| 36 | + python -m pip install --upgrade pip |
| 37 | + pip install -r tools/requirements.txt |
| 38 | +
|
| 39 | + - name: Run Meetup import script |
| 40 | + run: | |
| 41 | + cd tools |
| 42 | + python meetup_import.py |
| 43 | +
|
| 44 | + - name: Merge imported events into events.yml |
| 45 | + run: | |
| 46 | + if [ -s _data/imported_events.yml ]; then |
| 47 | + cat _data/imported_events.yml >> _data/events.yml |
| 48 | + : > _data/imported_events.yml |
| 49 | + echo "New events have been added to events.yml and imported_events.yml has been reset." |
| 50 | + else |
| 51 | + echo "No new events to import." |
| 52 | + fi |
| 53 | +
|
| 54 | + - name: Create or Update Pull Request |
| 55 | + uses: peter-evans/create-pull-request@v7 |
| 56 | + with: |
| 57 | + token: ${{ secrets.MEETUP_IMPORT_ACTIONS_TOKEN }} |
| 58 | + commit-message: "Automated import of Meetup events" |
| 59 | + branch: "automation/import-meetup-events" |
| 60 | + team-reviewers: "Women-Coding-Community/leaders" |
| 61 | + title: "Automated import of Meetup events" |
| 62 | + body: | |
| 63 | + This PR was created automatically by a GitHub Action to import upcoming Meetup events. |
| 64 | + Only `_data/events.yml` should be updated. |
| 65 | +
|
| 66 | + Please review the changes `_data/events.yml` and ensure that everything is parsed correctly before merging. |
| 67 | + labels: | |
| 68 | + automation |
| 69 | + |
0 commit comments