From 4a911b26c6e7b196df1c97512ae5a257b8449e0a Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Sat, 4 Jan 2025 13:01:49 +0100 Subject: [PATCH] feat(npins-update): Make it run weekly, but per pin --- .forgejo/workflows/npins-update.yaml | 882 ++++++++++++++++++++++++++- workflows/npins-update.nix | 133 ++-- 2 files changed, 944 insertions(+), 71 deletions(-) diff --git a/.forgejo/workflows/npins-update.yaml b/.forgejo/workflows/npins-update.yaml index d95fdff..79ffaa9 100644 --- a/.forgejo/workflows/npins-update.yaml +++ b/.forgejo/workflows/npins-update.yaml @@ -1,5 +1,10 @@ +env: + GIT_AUTHOR_EMAIL: chores@mail.hubrecht.ovh + GIT_AUTHOR_NAME: HT Chores + GIT_COMMITTER_EMAIL: chores@mail.hubrecht.ovh + GIT_COMMITTER_NAME: HT Chores jobs: - npins_update: + agenix: runs-on: nix steps: - uses: actions/checkout@v3 @@ -7,22 +12,863 @@ jobs: fetch-depth: 0 token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} - env: - GIT_AUTHOR_EMAIL: tech@dgnum.eu - GIT_AUTHOR_NAME: DGNum Chores - GIT_COMMITTER_EMAIL: tech@dgnum.eu - GIT_COMMITTER_NAME: DGNum Chores - name: Update dependencies and open PR if necessary - run: "npins update\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n echo - \"[+] Changes detected, pushing updates.\"\n\n git switch -C npins-update\n\ - \n git add npins\n\n git commit --message \"chore(npins): Update\"\n git - push --set-upstream origin npins-update --force\n\n # Connect to the server - with the cli\n tea login add \\\n -n dgnum-chores \\\n -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN - }}\" \\\n -u https://git.dgnum.eu\n\n # Create a pull request if needed\n\ - \ # i.e. no PR with the same title exists\n if [ -z \"$(tea pr ls -f='title,author' - -o simple | grep 'chore(npins): Update dgnum-chores')\" ]; then\n tea pr - create \\\n --description \"Automatic npins update\" \\\n --title - \"chore(npins): Update\" \\\n --head npins-update\n fi\nfi\n" -name: npins update + COMMIT_MESSAGE: 'chore(npins): Update agenix' + GIT_UPDATE_BRANCH: npins-updates/agenix + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update agenix\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + arkheon: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update arkheon' + GIT_UPDATE_BRANCH: npins-updates/arkheon + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update arkheon\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + cas-eleves: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update cas-eleves' + GIT_UPDATE_BRANCH: npins-updates/cas-eleves + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update cas-eleves\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + cgroup-exporter: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update cgroup-exporter' + GIT_UPDATE_BRANCH: npins-updates/cgroup-exporter + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update cgroup-exporter\n\nif [ ! -z \"$(git diff --name-only)\" + ]; then\n echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\ + \n if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + colmena: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update colmena' + GIT_UPDATE_BRANCH: npins-updates/colmena + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update colmena\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + dgsi: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update dgsi' + GIT_UPDATE_BRANCH: npins-updates/dgsi + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update dgsi\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n \ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n \ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + disko: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update disko' + GIT_UPDATE_BRANCH: npins-updates/disko + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update disko\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + dns_nix: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update dns.nix' + GIT_UPDATE_BRANCH: npins-updates/dns.nix + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update dns.nix\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + git-hooks: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update git-hooks' + GIT_UPDATE_BRANCH: npins-updates/git-hooks + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update git-hooks\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + kadenios: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update kadenios' + GIT_UPDATE_BRANCH: npins-updates/kadenios + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update kadenios\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + kahulm: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update kahulm' + GIT_UPDATE_BRANCH: npins-updates/kahulm + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update kahulm\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + liminix: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update liminix' + GIT_UPDATE_BRANCH: npins-updates/liminix + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update liminix\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + linkal: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update linkal' + GIT_UPDATE_BRANCH: npins-updates/linkal + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update linkal\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + lix: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update lix' + GIT_UPDATE_BRANCH: npins-updates/lix + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update lix\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n echo + \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n if [ \"\ + $EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n \ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + lix-module: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update lix-module' + GIT_UPDATE_BRANCH: npins-updates/lix-module + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update lix-module\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + lon: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update lon' + GIT_UPDATE_BRANCH: npins-updates/lon + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update lon\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n echo + \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n if [ \"\ + $EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n \ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + metis: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update metis' + GIT_UPDATE_BRANCH: npins-updates/metis + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update metis\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + microvm_nix: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update microvm.nix' + GIT_UPDATE_BRANCH: npins-updates/microvm.nix + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update microvm.nix\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + nix-actions: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update nix-actions' + GIT_UPDATE_BRANCH: npins-updates/nix-actions + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update nix-actions\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + nix-modules: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update nix-modules' + GIT_UPDATE_BRANCH: npins-updates/nix-modules + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update nix-modules\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + nix-patches: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update nix-patches' + GIT_UPDATE_BRANCH: npins-updates/nix-patches + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update nix-patches\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + nix-pkgs: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update nix-pkgs' + GIT_UPDATE_BRANCH: npins-updates/nix-pkgs + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update nix-pkgs\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + nix-reuse: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update nix-reuse' + GIT_UPDATE_BRANCH: npins-updates/nix-reuse + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update nix-reuse\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + nixos-24_05: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update nixos-24.05' + GIT_UPDATE_BRANCH: npins-updates/nixos-24.05 + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update nixos-24.05\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + nixos-24_11: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update nixos-24.11' + GIT_UPDATE_BRANCH: npins-updates/nixos-24.11 + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update nixos-24.11\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + nixos-generators: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update nixos-generators' + GIT_UPDATE_BRANCH: npins-updates/nixos-generators + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update nixos-generators\n\nif [ ! -z \"$(git diff --name-only)\"\ + \ ]; then\n echo \"[+] Changes detected, pushing updates.\"\n\n git add + npins\n\n if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend + --no-edit\n git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + nixos-unstable: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update nixos-unstable' + GIT_UPDATE_BRANCH: npins-updates/nixos-unstable + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update nixos-unstable\n\nif [ ! -z \"$(git diff --name-only)\" ]; + then\n echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\ + \n if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + nixpkgs: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update nixpkgs' + GIT_UPDATE_BRANCH: npins-updates/nixpkgs + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update nixpkgs\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + proxmox-nixos: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update proxmox-nixos' + GIT_UPDATE_BRANCH: npins-updates/proxmox-nixos + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update proxmox-nixos\n\nif [ ! -z \"$(git diff --name-only)\" ]; + then\n echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\ + \n if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + signal-irc-bridge: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update signal-irc-bridge' + GIT_UPDATE_BRANCH: npins-updates/signal-irc-bridge + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update signal-irc-bridge\n\nif [ ! -z \"$(git diff --name-only)\"\ + \ ]; then\n echo \"[+] Changes detected, pushing updates.\"\n\n git add + npins\n\n if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend + --no-edit\n git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + stateless-uptime-kuma: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update stateless-uptime-kuma' + GIT_UPDATE_BRANCH: npins-updates/stateless-uptime-kuma + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update stateless-uptime-kuma\n\nif [ ! -z \"$(git diff --name-only)\"\ + \ ]; then\n echo \"[+] Changes detected, pushing updates.\"\n\n git add + npins\n\n if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend + --no-edit\n git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" + wp4nix: + runs-on: nix + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.TEA_DGNUM_CHORES_TOKEN }} + - env: + COMMIT_MESSAGE: 'chore(npins): Update wp4nix' + GIT_UPDATE_BRANCH: npins-updates/wp4nix + name: Switch to a new branch + run: "if git ls-remote --exit-code --heads origin \"refs/heads/$GIT_UPDATE_BRANCH\"\ + ; then\n git switch \"$GIT_UPDATE_BRANCH\"\n git rebase main\n echo \"\ + EXISTING_BRANCH=1\" >> $GITHUB_ENV\nelse\n git switch -C \"$GIT_UPDATE_BRANCH\"\ + \nfi\n" + - name: Open a PR if updates are present + run: "npins update wp4nix\n\nif [ ! -z \"$(git diff --name-only)\" ]; then\n\ + \ echo \"[+] Changes detected, pushing updates.\"\n\n git add npins\n\n\ + \ if [ \"$EXISTING_BRANCH\" -eq \"1\" ]; then\n git commit --amend --no-edit\n\ + \ git push --force\n else\n git commit --message \"$COMMIT_MESSAGE\"\ + \n git push -u origin \"$GIT_UPDATE_BRANCH\"\n fi\n\n # Connect to the + server with the cli\n tea login add -n dgnum-chores -t \"${{ secrets.TEA_DGNUM_CHORES_TOKEN + }}\" -u https://git.dgnum.eu\n\n # Create a pull request if needed\n # i.e. + no PR with the same title exists\n if [ -z $(tea pr ls -f='title,author' + -o simple | grep \"$COMMIT_MESSAGE dgnum-chores\") ]; then\n tea pr create + --description \"Automatic npins update\" --title \"$COMMIT_MESSAGE\" --head + \"$GIT_UPDATE_BRANCH\"\n fi\nfi\n" +name: Update dependencies on: schedule: - - cron: 25 15 * * * + - cron: 25 15 * * 6 diff --git a/workflows/npins-update.nix b/workflows/npins-update.nix index 773f92e..e41c33f 100644 --- a/workflows/npins-update.nix +++ b/workflows/npins-update.nix @@ -2,63 +2,90 @@ # # SPDX-License-Identifier: EUPL-1.2 -{ nix-actions, ... }: +{ lib, nix-actions, ... }: + +let + inherit (nix-actions.lib) secret; + + inherit (lib) genAttrs mapAttrs' nameValuePair; + + dependencies = builtins.attrNames (import ../npins); +in { - name = "npins update"; + name = "Update dependencies"; on.schedule = [ - # Run at 15:25 everyday - { cron = "25 15 * * *"; } + # Run at 15:25 every saturday + { cron = "25 15 * * 6"; } ]; - jobs.npins_update = { - runs-on = "nix"; - steps = [ - (nix-actions.steps.checkout { - fetch-depth = 0; - token = nix-actions.lib.secret "TEA_DGNUM_CHORES_TOKEN"; - }) - - { - name = "Update dependencies and open PR if necessary"; - run = # bash - '' - npins update - - if [ ! -z "$(git diff --name-only)" ]; then - echo "[+] Changes detected, pushing updates." - - git switch -C npins-update - - git add npins - - git commit --message "chore(npins): Update" - git push --set-upstream origin npins-update --force - - # Connect to the server with the cli - tea login add \ - -n dgnum-chores \ - -t "${nix-actions.lib.secret "TEA_DGNUM_CHORES_TOKEN"}" \ - -u https://git.dgnum.eu - - # Create a pull request if needed - # i.e. no PR with the same title exists - if [ -z "$(tea pr ls -f='title,author' -o simple | grep 'chore(npins): Update dgnum-chores')" ]; then - tea pr create \ - --description "Automatic npins update" \ - --title "chore(npins): Update" \ - --head npins-update - fi - fi - ''; - - env = { - GIT_AUTHOR_NAME = "DGNum Chores"; - GIT_AUTHOR_EMAIL = "tech@dgnum.eu"; - GIT_COMMITTER_NAME = "DGNum Chores"; - GIT_COMMITTER_EMAIL = "tech@dgnum.eu"; - }; - } - ]; + # Global environment, necessary for rebases and commits + env = rec { + GIT_AUTHOR_NAME = "HT Chores"; + GIT_AUTHOR_EMAIL = "chores@mail.hubrecht.ovh"; + GIT_COMMITTER_NAME = GIT_AUTHOR_NAME; + GIT_COMMITTER_EMAIL = GIT_AUTHOR_EMAIL; }; + + jobs = mapAttrs' (name: nameValuePair (builtins.replaceStrings [ "." ] [ "_" ] name)) ( + genAttrs dependencies (name: { + runs-on = "nix"; + steps = [ + (nix-actions.steps.checkout { + fetch-depth = 0; + token = secret "TEA_DGNUM_CHORES_TOKEN"; + }) + + { + env = { + GIT_UPDATE_BRANCH = "npins-updates/${name}"; + COMMIT_MESSAGE = "chore(npins): Update ${name}"; + }; + + name = "Switch to a new branch"; + run = # bash + '' + if git ls-remote --exit-code --heads origin "refs/heads/$GIT_UPDATE_BRANCH"; then + git switch "$GIT_UPDATE_BRANCH" + git rebase main + echo "EXISTING_BRANCH=1" >> $GITHUB_ENV + else + git switch -C "$GIT_UPDATE_BRANCH" + fi + ''; + } + + { + name = "Open a PR if updates are present"; + run = # bash + '' + npins update ${name} + + if [ ! -z "$(git diff --name-only)" ]; then + echo "[+] Changes detected, pushing updates." + + git add npins + + if [ "$EXISTING_BRANCH" -eq "1" ]; then + git commit --amend --no-edit + git push --force + else + git commit --message "$COMMIT_MESSAGE" + git push -u origin "$GIT_UPDATE_BRANCH" + fi + + # Connect to the server with the cli + tea login add -n dgnum-chores -t "${secret "TEA_DGNUM_CHORES_TOKEN"}" -u https://git.dgnum.eu + + # Create a pull request if needed + # i.e. no PR with the same title exists + if [ -z $(tea pr ls -f='title,author' -o simple | grep "$COMMIT_MESSAGE dgnum-chores") ]; then + tea pr create --description "Automatic npins update" --title "$COMMIT_MESSAGE" --head "$GIT_UPDATE_BRANCH" + fi + fi + ''; + } + ]; + }) + ); }