Skip to content

Commit 8de6783

Browse files
committed
add functionality to search across all projects
1 parent 7f411c7 commit 8de6783

File tree

8 files changed

+323
-45
lines changed

8 files changed

+323
-45
lines changed

.github/workflows/test.yml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ jobs:
2929
- name: Validate build
3030
run: npm run build
3131

32-
# Integration test (requires secrets - only run on main branch)
33-
integration-test:
32+
# Integration test for specific project with issue creation
33+
integration-test-specific-project-name:
3434
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
3535
runs-on: ubuntu-latest
3636
permissions:
@@ -39,7 +39,8 @@ jobs:
3939
steps:
4040
- uses: actions/checkout@v4
4141

42-
- name: Test the action with issue creation
42+
- name: Test specific project with issue creation
43+
id: specific-test
4344
uses: ./
4445
with:
4546
launchdarkly_api_key: ${{ secrets.LAUNCHDARKLY_API_KEY }}
@@ -48,4 +49,37 @@ jobs:
4849
include_past_due: 'true'
4950
create_issues: 'true'
5051
github_token: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: Display specific project results
54+
run: |
55+
echo "Specific Project Test Results:"
56+
echo "Total flags with expiry dates: ${{ steps.specific-test.outputs.total_count }}"
57+
echo "Expiring flags: $(echo '${{ steps.specific-test.outputs.expiring_flags }}' | jq length)"
58+
echo "Past due flags: $(echo '${{ steps.specific-test.outputs.past_due_flags }}' | jq length)"
59+
60+
# Integration test for all projects without issue creation
61+
integration-test-all-projects:
62+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
63+
runs-on: ubuntu-latest
64+
permissions:
65+
contents: read
66+
steps:
67+
- uses: actions/checkout@v4
68+
69+
- name: Test all projects without issue creation
70+
id: all-projects-test
71+
uses: ./
72+
with:
73+
launchdarkly_api_key: ${{ secrets.LAUNCHDARKLY_API_KEY }}
74+
project_key: 'all'
75+
days_ahead: '14'
76+
include_past_due: 'true'
77+
create_issues: 'false'
78+
79+
- name: Display all projects results
80+
run: |
81+
echo "All Projects Test Results:"
82+
echo "Total flags with expiry dates: ${{ steps.all-projects-test.outputs.total_count }}"
83+
echo "Expiring flags: $(echo '${{ steps.all-projects-test.outputs.expiring_flags }}' | jq length)"
84+
echo "Past due flags: $(echo '${{ steps.all-projects-test.outputs.past_due_flags }}' | jq length)"
5185

ISSUE_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This feature flag has expired and should be reviewed for cleanup.
1919
### Context
2020
This issue was automatically created by the [LaunchDarkly Feature Flag Expiry Audit Action](https://github.com/{{repoOwner}}/{{repoName}}/actions).
2121

22-
**Project**: {{projectKey}}
22+
**Project**: {{projectName}} ({{projectKey}})
2323
**Audit Date**: {{auditDate}}
2424

2525
---

README.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ A GitHub Action that audits LaunchDarkly feature flags with expiry dates stored
1111
- 🚨 **Past Due Identification**: Optionally includes flags that are already past their expiry date
1212
- 📝 **Multiple Date Formats**: Supports various date formats (MM/DD/YYYY, YYYY-MM-DD, etc.)
1313
- 🎫 **Automated Issue Creation**: Optionally creates GitHub issues for expired flags with task labels
14+
- 🌐 **Multi-Project Support**: Audit a single project or all projects in your LaunchDarkly account
1415

1516
## Usage
1617

@@ -181,12 +182,39 @@ jobs:
181182
github_token: ${{ secrets.GITHUB_TOKEN }}
182183
```
183184
185+
### Auditing All Projects
186+
187+
```yaml
188+
name: Audit All LaunchDarkly Projects
189+
on:
190+
schedule:
191+
- cron: '0 6 * * 1' # Monday at 6 AM
192+
193+
jobs:
194+
audit-all-projects:
195+
runs-on: ubuntu-latest
196+
permissions:
197+
issues: write
198+
contents: read
199+
steps:
200+
- uses: actions/checkout@v4
201+
202+
- name: Audit all projects
203+
uses: your-org/ld-cp-exp-date-gh-actions-audit@v1
204+
with:
205+
launchdarkly_api_key: ${{ secrets.LAUNCHDARKLY_API_KEY }}
206+
project_key: 'all' # This will audit ALL projects
207+
days_ahead: '14'
208+
create_issues: 'true'
209+
github_token: ${{ secrets.GITHUB_TOKEN }}
210+
```
211+
184212
## Inputs
185213
186214
| Input | Description | Required | Default |
187215
|-------|-------------|----------|---------|
188216
| `launchdarkly_api_key` | LaunchDarkly API access token (should be stored as a secret) | Yes | |
189-
| `project_key` | LaunchDarkly project key | Yes | |
217+
| `project_key` | LaunchDarkly project key (use "all" to audit all projects) | Yes | |
190218
| `days_ahead` | Number of days ahead to check for expiring flags | No | `7` |
191219
| `include_past_due` | Include flags that are past their expiry date | No | `true` |
192220
| `custom_property_name` | Name of the custom property containing the expiry date | No | `flag.expiry.date` |
@@ -209,8 +237,10 @@ Each flag object in the output arrays contains:
209237
{
210238
"name": "My Feature Flag",
211239
"key": "my-feature-flag",
240+
"projectKey": "my-project",
241+
"projectName": "My Project",
212242
"expiryDate": "2024-03-15",
213-
"custom_property_key": "flag.expiry.date",
243+
"customPropertyKey": "flag.expiry.date",
214244
"customPropertyValue": "03/15/2024",
215245
"daysUntilExpiry": 5
216246
}
@@ -252,6 +282,7 @@ The action looks for an `ISSUE_TEMPLATE.md` file in your repository root. If not
252282
- `{{expiryDate}}` - The expiry date
253283
- `{{daysOverdue}}` - Number of days past expiry
254284
- `{{projectKey}}` - LaunchDarkly project key
285+
- `{{projectName}}` - LaunchDarkly project name
255286
- `{{auditDate}}` - Date the audit was run
256287
- `{{repoOwner}}` - Repository owner
257288
- `{{repoName}}` - Repository name

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ inputs:
77
description: 'LaunchDarkly API access token'
88
required: true
99
project_key:
10-
description: 'LaunchDarkly project key'
10+
description: 'LaunchDarkly project key (use "all" to audit all projects)'
1111
required: true
1212
days_ahead:
1313
description: 'Number of days ahead to check for expiring flags (default: 7 for 1 week)'

dist/ISSUE_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This feature flag has expired and should be reviewed for cleanup.
1919
### Context
2020
This issue was automatically created by the [LaunchDarkly Feature Flag Expiry Audit Action](https://github.com/{{repoOwner}}/{{repoName}}/actions).
2121

22-
**Project**: {{projectKey}}
22+
**Project**: {{projectName}} ({{projectKey}})
2323
**Audit Date**: {{auditDate}}
2424

2525
---

0 commit comments

Comments
 (0)