Skip to content

Commit 6e9c7c3

Browse files
committed
- update workflow to support since tag replacement during release
1 parent ecf9cf9 commit 6e9c7c3

File tree

5 files changed

+221
-75
lines changed

5 files changed

+221
-75
lines changed

.github/workflows/UPDATE_SINCE_TAGS.md

Lines changed: 59 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,65 @@ This document outlines the plan for implementing automated `@since` tag updates
66

77
## Implementation Checklist
88

9-
### 1. Package.json Updates
10-
- [ ] Add `chalk` to devDependencies
11-
- [ ] Add a new npm script for running the update-since-tags.js (e.g., `since-tags:update`)
12-
13-
### 2. Script Enhancements (update-since-tags.js)
14-
- [ ] Add better console output formatting using chalk
15-
- [ ] Enhance logging to provide detailed information about updated files
16-
- [ ] Add functionality to generate a summary of updates for release notes
17-
- [ ] Add documentation for supported placeholders (`todo`, `next-version`, `tbd`)
18-
- [ ] Add error handling for file operations
19-
- [ ] Add validation for version number input
20-
21-
### 3. Release Management Workflow Updates
22-
- [ ] Add new step in release-management.yml after version bump
23-
- [ ] Integrate since-tag updates into the workflow
24-
- [ ] Add logging output to release notes
25-
- [ ] Handle potential errors gracefully
26-
- [ ] Ensure changes are committed with version bump
27-
28-
### 4. Changeset Integration
9+
### 1. Package.json Updates ✅
10+
- [x] Add `chalk` to devDependencies
11+
- [x] Add a new npm script for running the update-since-tags.js (e.g., `since-tags:update`)
12+
13+
### 2. Script Enhancements (update-since-tags.js) ✅
14+
- [x] Add better console output formatting using chalk
15+
- [x] Enhance logging to provide detailed information about updated files
16+
- [x] Add functionality to generate a summary of updates for release notes
17+
- [x] Add documentation for supported placeholders (`todo`, `next-version`, `tbd`)
18+
- [x] Add error handling for file operations
19+
- [x] Add validation for version number input
20+
21+
### 3. Testing ✅
22+
- [x] Test script locally with various scenarios
23+
- [x] Test with multiple @since tags in single file
24+
- [x] Test with no @since tags present
25+
- [ ] Test workflow with actual PR and release
26+
- [ ] Test error scenarios in workflow context
27+
28+
### 4. Release Management Workflow Updates (Next Steps) 🚀
29+
- [x] Add new step in release-management.yml after version bump
30+
- [x] Integrate since-tag updates into the workflow
31+
- [x] Add logging output to release notes
32+
- [x] Handle potential errors gracefully
33+
- [x] Ensure changes are committed with version bump
34+
35+
### 5. Changeset Integration
2936
- [ ] Modify generate-changeset.yml to detect files with @since placeholders
3037
- [ ] Add @since placeholder information to changeset content
3138
- [ ] Update release PR template to include @since placeholder information
3239
- [ ] Ensure this information flows through to final release notes
3340

34-
### 5. Documentation Updates
41+
### 6. Documentation Updates
3542
- [ ] Update SUMMARY.md with new functionality
3643
- [ ] Update main README.md with @since tag information
3744
- [ ] Update workflow documentation
3845
- [ ] Add examples of using @since placeholders
3946
- [ ] Document supported file types (PHP only for now)
4047

41-
### 6. Testing
42-
- [ ] Test script locally with various scenarios
43-
- [ ] Test workflow with actual PR and release
44-
- [ ] Test error scenarios
45-
- [ ] Test with multiple @since tags in single file
46-
- [ ] Test with no @since tags present
48+
## Script Enhancements Completed ✅
49+
50+
The `update-since-tags.js` script has been enhanced with:
51+
- Improved console output using chalk for better readability
52+
- Detailed logging of file updates and error conditions
53+
- Release notes summary generation
54+
- Version number validation
55+
- Error handling for file operations
56+
- Support for counting and reporting the number of updates per file
57+
- Temporary file creation for workflow integration
58+
59+
## Local Testing Results ✅
60+
61+
The script has been successfully tested locally with:
62+
- Multiple files containing @since placeholders
63+
- Files with multiple placeholders
64+
- Files with no placeholders
65+
- Proper version number validation
66+
- Summary generation for release notes
67+
- Colored console output for better readability
4768

