Enhance reusable Zsh CI workflow with fixes and improvements#428
Open
ss-o wants to merge 11 commits into
Open
Conversation
Agent-Logs-Url: https://github.com/z-shell/.github/sessions/049d7344-1f68-482a-a7df-c757da5c5a75 Co-authored-by: ss-o <59910950+ss-o@users.noreply.github.com>
Agent-Logs-Url: https://github.com/z-shell/.github/sessions/049d7344-1f68-482a-a7df-c757da5c5a75 Co-authored-by: ss-o <59910950+ss-o@users.noreply.github.com>
Agent-Logs-Url: https://github.com/z-shell/.github/sessions/049d7344-1f68-482a-a7df-c757da5c5a75 Co-authored-by: ss-o <59910950+ss-o@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Sall <59910950+ss-o@users.noreply.github.com>
Agent-Logs-Url: https://github.com/z-shell/.github/sessions/ce3b120c-fbcc-4575-88e5-9b02d5b62f8b Co-authored-by: ss-o <59910950+ss-o@users.noreply.github.com>
Agent-Logs-Url: https://github.com/z-shell/.github/sessions/ce3b120c-fbcc-4575-88e5-9b02d5b62f8b Co-authored-by: ss-o <59910950+ss-o@users.noreply.github.com>
Agent-Logs-Url: https://github.com/z-shell/.github/sessions/ce3b120c-fbcc-4575-88e5-9b02d5b62f8b Co-authored-by: ss-o <59910950+ss-o@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to improve cross-repo reuse for Zsh CI by introducing a reusable workflow and making the existing zsh-n workflow callable via workflow_call.
Changes:
- Added
workflow_calltrigger support to.github/workflows/zsh-n.yml. - Added a new reusable workflow
.github/workflows/reusable-zsh-ci.ymlto runzsh -nandzcompileacross all*.zshfiles.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
.github/workflows/zsh-n.yml |
Adds workflow_call so the existing per-file matrix syntax/compile workflow can be invoked as a reusable workflow. |
.github/workflows/reusable-zsh-ci.yml |
Introduces a new reusable workflow that discovers *.zsh files, runs zsh -n, and compiles them with zcompile. |
Comment on lines
+4
to
+10
| "on": | ||
| workflow_call: {} | ||
|
|
||
| jobs: | ||
| zsh-ci: | ||
| runs-on: ubuntu-latest | ||
| steps: |
| --- | ||
| name: Reusable Zsh CI | ||
|
|
||
| "on": |
| uses: actions/checkout@v4.2.2 | ||
|
|
||
| - name: ⚡ Install Zsh | ||
| run: sudo apt update && sudo apt-get install -yq zsh |
Comment on lines
+9
to
+44
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: ⤵️ Check out code from GitHub | ||
| uses: actions/checkout@v4.2.2 | ||
|
|
||
| - name: ⚡ Install Zsh | ||
| run: sudo apt update && sudo apt-get install -yq zsh | ||
|
|
||
| - name: ⚡ zsh -n on all .zsh files | ||
| run: | | ||
| set -euo pipefail | ||
| mapfile -d '' files < <( | ||
| find . -type d -name 'doc' -prune -o -type f -name '*.zsh' -print0 | ||
| ) | ||
| if [ "${#files[@]}" -eq 0 ]; then | ||
| echo "ERROR: No .zsh files found to validate." >&2 | ||
| exit 1 | ||
| fi | ||
| for file in "${files[@]}"; do | ||
| zsh -n "${file}" | ||
| done | ||
|
|
||
| - name: ⚡ zcompile all .zsh files | ||
| run: | | ||
| set -euo pipefail | ||
| mapfile -d '' files < <( | ||
| find . -type d -name 'doc' -prune -o -type f -name '*.zsh' -print0 | ||
| ) | ||
| if [ "${#files[@]}" -eq 0 ]; then | ||
| echo "ERROR: No .zsh files found to compile." >&2 | ||
| exit 1 | ||
| fi | ||
| for file in "${files[@]}"; do | ||
| zsh -fc 'zcompile -- "$1"' zsh "${file}" | ||
| ls -al "${file}.zwc" | ||
| done |
- Unquote `on:` for consistency with other workflows
- Add workflow-level `permissions: {}` and job-level `permissions: contents: read`
- Add `concurrency:` block matching other repo workflows
- Pin actions/checkout to SHA de0fac2e (v6.0.2)
- Use apt-get consistently (drop bare `apt update`)
- Prune `.git/` in both find commands alongside `doc/`
- Change exit 1 on no .zsh files to no-op exit 0
Agent-Logs-Url: https://github.com/z-shell/.github/sessions/ba89a619-772a-4b3e-9e6c-57c215be60dc
Co-authored-by: ss-o <59910950+ss-o@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request introduces a reusable GitHub Actions workflow for Zsh CI and updates the existing Zsh workflow to support reuse. The main goal is to standardize Zsh file validation and compilation across repositories by providing a reusable workflow component.
Workflow improvements:
.github/workflows/reusable-zsh-ci.ymlthat checks out code, installs Zsh, validates all.zshfiles withzsh -n, and compiles them withzcompile. This workflow is designed to be called from other workflows or repositories..github/workflows/zsh-n.ymlto addworkflow_call, enabling this workflow to be invoked by other workflows or repositories, increasing modularity and reusability.Verification
Agent handoff
If this PR is unfinished, blocked, or expected to be resumed by another maintainer or LLM agent, include:
If no handoff is needed, write:
No handoff needed.