Introduction
This article walks you through how you can setup Triggers for specific file commits when there is no service attached to the workflow (Like CloudFormation).
Process
Step 1 Create a Canary Workflow
-
In the Workflow add the workflow variable to contain the value of modified files from the trigger payload like so(in the trigger config):
Workflow variable default value:
${head_commit.modified}
Your workflow variable will look like this:
For more info regarding value (Webhook events and payloads - GitHub Docs)
Step 2 Add Skip Condition in Pre-deployment phase of Workflow
-
In the Pre-deployment phase select Conditional.
-
In Skip Condition add the expression:
!${workflow.variables.testVar}.contains(“filename”)
*Specify the file name through which you want to Trigger the Execution
*You can combine multiple conditions here which are supported by JEXL.
Step 3 Create a Trigger
-
Select Type: On Webhook Event
-
In Actions of Trigger you can check your Workflow Variable.
Now if any other file is changed in the GitHub repo it will skip the workflow phase, the phase will only execute when you make the change in the specific file which you declared in the Skip Condition.