From d59a70a64c4f8b95990438785032b25dce8c0502 Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Mon, 18 Oct 2021 10:30:27 -0700 Subject: [PATCH] flake-update: init action --- LICENSE | 21 +++++++++++++++++++++ README.md | 26 ++++++++++++++++++++++++++ action.yml | 24 ++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 action.yml diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..982b3b7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Determinate Systems, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..b4170a2 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# update-flake-lock + +This is a GitHub Action that will update your flake.lock file whenever it is run. + +> NOTE: We hardcode the `install_url` to a relatively recent `nixUnstable` (`nix-2.5pre20211015_130284b` currently). If you need a newer version that includes a new feature or important bug fix, feel free to file an issue or send a PR bumping the `install_url` inside the [`action.yml`](action.yml)! + +## Example + +An example GitHub Action workflow using this action would look like the following: + +```yaml +name: update-flake-lock +on: + workflow_dispatch: + +jobs: + lockfile: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Update flake.lock + uses: DeterminateSystems/update-flake-lock@main +``` + +To have this workflow run on a recurring basis, see the [GitHub Actions documentation on the `schedule` key](https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#schedule). diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..94fe857 --- /dev/null +++ b/action.yml @@ -0,0 +1,24 @@ +name: 'Update flake.lock' +description: 'Update your flake.lock and send a PR' +runs: + using: "composite" + steps: + - uses: cachix/install-nix-action@v14 + with: + install_url: https://github.com/numtide/nix-unstable-installer/releases/download/nix-2.5pre20211015_130284b/install + extra_nix_config: | + experimental-features = nix-command flakes + - run: nix flake lock --commit-lock-file + shell: bash + env: + GIT_AUTHOR_NAME: github-actions[bot] + GIT_AUTHOR_EMAIL: + GIT_COMMITTER_NAME: github-actions[bot] + GIT_COMMITTER_EMAIL: + - name: Create PR + uses: peter-evans/create-pull-request@v3 + with: + branch: update_flake_lock_action + delete-branch: true + title: "flake.lock: Update" + body: Automated changes by the [update-flake-lock](https://github.com/DeterminateSystems/update-flake-lock) GitHub Action.