So, as the title says, here is my plan for getting my GitHub Pages site updated: trigger a workflow from Lambda, and have the workflow pull the new updates (either from a remote repo in CodeCommit, an S3 bucket, or maybe an API Gateway). For this last part, I’ll probably use GitHub Push, or a similar action, to commit and push the changes to the GitHub Pages repo.

Manually triggering a GitHub Actions workflow

Using on: workflow_dispatch we can manually trigger a workflow, either from the GitHub site, or via REST API. We can also provide input values, which is perfect for my plan: publish a new post or update an existing one.

You can manually trigger a workflow run using the GitHub API and from GitHub. For more information, see “Manually running a workflow.” […] To trigger the custom workflow_dispatch webhook event using the REST API, you must send a POST request to a GitHub API endpoint and provide the ref and any required inputs. For more information, see the “Create a workflow dispatch event” REST API endpoint.

To test this, I’ve added the example workflow from the documentation to my GitHub Pages repo.

name: Manually triggered workflow
        description: 'Person to greet'
        required: true
        default: 'Mona the Octocat'
        description: 'location'
        required: false
        default: 'The Octoverse'

    runs-on: ubuntu-latest
    - run: |
        echo "Hello $!"
        echo "- in $!"

Trigger from GitHub console

Input parameters can be defined when running the workflow from the GitHub console:

Screen Shot 2020-12-23 at 11 35 52 AM

Screen Shot 2020-12-23 at 11 37 31 AM

Trigger via REST API

And here is a curl request to trigger the workflow via REST API, with the parameters needed (PAT token omitted).

curl \
    -X POST \
    -H "Accept: application/vnd.github.v3+json" \ \
    -d '{"ref":"main", "inputs": { "name":"Command Line User", "home":"CLI" }}'

Screen Shot 2020-12-23 at 11 49 46 AM

And voila! We can now trigger a workflow via API 🎉

Next steps

The flow is getting close to complete:


  • Configure GitHub action to push Issue updates to Amazon SQS (#1) ✅
  • Configure an AWS Lambda to process the incoming messages (#2) ✅
  • Retrieve entire issue details via GitHub Graph API, or embed in message (#3 & #4) ✅
  • Automate creation of blog post on GitHub pages (via direct commit, or pull request)
  • Send me a notification via email or SMS with the url of the new blog post (using AWS SNS)
  • Potentially store a mapping of GitHub issues to blog URLs (and file paths) on a DynamoDB table

This article was written as an issue on my Blog repository on GitHub (see Issue #7)