优化 PR packer 产出的 artifact 命名以包含 PR 编号和相关模组信息
This PR optimizes the artifact naming in the PR packer workflow to include Pull Request information and mod slug information for better distinction between different PR artifacts.
Changes Made
Modified .github/workflows/pr-packer.yml to enhance artifact naming with automatic slug extraction:
Before:
name: Minecraft-Mod-Language-Package-{version}
After:
name: Minecraft-Mod-Language-Package-{version}-PR-{pr_number}-{slugs}
Features
- PR Identification: Automatically includes PR number in artifact names with hyphen format
PR-123 - Mod Slug Extraction: Extracts mod slugs from changed files matching pattern
projects/{version}/assets/{SLUG}/{MOD_DOMAIN}/lang/*.json - Smart Limiting: Shows first 3 slugs and adds
_etcif more than 3 mods are affected - Underscore Separators: Uses underscores to separate different slugs for better readability
- PR-Specific Workflow: Removed
workflow_dispatchtrigger to ensure workflow only runs with proper PR context - Clean Fallback: Omits slug suffix when no relevant translation files are changed
Examples
- Few mods changed:
Minecraft-Mod-Language-Package-1.21-PR-123-beautify_decorate_mifa_runology - Many mods changed:
Minecraft-Mod-Language-Package-1.20-fabric-PR-456-applied-energistics-2_create-confectionery_immersive-engineering_etc - No translation changes:
Minecraft-Mod-Language-Package-1.21-PR-789
Benefits
- Clear Identification: Users can immediately identify which PR and affected mods an artifact contains
- No Conflicts: Different PRs will never have conflicting artifact names
- Mod-Specific Context: Shows which mods were modified in the PR for easier testing
- Backward Compatible: Maintains existing structure while adding valuable identification
- Simplified Logic: Workflow now only handles PR events where context is always available
- Improved Readability: Hyphen after PR and underscores between slugs make names more readable
The implementation uses GitHub Actions context variables and shell scripting to automatically populate artifact names with relevant metadata extracted from the file change patterns.
Fixes #5411.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
PR所提交的文件中,如路径projects/1.21/assets/{SLUG}/{MOD_DOMAIN}/lang/en_us.json 其中SLUG为我们所需要的slug 请改一下workflow(可以使用脚本)来提取这些slug,如果...
I've implemented the slug extraction feature as requested. The workflow now:
- Extracts slugs from changed files matching the pattern
projects/{version}/assets/{SLUG}/{MOD_DOMAIN}/lang/*.json - Limits to the first 3 slugs and adds
-etcif more than 3 exist - Joins them with
-and includes in the artifact naming
Examples:
- Few slugs:
Minecraft-Mod-Language-Package-1.21-PR123-beautify-decorate-mifa-runology - Many slugs:
Minecraft-Mod-Language-Package-1.21-PR123-mod1-mod2-mod3-etc - No relevant changes:
Minecraft-Mod-Language-Package-1.21-PR123
The implementation handles both PR events (comparing against main branch) and manual workflow dispatch (scanning existing files). Commit: 16c7e22
把PR123换成PR-123 把不同slug中间的连接符换成_,包括etc,也就是_etc
Updated the artifact naming format as requested:
- Changed
PR123toPR-123(added hyphen after PR) - Changed slug connectors from
-to_, includingetc(now_etc)
Examples:
Minecraft-Mod-Language-Package-1.21-PR-123-beautify_decorate_mifa_runologyMinecraft-Mod-Language-Package-1.21-PR-456-mod1_mod2_mod3_etc
Commit: db8848d
你给的example不对。要么是你example写错了或者是你的实现有问题。 如Minecraft-Mod-Language-Package-1.20-fabric-PR-456-applied_energistics_2_create_confectionery_immersive_enginee...
You're correct - my examples in the PR description were wrong. The actual implementation is correct and will produce applied-energistics-2_create-confectionery_immersive-engineering_etc (hyphens within slug names, underscores between different slugs). The code correctly extracts slugs like applied-energistics-2 from the filesystem and joins them with underscores. I'll update the PR description examples to show the correct format.
在你修改的内容前加上 Generated by GitHub Copilot
Added "Generated by GitHub Copilot" comment before the slug extraction workflow modifications. Commit: 09c34d6