Git Product home page Git Product logo

nhs-england-tools / update-from-template-app Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 2.0 1.4 MB

:octocat: ๐Ÿ”„ ๐Ÿ“ Automation to synchronise updates from a template repository to all associated repositories. Enhances maintainability, consistency and governance across the NHS England's GitHub projects.

License: MIT License

Makefile 9.50% Shell 38.58% Dockerfile 1.23% Go 50.68%
automation devops engineering github-action github-app nhs-digital nhs-england

update-from-template-app's People

Contributors

github-actions[bot] avatar stefaniuk avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

update-from-template-app's Issues

Accidental repository deletion

Here we have this code:

  # Delete files
  to_delete=$(
    cat $list_of_files_to_update_json \
      | jq -r '.comparison | to_entries[] | select(.value.action == "delete") | .key'
  )
  echo "$to_delete" | while IFS= read -r file; do
    rm -rf $dest_dir/$file
  done

If there are no files marked for deletion, $to_delete isn't empty, it contains a single newline. That means the while loop evaluates once, with rm expanded to rm -rf $dest_dir/. That (rather obviously) breaks subsequent steps. If somehow we'd managed to get to this point with $dest_dir set to an empty string too, that would be... uh... bad, but we're also not asserting there's anything in that variable in this function.

I think the right thing to do is to check for this in the while loop with an if [ ! -z "$file" ]; then... just for robustness, but it might be that we want to tweak the jq invocation somehow too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.