Skip to content

philips-software/post-to-medium-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Contributors Forks Stargazers Issues MIT License


Post to Medium GitHub Action

GitHub Action that allows you to automatically create a new Medium post with Markdown or HTML.
Report Bug · Request Feature

(back to top)

State

Functional

Usage

The easiest way to use this action is to add the following into your workflow file. Additional configuration might be necessary to fit your usecase.

Add the following part in your workflow file:

Using content

jobs:
  post-to-medium:
    name: Post to Medium
    runs-on: ubuntu-latest
    steps:
      - name: Create Medium Post
        uses: philips-software/[email protected]
        with:
          integration_token: "${{ secrets.INTEGRATION_TOKEN }}"
          content: |
            # Story Title
            ## an optional subtitle
            
            Lorem ipsum content Lorem ipsum content Lorem ipsum
            content Lorem ipsum content Lorem ipsum content Lorem 
            ipsum content Lorem ipsum content Lorem ipsum content.
          content_format: "markdown"
          notify_followers: "false"
          tags: "test,tag"
          title: "title"
          license: "all-rights-reserved"
          publish_status: "draft"

Using file

jobs:
  post-to-medium:
    name: Post to Medium
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v2
      - name: Create Medium Post
        uses: philips-software/[email protected]
        with:
          integration_token: "${{ secrets.INTEGRATION_TOKEN }}"
          file: "path/to/story.md"
          content_format: "markdown"
          notify_followers: "false"
          tags: "test,tag"
          title: "title"
          license: "all-rights-reserved"
          publish_status: "draft"

Inputs

parameter description required default
integration_token Medium's Integration Token. Token can be retrieved at medium.com, settings section, under 'Integration Token.' true
content Content to add in the post, can be either HTML or Markdown. Use either this parameter, or the file parameter. false
content_format The format of the content field. There are two valid values, html, and markdown. true
file Absolute path to the file to use as content, can be either HTML or Markdown. Use either this parameter, or the content parameter. false
publish_status Post's status. Valid values are 'draft', 'public', or 'unlisted'. false draft
notify_followers Whether to notify followers that the user has published. false false
license Post's license. Valid values are 'all-rights-reserved', 'cc-40-by', 'cc-40-by-sa', 'cc-40-by-nd', 'cc-40-by-nc', 'cc-40-by-nc-nd', 'cc-40-by-nc-sa', 'cc-40-zero', 'public-domain'. false all-rights-reserved
publication_name The name of the publication the post is being created under. If you wish to publish on a publication, either PublicationName of PublicationId should be set. If neither PublicationId or PublicationName is filled in, it will post on the user that is authentication. false
publication_id The id of the publication the post is being created under. If you do not know the Id, use PublicationName. If you wish to publish on a publication, either PublicationName of PublicationId should be set. If neither PublicationId or PublicationName is filled in, it will post on the user that is authentication. false
canonical_url The canonical URL of the post. If canonicalUrl was not specified in the creation of the post, this field will not be present. false
tags The post’s tags. Provide a comma separated string without spaces. true
title The post's title. true
parse_frontmatter Should the action read and delete frontmatter in a markdown file. Frontmatter should start with --- and end with ---. Should be on the top of the page. When parsing frontmatter, only markdown is supported and settings will be overwritten if specified in the frontmatter. PascalCasing and under_scored lowercasing naming convention is supported. true false

Outputs

parameter description
id ID of the Medium post.
author_id Author ID of the post creator.
canonical_url Canonical URL of the post.
license License of the post, can be empty at times.
license_url License url of the post, Medium uses this under the hood.
publication_id Id of the publication which the post is created under.
publication_status Publication status of the post.
title Title of the post.
tags Tags of the post, comma separated.
url URL to the Medium post.

Contributing

If you have a suggestion that would make this project better, please fork the repository and create a pull request. You can also simply open an issue with the tag "enhancement".

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)