From 9975ab9a015048f13e841d21e5bf4a3dca05ad5d Mon Sep 17 00:00:00 2001 From: winston Date: Sat, 11 May 2024 04:59:47 +0200 Subject: [PATCH] ci: add renovate-post --- .github/scripts/render-dhall-changes.sh | 6 ++++ .github/workflows/renovate-post.dhall | 48 +++++++++++++++++++++++++ .github/workflows/renovate-post.yml | 27 ++++++++++++++ 3 files changed, 81 insertions(+) create mode 100755 .github/scripts/render-dhall-changes.sh create mode 100644 .github/workflows/renovate-post.dhall create mode 100644 .github/workflows/renovate-post.yml diff --git a/.github/scripts/render-dhall-changes.sh b/.github/scripts/render-dhall-changes.sh new file mode 100755 index 0000000..f3e2f4f --- /dev/null +++ b/.github/scripts/render-dhall-changes.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail + +for file in .github/workflows/*.dhall; do + nix shell nixpkgs#dhall-yaml -c dhall-to-yaml-ng --file "$file" >"${file%.dhall}.yml" +done diff --git a/.github/workflows/renovate-post.dhall b/.github/workflows/renovate-post.dhall new file mode 100644 index 0000000..3302a57 --- /dev/null +++ b/.github/workflows/renovate-post.dhall @@ -0,0 +1,48 @@ +let GithubActions = + https://github.com/regadas/github-actions-dhall/raw/master/package.dhall + sha256:9c1ae46a1d56f1c22dbc9006cbb3e569806e75d02fded38fa102935b34980395 + +let permissions = + Some + [ { mapKey = GithubActions.types.Permission.contents + , mapValue = GithubActions.types.PermissionAccess.write + } + ] + +let steps = + [ GithubActions.Step::{ uses = Some "actions/checkout@v4" } + , GithubActions.Step::{ + , uses = Some "DeterminateSystems/nix-installer-action@v11" + } + , GithubActions.Step::{ + , run = Some ../scripts/render-dhall-changes.sh as Text + } + , GithubActions.Step::{ + , uses = Some "EndBug/add-and-commit@v9.1.4" + , `with` = Some + ( toMap + { message = "Render Dhall changes" + , author_name = "renovate[bot]" + , author_email = + "<29139614+renovate[bot]@users.noreply.github.com>" + } + ) + } + ] + +let render_dhall_changes = + GithubActions.Job::{ + , name = Some "Render Dhall changes" + , runs-on = GithubActions.RunsOn.Type.ubuntu-latest + , `if` = Some "\${{github.actor == 'renovate[bot]'}}" + , permissions + , steps + } + +in GithubActions.Workflow::{ + , name = "renovate-post" + , on = GithubActions.On::{ + , push = Some GithubActions.Push::{ branches = Some [ "renovate/*" ] } + } + , jobs = toMap { render_dhall_changes } + } diff --git a/.github/workflows/renovate-post.yml b/.github/workflows/renovate-post.yml new file mode 100644 index 0000000..5ed4aa8 --- /dev/null +++ b/.github/workflows/renovate-post.yml @@ -0,0 +1,27 @@ +jobs: + render_dhall_changes: + if: "${{github.actor == 'renovate[bot]'}}" + name: Render Dhall changes + permissions: + contents: write + "runs-on": "ubuntu-latest" + steps: + - uses: "actions/checkout@v4" + - uses: "DeterminateSystems/nix-installer-action@v11" + - run: | + #!/usr/bin/env bash + set -euo pipefail + + for file in .github/workflows/*.dhall; do + nix shell nixpkgs#dhall-yaml -c dhall-to-yaml-ng --file "$file" >"${file%.dhall}.yml" + done + - uses: "EndBug/add-and-commit@v9.1.4" + with: + author_email: "<29139614+renovate[bot]@users.noreply.github.com>" + author_name: "renovate[bot]" + message: Render Dhall changes +name: "renovate-post" +'on': + push: + branches: + - "renovate/*"