As your site content begins to scale, keeping older content up to date can become difficult.
This guide contains instructions to setup a GitHub Actions Workflow to check for outdated content using AI and raise GitHub Issues.
TinaCloud
Your content will be queried in TinaCloud. This supplies the GitHub action with the list of files it will need to locate.
GitHub Actions
The GitHub Action will use the response from TinaCloud to locate the correct files within your repository. From there the content of each file wil be read for review.
Issues
After scanning your content the GitHub action will produce a list of issues with suggested improvements based on your system prompt.
Pull Requests
The GitHub action will automatically create Pull Requests with the list of files that were checked.
GitHub Models
GitHub Models will read and evaluate your content, flagging any potential areas for improvement.
You'll need to add configuration settings that will be used when the GitHub action is run. To configure the settings go to Your Repo | ⚙️Settings | Secrets and Variables.
TinaCloud will be used to locate and filter your content. We'll need add a couple of fields to your selected collection to enable the content checks.
Be sure to regenerate and commit your tina-lock.json after adding the new field.
In order for the script to run we need to seed all of you existing content with a lastChecked field.
Navigate to the directory for the workflow.
You'll need to add a .env file inside this location with your Collection, TinaCMS Token and TinaCMS Client ID saved. These are the same properties added to your GitHub Settings.
Then run the commands below to migrate your content.
The output should look something like this:
You must commit and push the updated files for the GitHub action to work. The changes should be in TinaCloud.
Once you've finished setting up the GitHub action for your own project you should be able to see a new workflow called Audit Content with AI in the GitHub Actions for your repo. Run it to perform your first content audit.
Figure: Running a Content Audit in GitHub
The flow will output a list of Issues after the content audit is finished. Each Issue will contain a list of suggestions for the content and a handy link to the file that needs to be changed.Figure: Issue List after Running Content Audit Action
The workflow will also output a pull request to update the lastChecked date of every file that was audited.
Figure: Pull Request with Last Checked Date Updated
It's important that you merge this pull request before running the GitHub Action again. Otherwise it will audit the same files again when you re-run it.
Now that you have a set of Issues generated from the Workflow, you have a couple of options for tackling the feedback. You can do the Issues yourself or fully automate the process by assigning the Issue to GitHub Copilot!