Skip to content

Conversation

@mdlinville
Copy link
Contributor

@mdlinville mdlinville commented Jan 16, 2026

Description

Recent updates added PR commenting to the link checker, but the initial comment would not be updated by subsequent runs. This fixes that.

Testing

This adds functionality to automatically comment on PRs with link checker
results when the Mintlify deployment completes. The comment will be updated
on subsequent runs and clearly indicates whether all links are valid or if
issues were found.
@mdlinville mdlinville marked this pull request as ready for review January 16, 2026 20:42
@mdlinville mdlinville requested a review from a team as a code owner January 16, 2026 20:42
@mdlinville mdlinville requested a review from ngrayluna January 16, 2026 20:42
- Fix JavaScript syntax error when exit_code is empty
- Handle both pull_request and deployment_status events properly
- Use safe string interpolation for exit code
- Fallback to docs.wandb.ai when no deployment URL available
if (context.eventName === 'deployment_status') {
const sha = context.payload.deployment?.sha;
if (!sha) {
core.warning('No deployment SHA found');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the deployment SHA the same has the GitHub PR SHA? If yay, you can use the baked in environment variable

echo "The commit SHA is: ${{ github.sha }}"

If not, disregard this comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the SHA that the Mintlify preview is built from, from Mintlify's POV. If Mintlify stopped building previews for subsequent hashes for some reason, this is how we would get visibility into that.

Change push trigger to only run on main branch. This prevents duplicate
workflow runs when pushing to PR branches (which triggers both push and
pull_request events).

Now:
- PRs: validated via pull_request trigger
- Main branch: validated via push trigger
- Manual: workflow_dispatch still available
uses: actions/github-script@v8
with:
script: |
// For pull_request events, get PR number directly
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another idea, not sure if it's relevant, but depending on the event this is triggered for, you can automatically get access to PR #'s , etc.

E.g. for pull_request events, we get the PR number:

echo "The PR number is ${{ github.event.number }}"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are, from within the context.payload struct, see line 97. I don't mind David's approach of saving it to a local variable.

branches:
- '**'
- '!main'
- main
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just prevents a duplicate validate-mdx trigger on every PR push. This branch definition means that the check will run on direct commits to main (outside the scope of a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants