Example - LaunchDarkly Flag Expiry Audit #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Example - LaunchDarkly Flag Expiry Audit | |
| on: | |
| # Run every Monday at 9 AM UTC | |
| schedule: | |
| - cron: '0 9 * * 1' | |
| # Allow manual triggers | |
| workflow_dispatch: | |
| inputs: | |
| days_ahead: | |
| description: 'Number of days ahead to check' | |
| required: false | |
| default: '7' | |
| type: string | |
| include_past_due: | |
| description: 'Include past due flags' | |
| required: false | |
| default: true | |
| type: boolean | |
| jobs: | |
| audit-flags: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Audit LaunchDarkly Feature Flags | |
| id: audit | |
| uses: ./ | |
| with: | |
| launchdarkly_api_key: ${{ secrets.LAUNCHDARKLY_API_KEY }} | |
| project_key: ${{ vars.LAUNCHDARKLY_PROJECT_KEY || 'default-project' }} | |
| days_ahead: ${{ github.event.inputs.days_ahead || '7' }} | |
| include_past_due: ${{ github.event.inputs.include_past_due || 'true' }} | |
| - name: Process Results | |
| if: ${{ fromJSON(steps.audit.outputs.total_count) > 0 }} | |
| run: | | |
| echo "Found flags with expiry dates: ${{ steps.audit.outputs.total_count }}" | |
| echo "Expiring flags: $(echo '${{ steps.audit.outputs.expiring_flags }}' | jq length)" | |
| echo "Past due flags: $(echo '${{ steps.audit.outputs.past_due_flags }}' | jq length)" | |
| # Print expiring flags | |
| if [ "$(echo '${{ steps.audit.outputs.expiring_flags }}' | jq length)" -gt 0 ]; then | |
| echo "🔶 Expiring flags:" | |
| echo '${{ steps.audit.outputs.expiring_flags }}' | jq -r '.[] | " - \(.name) (\(.key)): expires \(.expiryDate) (\(.daysUntilExpiry) days)"' | |
| fi | |
| # Print past due flags | |
| if [ "$(echo '${{ steps.audit.outputs.past_due_flags }}' | jq length)" -gt 0 ]; then | |
| echo "🔴 Past due flags:" | |
| echo '${{ steps.audit.outputs.past_due_flags }}' | jq -r '.[] | " - \(.name) (\(.key)): expired \(.expiryDate) (\((.daysUntilExpiry * -1)) days ago)"' | |
| fi | |
| - name: No Expiring Flags Found | |
| if: ${{ fromJSON(steps.audit.outputs.total_count) == 0 }} | |
| run: | | |
| echo "✅ No feature flags found with expiry dates in the specified project." | |