Skip to content

Conversation

DerekRoberts
Copy link
Member

@DerekRoberts DerekRoberts commented Sep 11, 2025

Summary

This PR adds a new output to the action.yml file that exposes the trigger status from the diff step, and includes comprehensive trigger behavior verification in the test workflow.

Changes

Action Output

  • Added outputs section to action.yml
  • Added triggered output that exposes steps.diff.outputs.triggered
  • Enables downstream actions to conditionally run based on trigger status

Comprehensive Trigger Testing

  • Added trigger verification step to each matrix job in tests.yml
  • Tests three different trigger scenarios:
    • Backend job: triggers: ('backend/') - should NOT trigger (no backend/ changes)
    • Frontend-merge job: triggers: ('.') - should trigger (any change)
    • Frontend-pr job: no triggers - should trigger (always run)
  • Provides clear success/failure feedback for each scenario
  • Validates that the action's trigger logic is working correctly

Benefits

  • Better workflow orchestration: Allows developers to create conditional workflows based on whether the action was triggered
  • Comprehensive testing: Validates all trigger scenarios to ensure the action works as expected
  • Clear feedback: Provides detailed success/failure messages for debugging
  • Visibility: Makes trigger status visible for monitoring and debugging

Usage Example

- uses: ./
  id: test-and-analyse
  with:
    # ... other inputs
- name: Do something based on trigger status
  if: steps.test-and-analyse.outputs.triggered == 'true'
  run: echo "Action was triggered by path changes"

Testing

  • Verified the output syntax is correct
  • Confirmed the output references the correct step output
  • Added comprehensive trigger behavior verification
  • Tested commit and push to remote branch
  • Validated all three trigger scenarios work as expected

Expected Test Results

When the workflow runs, you should see:

  • ✅ Backend job correctly NOT triggered (no backend/ changes)
  • ✅ Frontend-merge job correctly triggered (triggers: '.')
  • ✅ Frontend-pr job correctly triggered (no triggers = always run)

- Add outputs section with triggered value from diff step
- Allows downstream actions to conditionally run based on trigger status
- Enables better workflow orchestration and conditional logic
- Add trigger verification step to each matrix job
- Test backend job (should NOT trigger - no backend/ changes)
- Test frontend-merge job (should trigger - triggers: '.')
- Test frontend-pr job (should trigger - no triggers = always run)
- Provide clear success/failure feedback for each scenario
- Validate action's trigger logic is working correctly
@DerekRoberts DerekRoberts self-assigned this Sep 12, 2025
@DerekRoberts DerekRoberts merged commit 750b218 into main Sep 12, 2025
7 checks passed
@github-project-automation github-project-automation bot moved this from New to Done in DevOps (NR) Sep 12, 2025
@DerekRoberts DerekRoberts deleted the feat/outputs branch September 12, 2025 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant