Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/common/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ impl ExplicitExpr {
/// `${{ body }}`. Leading and trailing whitespace within
/// the expression body is removed.
pub fn as_bare(&self) -> &str {
return self
.as_curly()
self.as_curly()
.strip_prefix("${{")
.and_then(|e| e.strip_suffix("}}"))
.map(|e| e.trim())
.expect("invariant violated: ExplicitExpr must be an expression");
.expect("invariant violated: ExplicitExpr must be an expression")
}
}

Expand Down Expand Up @@ -113,7 +112,7 @@ mod tests {
#[test]
fn test_expr() {
let expr = "\" ${{ foo }} \\t \"";
let expr: ExplicitExpr = serde_yaml::from_str(&expr).unwrap();
let expr: ExplicitExpr = serde_yaml::from_str(expr).unwrap();
assert_eq!(expr.as_bare(), "foo");
}

Expand Down
4 changes: 2 additions & 2 deletions src/workflow/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pub enum StepBody {
working_directory: Option<String>,
shell: Option<String>,
#[serde(default)]
env: Env,
env: LoE<Env>,
},
}

Expand Down Expand Up @@ -239,7 +239,7 @@ matrix:
let runson = "group: \nlabels: []";

assert_eq!(
serde_yaml::from_str::<RunsOn>(&runson)
serde_yaml::from_str::<RunsOn>(runson)
.unwrap_err()
.to_string(),
"runs-on must provide either `group` or one or more `labels`"
Expand Down
39 changes: 39 additions & 0 deletions tests/sample-workflows/jazzband-tablib-docs-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# https://raw.githubusercontent.com/jazzband/tablib/dcab406c553fc8b3c2e0aef955e9e8adea0590d8/.github/workflows/docs-lint.yml
name: Docs and lint

on: [push, pull_request, workflow_dispatch]

env:
FORCE_COLOR: 1
PIP_DISABLE_PIP_VERSION_CHECK: 1

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
env:
- TOXENV: docs
- TOXENV: lint

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
cache: pip
cache-dependency-path: "pyproject.toml"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox

- name: Tox
run: tox
env: ${{ matrix.env }}
2 changes: 1 addition & 1 deletion tests/test_workflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn test_pip_audit_ci() {
run,
working_directory,
shell,
env,
env: LoE::Literal(env),
} = &test_job.steps[2].body
else {
panic!("expected run step");
Expand Down
Loading