mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2025-12-06 07:20:40 +01:00
Compare commits
4 Commits
a449c0247d
...
e9fc134236
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9fc134236 | ||
|
|
977c4f93a6 | ||
|
|
ee30bc535a | ||
|
|
ca5c467db1 |
5
.github/workflows/dependencies.yml
vendored
5
.github/workflows/dependencies.yml
vendored
@@ -4,14 +4,13 @@ on:
|
|||||||
schedule:
|
schedule:
|
||||||
- cron: "0 6 * * 0"
|
- cron: "0 6 * * 0"
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
name: Check for updates
|
name: Check for updates
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||||
|
permissions:
|
||||||
|
contents: write # this is needed to push commits and branches
|
||||||
steps:
|
steps:
|
||||||
- name: Harden the runner (Audit all outbound calls)
|
- name: Harden the runner (Audit all outbound calls)
|
||||||
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
||||||
|
|||||||
72
.github/workflows/dependencies/updater.py
vendored
72
.github/workflows/dependencies/updater.py
vendored
@@ -219,32 +219,33 @@ class Dependency:
|
|||||||
# Create new branch
|
# Create new branch
|
||||||
branch = Git.checkout_or_create_branch(branch_name)
|
branch = Git.checkout_or_create_branch(branch_name)
|
||||||
|
|
||||||
# Update dependencies.yml file
|
|
||||||
self.__update_yaml(
|
|
||||||
f"tag:{new_version}" if is_tag else status["version"]
|
|
||||||
)
|
|
||||||
|
|
||||||
# Update dependency files
|
# Update dependency files
|
||||||
self.__apply_upstream_changes()
|
self.__apply_upstream_changes()
|
||||||
|
|
||||||
# Add all changes and commit
|
if not Git.repo_is_clean():
|
||||||
has_new_commit = Git.add_and_commit(self.name, new_version)
|
# Update dependencies.yml file
|
||||||
|
self.__update_yaml(
|
||||||
if has_new_commit:
|
f"tag:{new_version}" if is_tag else status["version"]
|
||||||
# Push changes to remote
|
|
||||||
Git.push(branch)
|
|
||||||
|
|
||||||
# Create GitHub PR
|
|
||||||
GitHub.create_pr(
|
|
||||||
branch,
|
|
||||||
f"feat({self.name}): update to version {new_version}",
|
|
||||||
f"""## Description
|
|
||||||
|
|
||||||
Update for **{self.desc}**: update to version [{new_version}]({status['head_url']}).
|
|
||||||
Check out the [list of changes]({status['compare_url']}).
|
|
||||||
""",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Add all changes and commit
|
||||||
|
has_new_commit = Git.add_and_commit(self.name, new_version)
|
||||||
|
|
||||||
|
if has_new_commit:
|
||||||
|
# Push changes to remote
|
||||||
|
Git.push(branch)
|
||||||
|
|
||||||
|
# Create GitHub PR
|
||||||
|
GitHub.create_pr(
|
||||||
|
branch,
|
||||||
|
f"chore({self.name}): update to version {new_version}",
|
||||||
|
f"""## Description
|
||||||
|
|
||||||
|
Update for **{self.desc}**: update to version [{new_version}]({status["head_url"]}).
|
||||||
|
Check out the [list of changes]({status["compare_url"]}).
|
||||||
|
""",
|
||||||
|
)
|
||||||
|
|
||||||
# Clean up repository
|
# Clean up repository
|
||||||
Git.clean_repo()
|
Git.clean_repo()
|
||||||
except (CommandRunner.Exception, shutil.Error) as e:
|
except (CommandRunner.Exception, shutil.Error) as e:
|
||||||
@@ -275,8 +276,8 @@ Check out the [list of changes]({status['compare_url']}).
|
|||||||
|
|
||||||
There is a new version of `{self.name}` {self.kind} available.
|
There is a new version of `{self.name}` {self.kind} available.
|
||||||
|
|
||||||
New version: [{new_version}]({status['head_url']})
|
New version: [{new_version}]({status["head_url"]})
|
||||||
Check out the [list of changes]({status['compare_url']}).
|
Check out the [list of changes]({status["compare_url"]}).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
print("Creating GitHub issue", file=sys.stderr)
|
print("Creating GitHub issue", file=sys.stderr)
|
||||||
@@ -377,21 +378,28 @@ class Git:
|
|||||||
)
|
)
|
||||||
return branch_name
|
return branch_name
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def repo_is_clean() -> bool:
|
||||||
|
"""
|
||||||
|
Returns `True` if the repo is clean.
|
||||||
|
Returns `False` if the repo is dirty.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
CommandRunner.run_or_fail(
|
||||||
|
["git", "diff", "--exit-code"], stage="CheckRepoClean"
|
||||||
|
)
|
||||||
|
return True
|
||||||
|
except CommandRunner.Exception:
|
||||||
|
return False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def add_and_commit(scope: str, version: str) -> bool:
|
def add_and_commit(scope: str, version: str) -> bool:
|
||||||
"""
|
"""
|
||||||
Returns `True` if there were changes and were indeed commited.
|
Returns `True` if there were changes and were indeed commited.
|
||||||
Returns `False` if the repo was clean and no changes were commited.
|
Returns `False` if the repo was clean and no changes were commited.
|
||||||
"""
|
"""
|
||||||
# check if repo is clean (clean => no error, no commit)
|
if Git.repo_is_clean():
|
||||||
try:
|
|
||||||
CommandRunner.run_or_fail(
|
|
||||||
["git", "diff", "--exit-code"], stage="CheckRepoClean"
|
|
||||||
)
|
|
||||||
return False
|
return False
|
||||||
except CommandRunner.Exception:
|
|
||||||
# if it's other kind of error just throw!
|
|
||||||
pass
|
|
||||||
|
|
||||||
user_name = os.environ.get("GIT_APP_NAME")
|
user_name = os.environ.get("GIT_APP_NAME")
|
||||||
user_email = os.environ.get("GIT_APP_EMAIL")
|
user_email = os.environ.get("GIT_APP_EMAIL")
|
||||||
@@ -415,7 +423,7 @@ class Git:
|
|||||||
f"user.email={user_email}",
|
f"user.email={user_email}",
|
||||||
"commit",
|
"commit",
|
||||||
"-m",
|
"-m",
|
||||||
f"feat({scope}): update to {version}",
|
f"chore({scope}): update to {version}",
|
||||||
],
|
],
|
||||||
stage="CreateCommit",
|
stage="CreateCommit",
|
||||||
env=clean_env,
|
env=clean_env,
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
# Fig plugin
|
|
||||||
|
|
||||||
This plugin sets up completion for [Fig](https://fig.io/).
|
|
||||||
|
|
||||||
To use it, add `fig` to the plugins array in your zshrc file:
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
plugins=(... fig)
|
|
||||||
```
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
if ! (( $+commands[fig] )); then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If the completion file doesn't exist yet, we need to autoload it and
|
|
||||||
# bind it to `fig`. Otherwise, compinit will have already done that
|
|
||||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_fig" ]]; then
|
|
||||||
autoload -Uz _fig
|
|
||||||
typeset -g -A _comps
|
|
||||||
_comps[fig]=_fig
|
|
||||||
fi
|
|
||||||
|
|
||||||
fig completion zsh >| "$ZSH_CACHE_DIR/completions/_fig" &|
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
# rbfu plugin
|
|
||||||
|
|
||||||
This plugin starts [rbfu](https://github.com/hmans/rbfu), a minimal Ruby version
|
|
||||||
manager, and adds some useful functions.
|
|
||||||
|
|
||||||
To use it, add `rbfu` to the plugins array in your zshrc file:
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
plugins=(... rbfu)
|
|
||||||
```
|
|
||||||
|
|
||||||
**Note: `rbfu` is deprecated and should no longer be used.**
|
|
||||||
|
|
||||||
## Functions
|
|
||||||
|
|
||||||
- `rbfu-rubies`: lists all installed rubies available to rbfu.
|
|
||||||
|
|
||||||
- `rvm_prompt_info`: shows the Ruby version being used with rbfu.
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
# Enables rbfu with --auto option, if available.
|
|
||||||
#
|
|
||||||
# Also provides a command to list all installed/available
|
|
||||||
# rubies. To ensure compatibility with themes, creates the
|
|
||||||
# rvm_prompt_info function to return the $RBFU_RUBY_VERSION
|
|
||||||
# version.
|
|
||||||
|
|
||||||
command -v rbfu &>/dev/null || return
|
|
||||||
|
|
||||||
eval "$(rbfu --init --auto)"
|
|
||||||
|
|
||||||
# Internal: Print ruby version details, if it's currently active, etc.
|
|
||||||
function _rbfu_rubies_print() {
|
|
||||||
# 1: path to ruby file
|
|
||||||
# 2: active ruby
|
|
||||||
local rb rb_out
|
|
||||||
rb="${$1:t}"
|
|
||||||
rb_out="$rb"
|
|
||||||
|
|
||||||
# If the ruby is a symlink, add @ to the name.
|
|
||||||
if [[ -h "$1" ]]; then
|
|
||||||
rb_out="${rb_out}${fg[green]}@${reset_color}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If the ruby is active, add * to the name and show it in red.
|
|
||||||
if [[ "$rb" = "$2" ]]; then
|
|
||||||
rb_out="${fg[red]}${rb_out} ${fg[red]}*${reset_color}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo $rb_out
|
|
||||||
}
|
|
||||||
|
|
||||||
# Public: Provide a list with all available rubies, this basically depends
|
|
||||||
# on ~/.rfbu/rubies. Highlights the currently active ruby version and aliases.
|
|
||||||
function rbfu-rubies() {
|
|
||||||
local rbfu_dir active_rb
|
|
||||||
rbfu_dir="${RBFU_RUBIES:-${HOME}/.rbfu/rubies}"
|
|
||||||
active_rb="${RBFU_RUBY_VERSION:-system}"
|
|
||||||
|
|
||||||
_rbfu_rubies_print "${rbfu_dir}/system" "$active_rb"
|
|
||||||
for rb in ${rbfu_dir}/*(N); do
|
|
||||||
_rbfu_rubies_print "$rb" "$active_rb"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# Public: Create rvm_prompt_info command for themes compatibility, unless
|
|
||||||
# it has already been defined.
|
|
||||||
(( ${+functions[rvm_prompt_info]} )) || \
|
|
||||||
function rvm_prompt_info() { echo "${${RBFU_RUBY_VERSION:=system}:gs/%/%%}" }
|
|
||||||
Reference in New Issue
Block a user