Skip to content

Commit

Permalink
fix: use if let instead (#309)
Browse files Browse the repository at this point in the history
* fix(ci): daily task skipping commit while no changes

* fix: use if let instead
  • Loading branch information
greenhat616 authored Jan 22, 2024
1 parent 005f745 commit 390bf62
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,19 @@ jobs:
run: pnpm generate:manifest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# if nothing changed, skip commit
- name: Check for changes
id: git-check
run: echo ::set-output name=has-changes::$(if git diff --quiet; then echo "false"; else echo "true"; fi)
- uses: oleksiyrudenko/gha-git-credentials@v2-latest
if: steps.git-check.outputs.has-changes == 'true'
with:
token: "${{ secrets.GITHUB_TOKEN }}"
name: "github-actions[bot]"
email: "41898282+github-actions[bot]@users.noreply.github.com"

- name: Commit Manifest
if: steps.git-check.outputs.has-changes == 'true'
run: |
git add .
git commit -m "chore(manifest): update manifest [skip ci]"
Expand Down Expand Up @@ -62,12 +69,19 @@ jobs:
run: pnpm generate:manifest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# if nothing changed, skip commit
- name: Check for changes
id: git-check
run: echo ::set-output name=has-changes::$(if git diff --quiet; then echo "false"; else echo "true"; fi)
- uses: oleksiyrudenko/gha-git-credentials@v2-latest
if: steps.git-check.outputs.has-changes == 'true'
with:
token: "${{ secrets.GITHUB_TOKEN }}"
name: "github-actions[bot]"
email: "41898282+github-actions[bot]@users.noreply.github.com"

- name: Commit Manifest
if: steps.git-check.outputs.has-changes == 'true'
run: |
git add .
git commit -m "chore(manifest): update manifest [skip ci]"
Expand Down
25 changes: 11 additions & 14 deletions backend/tauri/src/config/prfitem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,21 +195,18 @@ impl PrfItem {
}
// 使用系统代理
else if with_proxy {
match Sysproxy::get_system_proxy() {
Ok(p @ Sysproxy { enable: true, .. }) => {
let proxy_scheme = format!("http://{}:{}", p.host, p.port);

if let Ok(proxy) = reqwest::Proxy::http(&proxy_scheme) {
builder = builder.proxy(proxy);
}
if let Ok(proxy) = reqwest::Proxy::https(&proxy_scheme) {
builder = builder.proxy(proxy);
}
if let Ok(proxy) = reqwest::Proxy::all(&proxy_scheme) {
builder = builder.proxy(proxy);
}
if let Ok(p @ Sysproxy { enable: true, .. }) = Sysproxy::get_system_proxy() {
let proxy_scheme = format!("http://{}:{}", p.host, p.port);

if let Ok(proxy) = reqwest::Proxy::http(&proxy_scheme) {
builder = builder.proxy(proxy);
}
if let Ok(proxy) = reqwest::Proxy::https(&proxy_scheme) {
builder = builder.proxy(proxy);
}
if let Ok(proxy) = reqwest::Proxy::all(&proxy_scheme) {
builder = builder.proxy(proxy);
}
_ => todo!(),
};
}

Expand Down
7 changes: 3 additions & 4 deletions backend/tauri/src/enhance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,15 @@ pub fn enhance() -> (Mapping, Vec<String>, HashMap<String, ResultLog>) {
.for_each(|item| {
log::debug!(target: "app", "run builtin script {}", item.uid);

match item.data {
ChainType::Script(script) => match use_script(script, config.to_owned()) {
if let ChainType::Script(script) = item.data {
match use_script(script, config.to_owned()) {
Ok((res_config, _)) => {
config = use_filter(res_config, &clash_fields, enable_filter);
}
Err(err) => {
log::error!(target: "app", "builtin script error `{err}`");
}
},
ChainType::Merge(_) => todo!(),
}
}
});
}
Expand Down

0 comments on commit 390bf62

Please sign in to comment.