Skip to content

GitHub Action to check whether a Markdown file has been scheduled for publishing

License

Notifications You must be signed in to change notification settings

jannekem/publish-schedule-action

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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Markdown Publish Schedule Action

GitHub Action to check whether a Markdown file has been scheduled for publishing.

The action searches for Markdown files inside the repository and looks for a date parameter in the YAML front matter. If the date value in any of the files is within the amount of minutes defined in the interval parameter the action will output "true". This action can be used in combination with your deployment process to schedule content.

Inputs

Input Required Description
interval yes How far back in minutes to check?
content_directory no Where to search for the Markdown files? (Default: whole repository)

Outputs

Output Description
is_scheduled A string value of "true" or "false" indicating if a scheduled post was found or not

Netlify deployment example

The following workflow can be used to start a Netlify deployment. Note that you need to create a build hook URL in your Netlify site deploy settings and store it as the NETLIFY_BUILD_HOOK secret in the GitHub repository.

name: Schedule post

on:
  schedule:
    - cron: "0 * * * *"

jobs:
  schedule:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - uses: jannekem/[email protected]
      with:
        interval: 60
        content_directory: content
      id: publish
    - name: Trigger build
      if: steps.publish.outputs.is_scheduled == 'true'
      run: curl -X POST -d {} $NETLIFY_BUILD_HOOK
      env:
        NETLIFY_BUILD_HOOK: ${{ secrets.NETLIFY_BUILD_HOOK }}

Links

About

GitHub Action to check whether a Markdown file has been scheduled for publishing

Resources

License

Stars

Watchers

Forks

Packages

No packages published