{"id":15495932,"url":"https://github.com/omenapps/publish-github-to-hashnode","last_synced_at":"2025-03-28T17:16:37.856Z","repository":{"id":250372455,"uuid":"834236498","full_name":"OmenApps/publish-github-to-hashnode","owner":"OmenApps","description":"A GitHub Action for publishing Posts to a Publication in Hashnode","archived":false,"fork":false,"pushed_at":"2024-11-22T00:25:02.000Z","size":77,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-22T19:01:49.175Z","etag":null,"topics":["blog","github","github-actions","hashnode","publishing","writing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OmenApps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-07-26T18:13:49.000Z","updated_at":"2024-11-22T00:24:49.000Z","dependencies_parsed_at":"2024-10-02T08:20:49.005Z","dependency_job_id":"34099d96-5d09-48a4-bab2-511382074673","html_url":"https://github.com/OmenApps/publish-github-to-hashnode","commit_stats":null,"previous_names":["omenapps/publish-github-to-hashnode"],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OmenApps%2Fpublish-github-to-hashnode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OmenApps%2Fpublish-github-to-hashnode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OmenApps%2Fpublish-github-to-hashnode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OmenApps%2Fpublish-github-to-hashnode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OmenApps","download_url":"https://codeload.github.com/OmenApps/publish-github-to-hashnode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246068306,"owners_count":20718503,"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","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":["blog","github","github-actions","hashnode","publishing","writing"],"created_at":"2024-10-02T08:20:37.566Z","updated_at":"2025-03-28T17:16:37.833Z","avatar_url":"https://github.com/OmenApps.png","language":"Python","readme":"# Publish GitHub to Hashnode GitHub Action\n\nA powerful GitHub Action that seamlessly publishes blog posts from your GitHub repository to Hashnode publications. This action handles markdown files with frontmatter, processes content, and manages posts through Hashnode's GraphQL API.\n\n## 🌟 Key Features\n\n- **Automated Publishing**: Create and update posts on Hashnode directly from your GitHub repository\n- **Smart Updates**: Only processes changed files, minimizing API calls\n- **Image Handling**: Automatically processes both cover images and inline images\n- **Post Management**: Handles creation, updates, and delisting of posts\n- **Frontmatter Support**: Rich metadata support through YAML frontmatter\n- **Debug Output**: Comprehensive debugging information for troubleshooting\n\n## 📋 Prerequisites\n\n- A Hashnode account and publication\n- A GitHub repository containing your markdown posts\n- A Hashnode Personal Access Token\n\n## 🔧 Installation\n\n### 1. Set Up GitHub Secrets\n\n1. Go to your repository's Settings → Secrets and Variables → Actions\n2. Create a new secret `HASHNODE_ACCESS_TOKEN` with your Hashnode API token\n   ```\n   Name: HASHNODE_ACCESS_TOKEN\n   Value: your_hashnode_api_token\n   ```\n\n### 2. Create Workflow File\n\nCreate `.github/workflows/publish.yml`:\n\n```yaml\nname: Publish to Hashnode\non:\n  push:\n    branches:\n      - main\n    paths:\n      - 'content/posts/**'\n\njobs:\n  publish:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n        with:\n          fetch-depth: 0\n\n      - name: Get changed files\n        id: changed-files\n        uses: tj-actions/changed-files@v44\n\n      - uses: actions/setup-python@v5\n        with:\n          python-version: '3.x'\n\n      - name: Publish to Hashnode\n        uses: actions/publish-github-to-hashnode@v1\n        with:\n          added-files: ${{ steps.changed-files.outputs.added_files }}\n          changed-files: ${{ steps.changed-files.outputs.all_changed_files }}\n          access-token: ${{ secrets.HASHNODE_ACCESS_TOKEN }}\n          publication-host: 'blog.mydomain.com'\n          posts-directory: 'content/posts'\n```\n\n## 📝 Post Format\n\n### Directory Structure\n```\nyour-repo/\n├── content/\n│   └── posts/\n│       ├── my-first-post.md\n│       └── images/\n│           └── cover.jpg\n└── .github/\n    └── workflows/\n        └── publish.yml\n```\n\n### Markdown Format\n```markdown\n---\ntitle: My Awesome Post\nsubtitle: A detailed guide to awesomeness\nslug: my-awesome-post\ntags: javascript,webdev,tutorial\nenableTableOfContents: true\ncoverImage: images/cover.jpg\ncoverImageAttribution: Photo by Author\npublishedAt: 2024-03-20T10:00:00Z\ndisableComments: false\n---\n\nYour post content here...\n```\n\n### Frontmatter Fields Reference\n\n| Field | Required | Type | Description |\n|-------|----------|------|-------------|\n| title | Yes | string | Post title |\n| slug | Yes | string | URL slug for the post |\n| subtitle | No | string | Post subtitle |\n| tags | No | string | Comma-separated list of tags |\n| enableTableOfContents | No | boolean | Enable/disable TOC |\n| coverImage | No | string | Path to cover image |\n| coverImageAttribution | No | string | Attribution for cover image |\n| publishedAt | No | string | ISO 8601 datetime |\n| disableComments | No | boolean | Disable comments |\n\n## 🔄 Workflow\n\n1. Create/edit markdown files in your repository\n2. Commit and push changes\n3. GitHub Action automatically:\n   - Detects changed files\n   - Processes markdown content\n   - Updates images to use absolute URLs\n   - Creates/updates posts on Hashnode\n   - Provides detailed output of operations\n\n## 📊 Outputs\n\n### JSON Output\n```json\n{\n  \"added\": [{\n    \"id\": \"post123\",\n    \"title\": \"New Post\",\n    \"slug\": \"new-post\"\n  }],\n  \"modified\": [{\n    \"id\": \"post456\",\n    \"title\": \"Updated Post\",\n    \"slug\": \"updated-post\"\n  }],\n  \"deleted\": [],\n  \"errors\": []\n}\n```\n\n### Using Outputs in Workflow\n\n```yaml\n- name: Publish to Hashnode\n  id: publish\n  uses: actions/publish-github-to-hashnode@v1\n  # ... inputs ...\n\n- name: Process Results\n  run: |\n    echo \"Published posts: ${{ fromJSON(steps.publish.outputs.result_json).added }}\"\n    echo \"Summary: ${{ steps.publish.outputs.result_summary }}\"\n```\n\n## 🔍 Debugging\n\nEnable debug logs by setting repository secret:\n```\nACTIONS_STEP_DEBUG=true\n```\n\nView detailed logs in GitHub Actions run.\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Submit a Pull Request\n\nPlease check existing issues and create a new one before submitting PRs.\n\n## 📜 License\n\nMIT License - see [LICENSE](LICENSE) for details\n\n## 🆘 Support\n\n- Create an issue for bugs/features\n\n## 🔗 Resources\n\n- [Hashnode API Documentation](https://api.hashnode.com)\n- [GitHub Actions Documentation](https://docs.github.com/en/actions)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomenapps%2Fpublish-github-to-hashnode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomenapps%2Fpublish-github-to-hashnode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomenapps%2Fpublish-github-to-hashnode/lists"}