4869
## Supported Placeholders
4970

@@ -58,10 +79,17 @@ Currently, the system only scans PHP files for @since placeholders. This may be
5879

5980
## Notes
6081

61-
- The script currently works as-is, so we won't refactor the module system (ES modules vs CommonJS) at this time
62-
- We'll focus on PHP files only for the initial implementation
63-
- Changes should be made incrementally to avoid disrupting existing workflows
64-
- Each change should be tested thoroughly before moving to the next item
82+
- The script currently works as-is with CommonJS modules
83+
- We're focusing on PHP files only for the initial implementation
84+
- Changes are being made incrementally to avoid disrupting existing workflows
85+
- Each change is tested thoroughly before moving to the next item
86+
87+
## Next Steps 🚀
88+
89+
1. Integrate the script into release-management.yml workflow
90+
2. Test the integration with a real PR and release
91+
3. Implement changeset integration for @since placeholder tracking
92+
4. Update all documentation
6593

6694
## Future Considerations
6795

.github/workflows/release-management.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,31 @@ jobs:
9292
NEW_VERSION=$(grep -oP "define\('AUTOMATION_TESTS_VERSION', '\K[^']+" constants.php)
9393
echo "version=${NEW_VERSION}" >> $GITHUB_OUTPUT
9494
95+
- name: Update @since tags
96+
id: update_since_tags
97+
run: |
98+
# Run the since-tags update script with the new version
99+
npm run since-tags:update -- ${{ steps.version_bump.outputs.version }}
100+
101+
# Check if summary file exists and has content
102+
if [ -f "/tmp/since-tags-summary.md" ]; then
103+
# Read the summary file
104+
SINCE_SUMMARY=$(cat /tmp/since-tags-summary.md)
105+
106+
# Properly escape the content for GitHub Actions
107+
SINCE_SUMMARY="${SINCE_SUMMARY//'%'/'%25'}"
108+
SINCE_SUMMARY="${SINCE_SUMMARY//$'\n'/'%0A'}"
109+
SINCE_SUMMARY="${SINCE_SUMMARY//$'\r'/'%0D'}"
110+
111+
# Set the output
112+
echo "has_updates=true" >> $GITHUB_OUTPUT
113+
echo "summary<<EOF" >> $GITHUB_OUTPUT
114+
echo "$SINCE_SUMMARY" >> $GITHUB_OUTPUT
115+
echo "EOF" >> $GITHUB_OUTPUT
116+
else
117+
echo "has_updates=false" >> $GITHUB_OUTPUT
118+
fi
119+
95120
- name: Update changelogs
96121
run: |
97122
# First, check if this is a breaking change release by using our new script
@@ -125,6 +150,12 @@ jobs:
125150
npm run release:notes 2>/dev/null | grep -v "^>" > /tmp/release-notes/release_notes.md
126151
fi
127152
153+
# Check if we have @since tag updates to append
154+
if [[ "${{ steps.update_since_tags.outputs.has_updates }}" == "true" ]]; then
155+
echo "" >> /tmp/release-notes/release_notes.md
156+
echo "${{ steps.update_since_tags.outputs.summary }}" >> /tmp/release-notes/release_notes.md
157+
fi
158+
128159
# Check if the file has content
129160
if [ ! -s /tmp/release-notes/release_notes.md ]; then
130161
# If empty, provide a default message

package-lock.json

Lines changed: 59 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"homepage": "https://github.com/jasonbahl/automation-tests#readme",
3737
"devDependencies": {
3838
"archiver": "^5.3.1",
39-
"chalk": "^5.3.0",
39+
"chalk": "^4.1.2",
4040
"dotenv": "^16.4.7",
4141
"fs-extra": "^11.1.1",
4242
"glob": "^10.3.3",

0 commit comments

Comments
 (0)