Compare commits

...

7 Commits

Author SHA1 Message Date
Carlo Sala
ddd77516ef ci: add scorecard automatic update (#13319) 2025-09-19 17:55:16 +02:00
StepSecurity Bot
7f3d8a34e2 ci: Harden GitHub Actions [StepSecurity] (#13318) 2025-09-19 17:30:10 +02:00
Marc Cornellà
c87eb79140 feat(cli): only allow omz pr test on PRs with testers needed label (#13238) 2025-09-19 15:58:21 +02:00
jayant011797
c1e9748909 docs(tldr): state that tldr should be installed separately (#13298) 2025-09-19 15:51:23 +02:00
Paul Frederiksen
d3888251ac fix(check_for_upgrade): ensure compatibility with screen (#13302)
Co-authored-by: Paul Frederiksen <pfrederiksen@Pauls-Laptop.local>
2025-09-19 15:47:45 +02:00
Lin
34d6932b08 feat(task): add completion plugin (#13313) 2025-09-19 15:41:21 +02:00
Denys Dovhan
2b2d6d746c fix(bgnotify): use lsappinfo, add support for ghostty (#13314) 2025-09-19 15:39:50 +02:00
11 changed files with 169 additions and 12 deletions

View File

@@ -13,18 +13,23 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'ohmyzsh/ohmyzsh'
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Authenticate as @ohmyzsh
id: generate-token
uses: actions/create-github-app-token@v2
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
with:
app-id: ${{ secrets.OHMYZSH_APP_ID }}
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
- name: Setup Python
uses: actions/setup-python@v6
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: "3.12"
cache: "pip"

View File

@@ -25,8 +25,13 @@ jobs:
- ubuntu-latest
- macos-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- name: Set up git repository
uses: actions/checkout@v5
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Install zsh
if: runner.os == 'Linux'
run: sudo apt-get update; sudo apt-get install zsh
@@ -41,8 +46,13 @@ jobs:
needs:
- test
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Install Vercel CLI
run: npm install -g vercel
- name: Setup project and deploy

View File

@@ -23,8 +23,13 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'ohmyzsh/ohmyzsh'
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- name: Set up git repository
uses: actions/checkout@v5
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Install zsh
run: sudo apt-get update; sudo apt-get install zsh
- name: Check syntax

View File

@@ -16,9 +16,14 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'ohmyzsh/ohmyzsh'
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- name: Authenticate as @ohmyzsh
id: generate-token
uses: actions/create-github-app-token@v2
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
with:
app-id: ${{ secrets.OHMYZSH_APP_ID }}
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}

65
.github/workflows/scorecard.yml vendored Normal file
View File

@@ -0,0 +1,65 @@
# This workflow uses actions that are not certified by GitHub. They are provided
# by a third-party and are governed by separate terms of service, privacy
# policy, and support documentation.
name: Scorecard supply-chain security
on:
# For Branch-Protection check. Only the default branch is supported. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
branch_protection_rule:
# To guarantee Maintained check is occasionally updated. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
schedule:
- cron: '20 7 * * 2'
push:
branches: ["master"]
# Declare default permissions as read only.
permissions: read-all
jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
# Needed to publish results and get a badge (see publish_results below).
id-token: write
contents: read
actions: read
# To allow GraphQL ListCommits to work
issues: read
pull-requests: read
# To detect SAST tools
checks: read
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- name: "Checkout code"
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
with:
persist-credentials: false
- name: "Run analysis"
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
with:
results_file: results.sarif
results_format: sarif
publish_results: true
- name: "Upload artifact"
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: SARIF file
path: results.sarif
retention-days: 5
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@192325c86100d080feab897ff886c34abd4c83a3 # v3.30.3
with:
sarif_file: results.sarif

View File

@@ -621,10 +621,48 @@ function _omz::pr::test {
done
(( $found )) || {
_omz::log error "could not found the ohmyzsh git remote. Aborting..."
_omz::log error "could not find the ohmyzsh git remote. Aborting..."
return 1
}
# Check if Pull Request has the "testers needed" label
_omz::log info "checking if PR #$1 has the 'testers needed' label..."
local pr_json label label_id="MDU6TGFiZWw4NzY1NTkwNA=="
pr_json=$(
curl -fsSL \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/ohmyzsh/ohmyzsh/pulls/$1"
)
if [[ $? -gt 0 || -z "$pr_json" ]]; then
_omz::log error "error when trying to fetch PR #$1 from GitHub."
return 1
fi
# Check if the label is present with jq or grep
if (( $+commands[jq] )); then
label="$(command jq ".labels.[] | select(.node_id == \"$label_id\")" <<< "$pr_json")"
else
label="$(command grep "\"$label_id\"" <<< "$pr_json" 2>/dev/null)"
fi
# If a maintainer hasn't labeled the PR to test, explain the security risk
if [[ -z "$label" ]]; then
_omz::log warn "PR #$1 does not have the 'testers needed' label. This means that the PR"
_omz::log warn "has not been reviewed by a maintainer and may contain malicious code."
# Ask for explicit confirmation: user needs to type "yes" to continue
_omz::log prompt "Do you want to continue testing it? [yes/N] "
builtin read -r
if [[ "${REPLY:l}" != yes ]]; then
_omz::log error "PR test canceled. Please ask a maintainer to review and label the PR."
return 1
else
_omz::log warn "Continuing to check out and test PR #$1. Be careful!"
fi
fi
# Fetch pull request head
_omz::log info "fetching PR #$1 to ohmyzsh/pull-$1..."
command git fetch -f "$remote" refs/pull/$1/head:ohmyzsh/pull-$1 || {

View File

@@ -60,8 +60,10 @@ function bgnotify_formatted {
}
function bgnotify_appid {
if (( ${+commands[osascript]} )); then
osascript -e "tell application id \"$(bgnotify_programid)\" to get the {id, frontmost, id of front window, visible of front window}" 2>/dev/null
if (( ${+commands[lsappinfo]} )); then
lsappinfo info -only bundleid "$(lsappinfo front)" | awk -F= '{print $2}' | tr -d '"' 2>/dev/null
elif (( ${+commands[osascript]} )); then
osascript -e "tell application id \"$(bgnotify_programid)\" to get the {id, frontmost, id of front window, visible of front window}" 2>/dev/null
elif [[ -n $WAYLAND_DISPLAY ]] && ([[ -n $SWAYSOCK ]] || [[ -n $I3SOCK ]]) && (( ${+commands[swaymsg]} )); then # wayland+sway
local app_id=$(bgnotify_find_sway_appid)
[[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS
@@ -108,6 +110,7 @@ function bgnotify_programid {
case "$TERM_PROGRAM" in
iTerm.app) echo 'com.googlecode.iterm2' ;;
Apple_Terminal) echo 'com.apple.terminal' ;;
ghostty) echo 'com.mitchellh.ghostty' ;;
esac
}

9
plugins/task/README.md Normal file
View File

@@ -0,0 +1,9 @@
# Buf plugin
This plugin adds completion for [Task CLI](https://taskfile.dev/), a fast, cross-platform build tool inspired by Make, designed for modern workflows.
To use it, add `task` to the plugins array in your zshrc file:
```zsh
plugins=(... task)
```

View File

@@ -0,0 +1,14 @@
# Autocompletion for the task CLI (task).
if (( !$+commands[task] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `task`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_task" ]]; then
typeset -g -A _comps
autoload -Uz _task
_comps[task]=_task
fi
# Generate and load task completion
task --completion zsh >! "$ZSH_CACHE_DIR/completions/_task" &|

View File

@@ -13,3 +13,6 @@ plugins=(... tldr)
| Shortcut | Description |
|------------------------------------|----------------------------------------------------------------------------|
| <kbd>Esc</kbd> + tldr | add tldr before the previous command to see the tldr page for this command |
## Note
You also need to install ```tldr```.

View File

@@ -232,7 +232,7 @@ function handle_update() {
# Ask for confirmation and only update on 'y', 'Y' or Enter
# Otherwise just show a reminder for how to update
echo -n "[oh-my-zsh] Would you like to update? [Y/n] "
printf "[oh-my-zsh] Would you like to update? [Y/n] "
read -r -k 1 option
[[ "$option" = $'\n' ]] || echo
case "$option" in
@@ -280,7 +280,7 @@ case "$update_mode" in
return 0
elif [[ "$EXIT_STATUS" -ne 0 ]]; then
print -P "\n%F{red}[oh-my-zsh] There was an error updating:%f"
printf "\n${fg[yellow]}%s${reset_color}" "$ERROR"
printf "\n${fg[yellow]}%s${reset_color}" "${ERROR}"
return 0
fi
} always {