{"id":30663353,"url":"https://github.com/policyengine/policyengine-social","last_synced_at":"2025-08-31T17:10:30.760Z","repository":{"id":310561363,"uuid":"1040331404","full_name":"PolicyEngine/policyengine-social","owner":"PolicyEngine","description":"Automated social media posting for PolicyEngine blog articles","archived":false,"fork":false,"pushed_at":"2025-08-22T02:21:50.000Z","size":183,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-27T20:31:52.818Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PolicyEngine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-18T20:10:37.000Z","updated_at":"2025-08-22T01:37:12.000Z","dependencies_parsed_at":"2025-08-18T22:30:02.890Z","dependency_job_id":"4bab19c7-ced5-4200-8125-54d2e5cc601a","html_url":"https://github.com/PolicyEngine/policyengine-social","commit_stats":null,"previous_names":["policyengine/policyengine-social"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PolicyEngine/policyengine-social","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolicyEngine%2Fpolicyengine-social","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolicyEngine%2Fpolicyengine-social/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolicyEngine%2Fpolicyengine-social/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolicyEngine%2Fpolicyengine-social/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PolicyEngine","download_url":"https://codeload.github.com/PolicyEngine/policyengine-social/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolicyEngine%2Fpolicyengine-social/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273010994,"owners_count":25030369,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-31T17:10:22.529Z","updated_at":"2025-08-31T17:10:30.747Z","avatar_url":"https://github.com/PolicyEngine.png","language":"Python","readme":"# PolicyEngine Social Media Automation\n\nPR-based social media posting system for PolicyEngine. All posts require review and approval through GitHub Pull Requests before publishing.\n\n## 🔒 Safety First\n\n**This system is designed to NEVER post without explicit approval:**\n- All posts must be reviewed via Pull Request\n- Posts are only published after PR merge\n- 5-minute grace period to cancel after merge\n- No local posting capabilities by default\n\n## How It Works\n\n```mermaid\ngraph LR\n    A[Create post.yaml] --\u003e B[Open PR]\n    B --\u003e C[Team Review]\n    C --\u003e D[Merge PR]\n    D --\u003e E[5min Wait]\n    E --\u003e F[Publish to Social]\n```\n\n1. **Create Post**: Add a YAML file to `posts/queue/`\n2. **Open PR**: Submit for team review\n3. **Review**: Team reviews content, accuracy, timing\n4. **Merge**: Approved PRs are merged\n5. **Grace Period**: 5 minutes to cancel via `/cancel-posts`\n6. **Publish**: Automatically posts to configured platforms\n\n## Quick Start\n\n### Creating a Post\n\n1. Copy the example template:\n```bash\ncp posts/queue/example-post.yaml.example posts/queue/my-post.yaml\n```\n\n2. Edit with your content:\n```yaml\ntitle: \"Your Post Title\"\nplatforms:\n  x:\n    accounts: [thepolicyengine]\n    thread:\n      - \"First tweet\"\n      - \"Second tweet\"\n  linkedin:\n    content: \"LinkedIn post content\"\n```\n\n3. Open a Pull Request\n\n### Post Format\n\n```yaml\n# Metadata\ntitle: \"NSF Grant Announcement\"\nauthor: \"YourName\"\ntags: [\"announcement\", \"grant\"]\n\n# Platform content\nplatforms:\n  x:\n    accounts: \n      - thepolicyengine    # Main account\n      - policyengineus     # US-specific\n      - policyengineuk     # UK-specific\n    thread:\n      - \"Tweet 1 (max 280 chars)\"\n      - \"Tweet 2\"\n    images: [\"assets/image.png\"]\n  \n  linkedin:\n    content: |\n      Longer form content for LinkedIn\n      Can be multiple paragraphs\n    article_url: \"https://policyengine.org/...\"\n```\n\n## Local Development (Safe Mode)\n\n### Dry Run Testing\n\nTest your posts locally WITHOUT publishing:\n\n```bash\n# Validate post structure\npython scripts/validate_post.py posts/queue/my-post.yaml\n\n# Preview what would be posted (DRY RUN)\npython scripts/publish_post.py posts/queue/my-post.yaml\n\n# Never use --prod flag locally!\n```\n\n### Setup for Development\n\n```bash\n# Clone repository\ngit clone https://github.com/PolicyEngine/policyengine-social.git\ncd policyengine-social\n\n# Create virtual environment\npython3 -m venv venv\nsource venv/bin/activate\n\n# Install package\npip install -e \".[dev]\"\n\n# Copy environment template (but don't add real credentials!)\ncp .env.example .env\n```\n\n## GitHub Actions Setup\n\n### Required Secrets\n\nAdd these to your GitHub repository settings:\n\n**X (Twitter) Accounts:**\n- `X_THEPOLICYENGINE_API_KEY`\n- `X_THEPOLICYENGINE_API_SECRET`\n- `X_THEPOLICYENGINE_ACCESS_TOKEN`\n- `X_THEPOLICYENGINE_ACCESS_TOKEN_SECRET`\n\n- `X_POLICYENGINEUS_API_KEY`\n- `X_POLICYENGINEUS_API_SECRET`\n- `X_POLICYENGINEUS_ACCESS_TOKEN`\n- `X_POLICYENGINEUS_ACCESS_TOKEN_SECRET`\n\n- `X_POLICYENGINEUK_API_KEY`\n- `X_POLICYENGINEUK_API_SECRET`\n- `X_POLICYENGINEUK_ACCESS_TOKEN`\n- `X_POLICYENGINEUK_ACCESS_TOKEN_SECRET`\n\n**LinkedIn (via Zapier):**\n- `ZAPIER_LINKEDIN_WEBHOOK`\n\n## Repository Structure\n\n```\nposts/\n├── queue/          # Posts awaiting review (PRs)\n├── published/      # Archive of published posts\n└── templates/      # Reusable templates\n\nscripts/\n├── validate_post.py    # Validates YAML structure\n└── publish_post.py     # Posts to social (Actions only)\n\nsrc/policyengine_social/\n├── publishers/\n│   ├── x_multi.py      # Multi-account X posting\n│   └── zapier.py       # LinkedIn via Zapier\n├── extract.py          # Blog image extraction\n└── generate.py         # Auto-generate posts\n```\n\n## Content Routing\n\nThe system automatically routes content to appropriate accounts:\n\n- **US content** → @policyengineus\n- **UK content** → @policyengineuk  \n- **General** → @thepolicyengine\n\n## Testing\n\n```bash\n# Run all tests\npytest tests/\n\n# Run with coverage\npytest tests/ --cov=policyengine_social\n\n# Validate a post\npython scripts/validate_post.py posts/queue/my-post.yaml\n```\n\n## Safety Features\n\n1. **No Accidental Posting**: Package cannot post without explicit PR approval\n2. **Review Required**: All posts go through PR review\n3. **Cancellation Window**: 5 minutes to cancel after merge\n4. **Dry Run Default**: Scripts default to preview mode\n5. **Validation**: Posts are validated before publishing\n6. **Audit Trail**: All posts archived after publishing\n\n## PR Workflow\n\n1. Create your post YAML in `posts/queue/`\n2. Run validation locally: `python scripts/validate_post.py posts/queue/my-post.yaml`\n3. Preview locally: `python scripts/publish_post.py posts/queue/my-post.yaml`\n4. Commit and push: `git add posts/queue/my-post.yaml \u0026\u0026 git commit -m \"Add post about...\"`\n5. Open PR and fill out the template\n6. Wait for team review\n7. Merge when approved\n8. Monitor the Actions tab for publishing status\n\n## Troubleshooting\n\n### Post Not Publishing\n- Check GitHub Actions logs\n- Verify all secrets are set correctly\n- Ensure post YAML is valid\n\n### Wrong Account\n- Check the `accounts` field in your YAML\n- Verify content routing rules\n\n### Rate Limits\n- X allows 300 posts per 3 hours\n- Space out large threads\n- Use different apps for different accounts\n\n## Contributing\n\n1. Never add real credentials to code\n2. Always use dry-run mode for testing\n3. Create posts via PR only\n4. Test thoroughly with `pytest`\n\n## License\n\nMIT","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolicyengine%2Fpolicyengine-social","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolicyengine%2Fpolicyengine-social","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolicyengine%2Fpolicyengine-social/lists"}