Giter VIP home page Giter VIP logo

action-update-posts's Introduction

Action Update Posts

Ghost

Update Ghost Posts on a schedule

This GitHub action allows you to automatically update any fields of any Ghost post
on a schedule from GitHub via the Ghost Admin API!


 

Getting Started

💡This action expects that you already have a working Ghost install running at least v3.20.0

  1. Generate a set of Ghost Admin API credentials, by configuring a new Custom Integration in Ghost Admin»Integrations.

  2. On GitHub, navigate to your theme repository»Settings»Secrets. Create a secret called GHOST_ADMIN_API_URL containing the API URL and another called GHOST_ADMIN_API_KEY containing the Admin API Key. Both must be copied exactly from Ghost Admin»Integrations.

  3. Once your secrets are in place, copy this example config into .github/workflows/update-posts.yml.

name: Update Ghost Posts
on:
  schedule:
    - cron: "01 00 * * *"
jobs:
  deploy:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@master
      - name: Update Ghost Posts
        uses: TryGhost/action-update-posts@v0
        with:
          api-url: ${{ secrets.GHOST_ADMIN_API_URL }}
          api-key: ${{ secrets.GHOST_ADMIN_API_KEY }}
          tag: 'hash-early-access'
          field: 'visibility'
          value: 'public'
          days: 30

Using the schedule "01 00 * * *" will run this action once per day at one minute past midnight. For testing purposes, you may wish to use ""*/5 * * * *", which will run every 5 minutes.

The example with configuration will find all posts tagged with #early-access, and if they were published more than 30 days ago, will update the visibility field to public.

  1. Tweak the tag, field, value and days configuration values to whatever you like, and then commit and push your changes.

Configuration

The with portion of the workflow must be configured before the action will work. Any secrets must be referenced using the bracket syntax and stored in the GitHub repositories Settings/Secrets menu. You can learn more about setting environment variables with GitHub actions here.

Key Value Information Type Required
api-url The base URL of your Ghost Admin API, found by configuring a new Custom Integration in Ghost Admin»Integrations secrets Yes
api-key The authentication key for your Ghost Admin API, found by configuring a new Custom Integration in Ghost Admin»Integrations secrets Yes
tag The tag to lookup to find posts to update e.g. hash-early-access string Yes
field The post field that you want to update e.g. visibility or featured string Yes
value The new value for the field e.g. public or false string Yes
days Number of days after the post was published to update the post e.g. 30 number Yes

Examples

with:
  api-url: ${{ secrets.GHOST_ADMIN_API_URL }}
  api-key: ${{ secrets.GHOST_ADMIN_API_KEY }}
  tag: 'hash-sponsored'
  field: 'featured'
  value: 'false'
  days: 7

 

Don't forget to 🌟 Star 🌟 the repo if you like this GitHub Action !

Copyright & License

Copyright (c) 2013-2023 Ghost Foundation - Released under the MIT license.

action-update-posts's People

Contributors

daniellockyer avatar erisds avatar joeegrigg avatar johnonolan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.