{"id":28316618,"url":"https://github.com/dikkadev/calverlex","last_synced_at":"2025-08-02T11:09:35.301Z","repository":{"id":295328812,"uuid":"989819275","full_name":"dikkadev/CalVerLex","owner":"dikkadev","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-25T00:45:22.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-29T23:55:10.912Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dikkadev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-24T22:24:12.000Z","updated_at":"2025-05-25T00:45:26.000Z","dependencies_parsed_at":"2025-05-26T12:17:03.290Z","dependency_job_id":null,"html_url":"https://github.com/dikkadev/CalVerLex","commit_stats":null,"previous_names":["dikkadev/calverlex"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dikkadev/CalVerLex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dikkadev%2FCalVerLex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dikkadev%2FCalVerLex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dikkadev%2FCalVerLex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dikkadev%2FCalVerLex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dikkadev","download_url":"https://codeload.github.com/dikkadev/CalVerLex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dikkadev%2FCalVerLex/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268378808,"owners_count":24240896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-25T02:12:05.077Z","updated_at":"2025-08-02T11:09:35.274Z","avatar_url":"https://github.com/dikkadev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CalVerLex GitHub Action\n\nGenerate unbounded CalVer (Calendar Versioning) tags with lexical suffixes for unlimited same-day releases.\n\n## Versioning Scheme Specification\n\n### Format: `YYWWD` + `suffix`\n\nCalVerLex uses a date-based prefix followed by a lexical suffix:\n\n- **YY/YYYY**: 2-digit or 4-digit year (configurable)\n- **WW**: Zero-padded ISO week number (01-53) \n- **D**: Day of week (1=Monday, 7=Sunday)\n- **suffix**: Lexical sequence (a, b, c, ..., z, aa, ab, ..., zz, aaa, ...)\n\n### Examples\n\n| Date | Week | Day | 2-digit Year | 4-digit Year | First Release | Second Release | 27th Release |\n|------|------|-----|--------------|--------------|---------------|----------------|--------------|\n| 2025-01-20 | 4 | 1 (Mon) | `25041a` | `2025041a` | `25041a` | `25041b` | `25041aa` |\n| 2025-01-21 | 4 | 2 (Tue) | `25042a` | `2025042a` | `25042a` | `25042b` | `25042aa` |\n| 2025-12-29 | 1 | 1 (Mon) | `25011a` | `2025011a` | `25011a` | `25011b` | `25011aa` |\n\n### Lexical Suffix Sequence\n\nThe suffix follows Excel-style column naming:\n\n```\na, b, c, ..., x, y, z,           (1-26)\naa, ab, ac, ..., ax, ay, az,     (27-52)\nba, bb, bc, ..., bx, by, bz,     (53-78)\n...\nza, zb, zc, ..., zx, zy, zz,     (677-702)\naaa, aab, aac, ...               (703+)\n```\n\nThis provides unlimited same-day releases without numeric conflicts.\n\n### ISO Week Calculation\n\nCalVerLex uses ISO 8601 week numbering:\n- Week 1 contains January 4th\n- Weeks run Monday to Sunday  \n- Week numbers are zero-padded (01, 02, ..., 53)\n\n## Usage\n\n### Basic Usage\n\n```yaml\n- name: Generate CalVerLex tag\n  id: calverlex\n  uses: dikkadev/CalVerLex@main\n  with:\n    github_token: ${{ secrets.GITHUB_TOKEN }}\n\n- name: Use the generated tag\n  run: echo \"New tag: ${{ steps.calverlex.outputs.tag }}\"\n```\n\n### Configuration Options\n\n```yaml\n- name: Generate CalVerLex tag\n  uses: dikkadev/CalVerLex@main\n  with:\n    github_token: ${{ secrets.GITHUB_TOKEN }}\n    repository: ${{ github.repository }}     # Optional: defaults to current repo\n    year_format: '4'                         # Optional: '2' or '4' (default: '2')\n    current_version: '25041b'                # Optional: current latest version to increment from\n```\n\n### Inputs\n\n| Input | Description | Required | Default |\n|-------|-------------|----------|---------|\n| `github_token` | GitHub token for API access | Yes | |\n| `repository` | Repository in format `owner/repo` | No | `${{ github.repository }}` |\n| `year_format` | Year digits: `2` or `4` | No | `2` |\n| `current_version` | Current latest version (format: `YYWWDx`) to increment from instead of API lookup | No | |\n\n### Outputs\n\n| Output | Description |\n|--------|-------------|\n| `tag` | Generated CalVerLex tag (e.g., `25041c`) |\n\n## Examples\n\n### Continuous Integration\n\n```yaml\nname: CI/CD Pipeline\non:\n  push:\n    branches: [main]\n\njobs:\n  release:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      \n      - name: Generate version tag\n        id: version\n        uses: dikkadev/CalVerLex@main\n        with:\n          github_token: ${{ secrets.GITHUB_TOKEN }}\n      \n      - name: Create release\n        uses: actions/create-release@v1\n        with:\n          tag_name: ${{ steps.version.outputs.tag }}\n          release_name: Release ${{ steps.version.outputs.tag }}\n```\n\n### Manual Override\n\nWhen you need to specify the current version manually (useful for testing or when API access is limited):\n\n```yaml\n- name: Generate next version from z to aa\n  uses: dikkadev/CalVerLex@main\n  with:\n    github_token: ${{ secrets.GITHUB_TOKEN }}\n    current_version: '25041z'  # Will generate 25041aa (same day) or 25042a (different day)\n```\n\n### 4-Digit Year Format\n\nFor long-term projects that need year clarity:\n\n```yaml\n- name: Generate version with full year\n  uses: dikkadev/CalVerLex@main\n  with:\n    github_token: ${{ secrets.GITHUB_TOKEN }}\n    year_format: '4'\n```\n\n## Edge Cases \u0026 Behavior\n\n### Same Day Multiple Releases\n\nMultiple releases on the same day increment the suffix:\n- First: `25041a`\n- Second: `25041b` \n- 26th: `25041z`\n- 27th: `25041aa`\n- 52nd: `25041az`\n- 53rd: `25041ba`\n\n### Date Changes\n\nWhen the date changes, the suffix resets to 'a':\n- Last release of day: `25041z`\n- First release next day: `25042a`\n\n### API Fallback\n\nIf GitHub API is unavailable, the action falls back to suffix 'a':\n- No API access: generates `25041a`\n- Graceful degradation ensures the action always succeeds\n\n### Year Boundaries\n\nCalVerLex handles year transitions correctly using ISO week numbers:\n- December dates can be part of the next year's week 1\n- January dates can be part of the previous year's last week\n- The action always uses the ISO week year, not calendar year\n\n### Invalid Tags\n\nThe action ignores non-CalVerLex tags in the repository:\n- Ignores: `v1.0.0`, `release-2024`, `25041` (no suffix)\n- Processes: `25041a`, `25041bb`, `2025041z`\n\n## Error Handling\n\nThe action provides clear error messages for common issues:\n\n- **Missing GitHub token**: `GitHub token is required`\n- **Invalid repository format**: `Invalid repository format: xyz. Expected format: owner/repo`\n- **Invalid current_version**: `Invalid version format: abc. Expected format: YYWWDx (e.g., 25216a)`\n- **API errors**: Logs debug information and falls back gracefully\n\n## Parsing\n\n### Known Year Format\n\nIf you know whether the tag uses 2-digit or 4-digit year format, parsing is trivial from front to back.\n\n### Unknown Year Format\n\nWhen the year format is unknown, parsing from the back is not much more complex:\n\n```pseudo\nfunction parseCalVerLex(tag):\n    i = tag.length - 1\n    suffix = \"\"\n    \n    // Iterate from back collecting all letters (suffix)\n    while i \u003e= 0 and tag[i] is letter:\n        suffix = tag[i] + suffix\n        i = i - 1\n    \n    // Take single digit (day)\n    day = tag[i]\n    i = i - 1\n    \n    // Take 2 digits (week)\n    week = tag[i-1] + tag[i]\n    i = i - 2\n    \n    // Remaining digits are year\n    year = tag[0..i]\n    \n    return {year, week, day, suffix}\n```\n\nThe lexical suffix always consists of lowercase letters `[a-z]+`, making it easy to identify the boundary between date and suffix components.\n\n## Testing\n\n### Local Testing\n\nTest the action locally before pushing:\n\n```bash\n# Set up required environment variables\nexport GITHUB_OUTPUT=$(mktemp)  # Required for local testing\nexport INPUT_GITHUB_TOKEN=\"your_token\"\nexport INPUT_REPOSITORY=\"owner/repo\"\n\n# Basic test\nnode src/index.js\n\n# Test with current version override\nexport INPUT_CURRENT_VERSION=\"25041a\"\nnode src/index.js\n\n# Test with 4-digit year\nexport INPUT_YEAR_FORMAT=\"4\"\nnode src/index.js\n\n# Clean up\nrm -f \"$GITHUB_OUTPUT\"\n```\n\n### Automated Testing Script\n\nUse the provided testing script for comprehensive local validation:\n\n```bash\n# Run all local tests with proper environment setup\n./test/test-local.sh\n```\n\n### Unit Tests\n\nRun comprehensive unit tests that validate the core mathematical functions:\n\n```bash\nnode test/unit-tests.js\n```\n\n### GitHub Actions Testing\n\nThe action includes comprehensive integration tests that run on every push:\n\n- **Basic functionality** - Tests default behavior with today's date\n- **Current version override** - Tests manual version specification and suffix increment\n- **4-digit year format** - Tests year format options with full date validation\n- **Error handling** - Tests invalid input handling\n- **Sequential runs** - Tests multiple runs with proper `a → b` incrementing\n- **Suffix boundary** - Tests critical `z → aa` boundary condition\n\nThese tests run automatically and validate both the action's output format and correctness of the generated tags.\n\n## Contributing\n\n1. Fork the repository: https://github.com/dikkadev/CalVerLex\n2. Run tests locally: `node test/unit-tests.js \u0026\u0026 ./test/test-local.sh`\n3. Follow conventional commits\n4. Update documentation for any API changes\n5. Submit pull request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdikkadev%2Fcalverlex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdikkadev%2Fcalverlex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdikkadev%2Fcalverlex/lists"}