Skip to content

Perforce change trigger

Send Helix Core changelists to Project Feed as posts with an inbound webhook.

Perforce has a native integration that maps depot paths to projects and records changelists, shelves, and reviews as project activity. Use it when you want that. Use an inbound webhook when you want each changelist to become a post that you shape yourself. See the Perforce integration for the native setup.

For a webhook, create a secret for one project, then add a Perforce change-commit trigger. It runs after the changelist is committed, so the script can read it with p4 describe and send a published post.

Shell
Triggers:
project-feed-change change-commit //depot/... "/opt/project-feed/publish-change.sh %change% %serverport%"

# Payload created by publish-change.sh
{
  "source": "perforce",
  "externalId": "change-10421",
  "title": "alex submitted changelist 10421",
  "content": "Updated lighting and fixed the build.",
  "status": "published"
}
  • publish-change.sh signs the body as described in Signing and security.
  • Posts in the project use change-<number> as the externalId, so a resubmitted trigger updates the same post.

Fix Perforce trigger problems

No post appears
Run the script by hand and read the HTTP status. A 401 means the secret, prefix, signature, or clock is wrong. A 400 means a required field is missing. A secret for All projects also needs a projectId.
The trigger blocks submits
A change-commit trigger runs after the changelist is committed, so a failed request does not stop the submit. Log failures in the script and retry later.
A retry returns 409
The same signed request was already accepted. Treat it as success, or sign a new request to send the item again.
Image preview
100%