-
Notifications
You must be signed in to change notification settings - Fork 0
feat(action): Add sync-meetup-events action and workflow #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
svg153
wants to merge
2
commits into
main
Choose a base branch
from
feature/sync-meetup-events-action
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| name: Sync Meetup Events | ||
|
|
||
| on: | ||
| schedule: | ||
| # Ejecutar diariamente a las 6 AM UTC | ||
| - cron: '0 6 * * *' | ||
| workflow_dispatch: # Permitir ejecución manual | ||
|
|
||
| jobs: | ||
| sync-events: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
| cache-dependency-path: actions/sync-meetup-events/package-lock.json | ||
|
|
||
| # Cache Puppeteer downloads (Chromium) to speed up installs | ||
| - name: Cache Puppeteer | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.cache/puppeteer | ||
| key: puppeteer-${{ runner.os }}-${{ hashFiles('actions/sync-meetup-events/package-lock.json') }} | ||
| restore-keys: | | ||
| puppeteer-${{ runner.os }}- | ||
|
|
||
| - name: Install action dependencies | ||
| working-directory: actions/sync-meetup-events | ||
| env: | ||
| PUPPETEER_CACHE_DIR: ~/.cache/puppeteer | ||
| run: npm ci | ||
|
|
||
| - name: Sync events from Meetup | ||
| uses: ./actions/sync-meetup-events | ||
| with: | ||
| json-path: 'public/data/issues.json' | ||
|
|
||
| - name: Check for changes in data file | ||
| id: verify-changed-files | ||
| run: | | ||
| if git diff --quiet -- public/data/issues.json; then | ||
| echo "changed=false" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "changed=true" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Commit and push changes | ||
| if: steps.verify-changed-files.outputs.changed == 'true' | ||
| run: | | ||
| git config --local user.email "action@github.com" | ||
| git config --local user.name "GitHub Action" | ||
| git add public/data/issues.json | ||
| git commit -m "Sync events from Meetup [automated]" | ||
| git push |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Dependencies | ||
| node_modules/ | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
|
|
||
| # Runtime data | ||
| pids | ||
| *.pid | ||
| *.seed | ||
| *.pid.lock | ||
|
|
||
| # Coverage directory used by tools like istanbul | ||
| coverage/ | ||
|
|
||
| # nyc test coverage | ||
| .nyc_output | ||
|
|
||
| # Dependency directories | ||
| jspm_packages/ | ||
|
|
||
| # Optional npm cache directory | ||
| .npm | ||
|
|
||
| # Optional REPL history | ||
| .node_repl_history | ||
|
|
||
| # Output of 'npm pack' | ||
| *.tgz | ||
|
|
||
| # Yarn Integrity file | ||
| .yarn-integrity | ||
|
|
||
| # dotenv environment variables file | ||
| .env | ||
|
|
||
| # IDE files | ||
| .vscode/ | ||
| .idea/ | ||
| *.swp | ||
| *.swo | ||
|
|
||
| # OS generated files | ||
| .DS_Store | ||
| .DS_Store? | ||
| ._* | ||
| .Spotlight-V100 | ||
| .Trashes | ||
| ehthumbs.db | ||
| Thumbs.db | ||
|
|
||
| # Logs | ||
| logs | ||
| *.log | ||
|
|
||
| # Temporary folders | ||
| tmp/ | ||
| temp/ |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,152 @@ | ||
| # Sync Meetup Events Action | ||
|
|
||
| A GitHub Action to automatically sync events from a Meetup group to a JSON file, including scraping event images. | ||
|
|
||
| ## Features | ||
|
|
||
| - Scrapes upcoming events from a Meetup group page | ||
| - Extracts event details: ID, name, link, date | ||
| - Downloads event images from Meetup pages | ||
| - Updates existing JSON file with new events | ||
| - Maintains existing events and updates missing images | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Input | Description | Required | Default | | ||
| |-------|-------------|----------|---------| | ||
| | `json-path` | Path to the JSON file to update | No | `public/data/issues.json` | | ||
|
|
||
| | `meetup-org` | Meetup organization (slug) to sync events from, e.g. `ghspain` | No | `ghspain` | | ||
|
|
||
| ## Outputs | ||
|
|
||
| None | ||
|
|
||
| ## Example Usage | ||
|
|
||
| ### Local Repository (as done here) | ||
|
|
||
| ```yaml | ||
| name: Sync Meetup Events | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '0 6 * * *' # Daily at 6 AM UTC | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| sync-events: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
|
|
||
| - name: Install action dependencies | ||
| run: | | ||
| cd actions/sync-meetup-events | ||
| npm ci | ||
|
|
||
| - name: Sync events from Meetup | ||
| uses: ./actions/sync-meetup-events | ||
| with: | ||
| json-path: 'public/data/issues.json' | ||
| meetup-org: 'ghspain' | ||
|
|
||
| - name: Commit and push changes | ||
| if: steps.verify-changed-files.outputs.changed == 'true' | ||
| run: | | ||
| git config --local user.email "action@github.com" | ||
| git config --local user.name "GitHub Action" | ||
| git add public/data/issues.json | ||
| git commit -m "Sync events from Meetup [automated]" | ||
| git push | ||
| ``` | ||
|
|
||
| ### Marketplace Usage (future) | ||
|
|
||
| Once published to GitHub Marketplace: | ||
|
|
||
| ```yaml | ||
| - name: Sync events from Meetup | ||
| uses: your-org/sync-meetup-events@v1 | ||
| with: | ||
| json-path: 'data/events.json' | ||
| meetup-org: 'my-meetup-org' | ||
| ``` | ||
|
|
||
| ## Requirements | ||
|
|
||
| - Node.js 20+ | ||
| - Puppeteer-compatible environment (GitHub Actions Ubuntu runners work) | ||
|
|
||
| ## Dependencies | ||
|
|
||
| - `puppeteer`: For browser automation and scraping | ||
| - `cheerio`: For HTML parsing | ||
|
|
||
| ## How It Works | ||
|
|
||
| 1. Launches a headless browser and navigates to the Meetup group events page | ||
| 2. Scrapes event cards to extract event details | ||
| 3. For each event, fetches the individual event page to get the image from meta tags | ||
| 4. Updates the specified JSON file with new events and missing images | ||
| 5. Sorts events by date (newest first) | ||
|
|
||
| ## JSON Structure | ||
|
|
||
| The action updates a JSON file with an array of event objects: | ||
|
|
||
| ```json | ||
| [ | ||
| { | ||
| "event_id": "123456789", | ||
| "event_name": "Event Title", | ||
| "event_link": "https://www.meetup.com/group/events/123456789/", | ||
| "event_date": "10/28/2025 5:45:00 PM", | ||
| "event_image": "https://secure.meetupstatic.com/photos/event/...jpeg" | ||
| } | ||
| ] | ||
| ``` | ||
|
|
||
| ## Development | ||
|
|
||
| ### Local Testing | ||
|
|
||
| ```bash | ||
| cd actions/sync-meetup-events | ||
| npm install | ||
| node index.js | ||
| ``` | ||
|
|
||
| ### Publishing to Marketplace | ||
|
|
||
| 1. Create a new repository for the action | ||
| 2. Copy the `action.yml`, `index.js`, and `package.json` | ||
| 3. Tag a release (e.g., `v1.0.0`) | ||
| 4. The action will be available as `uses: your-org/sync-meetup-events@v1` | ||
|
|
||
| ## Limitations | ||
|
|
||
| - Default organization is `ghspain`, but you can override it by passing the `meetup-org` input to the action. | ||
| - Assumes event dates are in a specific format | ||
| - Requires internet access for scraping | ||
|
|
||
| Note: Inputs are exposed to the Node.js action as environment variables `INPUT_JSON_PATH` and `INPUT_MEETUP_ORG`. | ||
|
|
||
| ## Contributing | ||
|
|
||
| 1. Fork the repository | ||
| 2. Create a feature branch | ||
| 3. Make your changes | ||
| 4. Test locally | ||
| 5. Submit a pull request | ||
|
|
||
| ## License | ||
|
|
||
| MIT License | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| name: 'Sync Meetup Events' | ||
| description: 'Sync events from Meetup.com to JSON file' | ||
| inputs: | ||
| json-path: | ||
| description: 'Path to the JSON file to update' | ||
| required: false | ||
| default: 'public/data/issues.json' | ||
| meetup-org: | ||
| description: 'Meetup organization (slug) to sync events from, e.g. ghspain' | ||
| required: false | ||
| default: 'ghspain' | ||
| runs: | ||
| using: 'node20' | ||
| main: 'index.js' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example references
steps.verify-changed-filesbut the actual step ID in the workflow file isverify-changed-files. This step doesn't exist in the example workflow, causing the conditional to always evaluate as false.