From 2a8770ebca681c93fe0ab6d17fc78864b3d846c4 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 18:10:38 -0400 Subject: [PATCH 01/36] Updated flake.lock dependencies and versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ“ flake.lock: β€’ Added hyprland-protocols as a new dependency for hyprland β€’ Removed hyprwayland-scanner from hyprland dependencies β€’ Updated the lastModified and rev fields for hyprland β€’ Changed the details for hyprland-protocols with new lastModified, narHash and rev fields β€’ Completely removed hyprwayland-scanner block β€’ Added a new dependency wlroots with all its corresponding information β€’ Updated the hyprland-protocols inputs and fields for xdph Signed-off-by: use-the-fork --- flake.lock | 65 +++++++++++++++++++++++++----------------------------- 1 file changed, 30 insertions(+), 35 deletions(-) diff --git a/flake.lock b/flake.lock index 9e2f1b1..43b8ec7 100644 --- a/flake.lock +++ b/flake.lock @@ -409,24 +409,26 @@ "hyprland": { "inputs": { "hyprcursor": "hyprcursor", + "hyprland-protocols": "hyprland-protocols", "hyprlang": "hyprlang_2", - "hyprwayland-scanner": "hyprwayland-scanner", "nixpkgs": [ "nixpkgs" ], "systems": "systems_4", + "wlroots": "wlroots", "xdph": "xdph" }, "locked": { - "lastModified": 1715381814, - "narHash": "sha256-Jg5mkbH1dKrgS9witE0Bdh+xQMC4SSr6rm0FbaydyS4=", + "lastModified": 1713283263, + "narHash": "sha256-Urb/njWiHYUudXpmK8EKl9Z58esTIG0PxXw5LuM2r5g=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "ed3a888fc274e09a5097ebbe3d206e4bc85bbb87", + "rev": "fe7b748eb668136dd0558b7c8279bfcd7ab4d759", "type": "github" }, "original": { "owner": "hyprwm", + "ref": "v0.39.1", "repo": "Hyprland", "type": "github" } @@ -480,21 +482,19 @@ "inputs": { "nixpkgs": [ "hyprland", - "xdph", "nixpkgs" ], "systems": [ "hyprland", - "xdph", "systems" ] }, "locked": { - "lastModified": 1691753796, - "narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=", + "lastModified": 1714869498, + "narHash": "sha256-vbLVOWvQqo4n1yvkg/Q70VTlPbMmTiCQfNTgcWDCfJM=", "owner": "hyprwm", "repo": "hyprland-protocols", - "rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03", + "rev": "e06482e0e611130cd1929f75e8c1cf679e57d161", "type": "github" }, "original": { @@ -682,31 +682,6 @@ "type": "github" } }, - "hyprwayland-scanner": { - "inputs": { - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, - "locked": { - "lastModified": 1715287423, - "narHash": "sha256-B7AJIjOyWgVMKhu7DlOnWa0VprdhywUVHuB/j+EwSxM=", - "owner": "hyprwm", - "repo": "hyprwayland-scanner", - "rev": "e2fc1c0eb8b392110588f478cce644348ead7271", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprwayland-scanner", - "type": "github" - } - }, "impermanence": { "locked": { "lastModified": 1708968331, @@ -1379,6 +1354,23 @@ "type": "github" } }, + "wlroots": { + "flake": false, + "locked": { + "lastModified": 1713124002, + "narHash": "sha256-vPeZCY+sdiGsz4fl3AVVujfyZyQBz6+vZdkUE4hQ+HI=", + "owner": "hyprwm", + "repo": "wlroots-hyprland", + "rev": "611a4f24cd2384378f6e500253983107c6656c64", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "wlroots-hyprland", + "rev": "611a4f24cd2384378f6e500253983107c6656c64", + "type": "github" + } + }, "xdg-portal-hyprland": { "inputs": { "hyprland-protocols": "hyprland-protocols_2", @@ -1404,7 +1396,10 @@ }, "xdph": { "inputs": { - "hyprland-protocols": "hyprland-protocols", + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], "hyprlang": [ "hyprland", "hyprlang" From 750f2ea2d85a324c883454d58cfd678fad820e7a Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 18:10:55 -0400 Subject: [PATCH 02/36] Added "upstream" command for selective pushing changes and "commitUpstream" script in shells configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ“ `shells/default/commands.nix`: β€’ Introduced a new "upstream" command to allow users to selectively push changes to the upstream repository, with explicit handling for branch creation, selective commits and reverting back to the original branch. πŸ“ `shells/default/default.nix`: β€’ Added a new script "commitUpstream" that mirrors the functionality of the "upstream" command, allowing users to create a new branch and selectively commit changes to the remote repository. Signed-off-by: use-the-fork --- shells/default/commands.nix | 47 +++++++++++++++++++++++++++++++++++++ shells/default/default.nix | 44 ++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) diff --git a/shells/default/commands.nix b/shells/default/commands.nix index 3baae99..e72bd54 100644 --- a/shells/default/commands.nix +++ b/shells/default/commands.nix @@ -60,6 +60,53 @@ command = "git push"; category = "source control"; } + { + help = "Push changes to upstream"; + name = "upstream"; + command = '' + + # Save the name of the current branch + current_branch=$(git rev-parse --abbrev-ref HEAD) + + # Prompt user for the new branch name + read -p "Enter the new branch name: " new_branch + + # Check if the new branch name is provided + if [[ -z "$new_branch" ]]; then + echo "No branch name provided. Exiting." + exit 1 + fi + + # Create and switch to the new branch + git checkout -b "$new_branch" + + # Reset this new branch to the state of the original forked repo + # Replace 'upstream/master' with the appropriate branch from the forked repo + git reset --hard upstream/master + + # Get all commits from the current branch except changes in 'systems' and 'homes' folders + commit_ids=$(git log $current_branch --not --grep='systems/' --grep='homes/' --pretty=format:"%H") + + # Apply each commit selectively, ignoring changes in 'systems' and 'homes' directories + for commit_id in $commit_ids; do + git cherry-pick --no-commit $commit_id + git reset HEAD + git add -u + git add $(git status --porcelain | grep -v 'systems/' | grep -v 'homes/' | awk '{print $2}') + git commit -m "Cherry-picked $commit_id" + done + + # Push the new branch to the remote repository + git push origin "$new_branch" + + # Switch back to the original branch + git checkout "$current_branch" + + echo "Selected changes committed to branch $new_branch, pushed to remote, and returned to $current_branch." + + ''; + category = "source control"; + } { help = "Update flake inputs and commit changes"; name = "update"; diff --git a/shells/default/default.nix b/shells/default/default.nix index 171e752..c011658 100644 --- a/shells/default/default.nix +++ b/shells/default/default.nix @@ -15,6 +15,50 @@ }; }; +# commitUpstream = pkgs.writeShellScript "commit-upstream" '' +# #!/bin/bash +# +# # Save the name of the current branch +# current_branch=$(git rev-parse --abbrev-ref HEAD) +# +# # Prompt user for the new branch name +# read -p "Enter the new branch name: " new_branch +# +# # Check if the new branch name is provided +# if [[ -z "$new_branch" ]]; then +# echo "No branch name provided. Exiting." +# exit 1 +# fi +# +# # Create and switch to the new branch +# git checkout -b "$new_branch" +# +# # Reset this new branch to the state of the original forked repo +# # Replace 'upstream/master' with the appropriate branch from the forked repo +# git reset --hard upstream/master +# +# # Get all commits from the current branch except changes in 'systems' and 'homes' folders +# commit_ids=$(git log $current_branch --not --grep='systems/' --grep='homes/' --pretty=format:"%H") +# +# # Apply each commit selectively, ignoring changes in 'systems' and 'homes' directories +# for commit_id in $commit_ids; do +# git cherry-pick --no-commit $commit_id +# git reset HEAD +# git add -u +# git add $(git status --porcelain | grep -v 'systems/' | grep -v 'homes/' | awk '{print $2}') +# git commit -m "Cherry-picked $commit_id" +# done +# +# # Push the new branch to the remote repository +# git push origin "$new_branch" +# +# # Switch back to the original branch +# git checkout "$current_branch" +# +# echo "Selected changes committed to branch $new_branch, pushed to remote, and returned to $current_branch." +# +# ''; + extra = import ./commands.nix; in inputs.devshell.legacyPackages."${system}".mkShell { From 706320bcc6ce3fac4363b98dbe74ddb80f0da17e Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 18:12:54 -0400 Subject: [PATCH 03/36] Added new modules and configurations for sushi workstation setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ“ - style.nix: β€’ Added new file with config for GTK and QT themes, icons, and font β€’ Set style to use Kvantum and force GTK πŸ“ - device.nix: β€’ Added new file defining device characteristics for a laptop with AMD CPU and GPU πŸ“ - disko.nix: β€’ Created new file for setting up file systems and partitions with specific mountpoints and options πŸ“ - modules.nix: β€’ Created new file to enable iso, headless, graphical, workstation and laptop modules πŸ“ - profiles.nix: β€’ Created new file to enable workstation profile πŸ“ - system.nix: β€’ Added new file defining main system settings, including boot, security, networking, services, and program configs πŸ“ - usrEnv.nix: β€’ Added new file setting user environment to Hyprland and enabling swaylock πŸ“ - default.nix: β€’ Created new file to import all modules, set up home-manager and define host name πŸ“ - hardware-configuration.nix: β€’ Created new file with generated configurations for hardware Signed-off-by: use-the-fork --- systems/x86_64-linux/sushi/default.nix | 20 +++++ systems/x86_64-linux/sushi/fs/disko.nix | 82 +++++++++++++++++++ .../sushi/hardware-configuration.nix | 46 +++++++++++ systems/x86_64-linux/sushi/modules/device.nix | 11 +++ .../x86_64-linux/sushi/modules/modules.nix | 9 ++ .../x86_64-linux/sushi/modules/profiles.nix | 5 ++ systems/x86_64-linux/sushi/modules/style.nix | 49 +++++++++++ systems/x86_64-linux/sushi/modules/system.nix | 64 +++++++++++++++ systems/x86_64-linux/sushi/modules/usrEnv.nix | 11 +++ 9 files changed, 297 insertions(+) create mode 100644 systems/x86_64-linux/sushi/default.nix create mode 100644 systems/x86_64-linux/sushi/fs/disko.nix create mode 100644 systems/x86_64-linux/sushi/hardware-configuration.nix create mode 100644 systems/x86_64-linux/sushi/modules/device.nix create mode 100644 systems/x86_64-linux/sushi/modules/modules.nix create mode 100644 systems/x86_64-linux/sushi/modules/profiles.nix create mode 100644 systems/x86_64-linux/sushi/modules/style.nix create mode 100644 systems/x86_64-linux/sushi/modules/system.nix create mode 100644 systems/x86_64-linux/sushi/modules/usrEnv.nix diff --git a/systems/x86_64-linux/sushi/default.nix b/systems/x86_64-linux/sushi/default.nix new file mode 100644 index 0000000..0d9298d --- /dev/null +++ b/systems/x86_64-linux/sushi/default.nix @@ -0,0 +1,20 @@ +{...}: { + imports = [ + ./modules/device.nix + ./modules/profiles.nix + ./modules/system.nix + ./modules/modules.nix + ./modules/usrEnv.nix + ./modules/style.nix + ./fs/disko.nix + ./hardware-configuration.nix + ]; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.sincore = {}; + }; + + networking.hostName = "sushi"; # Define your hostname. +} diff --git a/systems/x86_64-linux/sushi/fs/disko.nix b/systems/x86_64-linux/sushi/fs/disko.nix new file mode 100644 index 0000000..dfc53a7 --- /dev/null +++ b/systems/x86_64-linux/sushi/fs/disko.nix @@ -0,0 +1,82 @@ +{ + # required by impermanence + fileSystems."/persistent".neededForBoot = true; + # fileSystems."/var/log".neededForBoot = true; + + disko.devices = { + disk.main = { + type = "disk"; + # When using disko-install, we will overwrite this value from the commandline + device = "/dev/nvme0n1"; # The device to partition + content = { + type = "gpt"; + partitions = { + # The EFI & Boot partition + ESP = { + size = "630M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ + "defaults" + ]; + }; + }; + # The root partition + luks = { + size = "100%"; + content = { + type = "luks"; + name = "encrypted"; + settings = { + allowDiscards = true; + }; + # Whether to add a boot.initrd.luks.devices entry for the specified disk. + initrdUnlock = true; + content = { + type = "btrfs"; + extraArgs = ["-f"]; # Force override existing partition + subvolumes = { + # mount the top-level subvolume at /btr_pool + # it will be used by btrbk to create snapshots + "@" = { + mountpoint = "/"; + # we can access all other subvolumes from this subvolume. + mountOptions = ["defaults" "compress=zstd:1" "ssd" "noatime" "nodiratime"]; + }; + + "@home" = { + mountpoint = "/home"; + mountOptions = ["defaults" "compress=zstd:1" "ssd" "noatime" "nodiratime"]; + }; + + "@nix" = { + mountpoint = "/nix"; + mountOptions = ["defaults" "compress=zstd:1" "ssd" "noatime" "nodiratime"]; + }; + + "@persistent" = { + mountpoint = "/persistent"; + mountOptions = ["defaults" "compress=zstd:1" "ssd" "noatime" "nodiratime"]; + }; + + # "@log" = { + # mountpoint = "/var/log"; + # mountOptions = ["defaults" "compress=zstd:1" "ssd" "noatime" "nodiratime"]; + # }; + + "@swap" = { + mountpoint = "/.swap"; + mountOptions = ["defaults" "x-mount.mkdir" "ssd" "noatime" "nodiratime"]; + }; + }; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/systems/x86_64-linux/sushi/hardware-configuration.nix b/systems/x86_64-linux/sushi/hardware-configuration.nix new file mode 100644 index 0000000..cc93ec8 --- /dev/null +++ b/systems/x86_64-linux/sushi/hardware-configuration.nix @@ -0,0 +1,46 @@ +# Do not modify this file! It was generated by β€˜nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ + config, + lib, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + # boot = { + # initrd = { + # availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod"]; + # kernelModules = []; + # }; + # kernelModules = ["kvm-amd"]; + # extraModulePackages = []; + # }; + + # fileSystems."/" = { + # device = "/dev/disk/by-uuid/e63a0375-6fdd-4f66-b720-73ccf75f2eda"; + # fsType = "ext4"; + # }; + # + # fileSystems."/boot" = { + # device = "/dev/disk/by-uuid/B8D5-F178"; + # fsType = "vfat"; + # }; + # + # swapDevices = [ + # {device = "/dev/disk/by-uuid/e9caf6ca-eaf8-4632-8fed-497ac209124f";} + # ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/systems/x86_64-linux/sushi/modules/device.nix b/systems/x86_64-linux/sushi/modules/device.nix new file mode 100644 index 0000000..f969fe2 --- /dev/null +++ b/systems/x86_64-linux/sushi/modules/device.nix @@ -0,0 +1,11 @@ +{ + my.device = { + type = "laptop"; + cpu.type = "amd"; + gpu.type = "amd"; + monitors = ["eDP-1"]; + hasBluetooth = false; + hasSound = true; + hasTPM = true; + }; +} diff --git a/systems/x86_64-linux/sushi/modules/modules.nix b/systems/x86_64-linux/sushi/modules/modules.nix new file mode 100644 index 0000000..42010a9 --- /dev/null +++ b/systems/x86_64-linux/sushi/modules/modules.nix @@ -0,0 +1,9 @@ +{ + my.modules = { + iso = false; + headless = false; + graphical = true; + workstation = true; + laptop = true; + }; +} diff --git a/systems/x86_64-linux/sushi/modules/profiles.nix b/systems/x86_64-linux/sushi/modules/profiles.nix new file mode 100644 index 0000000..4eb04ab --- /dev/null +++ b/systems/x86_64-linux/sushi/modules/profiles.nix @@ -0,0 +1,5 @@ +{ + my.profiles = { + workstation.enable = true; + }; +} diff --git a/systems/x86_64-linux/sushi/modules/style.nix b/systems/x86_64-linux/sushi/modules/style.nix new file mode 100644 index 0000000..90526c7 --- /dev/null +++ b/systems/x86_64-linux/sushi/modules/style.nix @@ -0,0 +1,49 @@ +{ + config, + pkgs, + ... +}: { + my.style = { + forceGtk = true; + useKvantum = true; + + gtk = { + usePortal = true; + theme = { + name = "Catppuccin-Mocha-Standard-Blue-Dark"; + package = pkgs.catppuccin-gtk.override { + size = "standard"; + accents = ["blue"]; + variant = "mocha"; + tweaks = ["normal"]; + }; + }; + + iconTheme = { + name = "Papirus-Dark"; + package = pkgs.catppuccin-papirus-folders.override { + accent = "blue"; + flavor = "mocha"; + }; + }; + + font = { + name = "Lexend"; + size = 12; + }; + }; + + qt = { + theme = { + name = "Catppuccin-Mocha-Dark"; + package = pkgs.catppuccin-kde.override { + flavour = ["mocha"]; + accents = ["blue"]; + winDecStyles = ["modern"]; + }; + }; + + kdeglobals.source = "${config.my.style.qt.theme.package}" + "/share/color-schemes/CatppuccinMochaBlue.colors"; + }; + }; +} diff --git a/systems/x86_64-linux/sushi/modules/system.nix b/systems/x86_64-linux/sushi/modules/system.nix new file mode 100644 index 0000000..4abbd4b --- /dev/null +++ b/systems/x86_64-linux/sushi/modules/system.nix @@ -0,0 +1,64 @@ +{ + my.system = { + mainUser = "sincore"; + fs = ["btrfs" "ext4" "vfat" "ntfs"]; + impermanence.root.enable = true; + autoLogin = true; + + boot = { + loader = "systemd-boot"; + enableKernelTweaks = true; + initrd.enableTweaks = true; + loadRecommendedModules = true; + tmpOnTmpfs = true; + }; + + video.enable = true; + sound.enable = true; + bluetooth.enable = false; + printing.enable = true; + printing."3d".enable = true; + + networking = { + tailscale = { + enable = true; + autoConnect = true; + }; + }; + + security = { + fprint.enable = true; + }; + + virtualization = { + enable = true; + docker.enable = true; + qemu.enable = false; + podman.enable = false; + }; + + services = { + flatpak = { + enable = false; + packages = [ + "flathub:app/com.nordpass.NordPass//stable" + ]; + }; + }; + + programs = { + cli.enable = true; + gui.enable = true; + dev.enable = true; + + google-chrome.enable = true; + signal-desktop.enable = true; + nordpass.enable = true; + gimp.enable = true; + + default = { + terminal = "kitty"; + }; + }; + }; +} diff --git a/systems/x86_64-linux/sushi/modules/usrEnv.nix b/systems/x86_64-linux/sushi/modules/usrEnv.nix new file mode 100644 index 0000000..af0be76 --- /dev/null +++ b/systems/x86_64-linux/sushi/modules/usrEnv.nix @@ -0,0 +1,11 @@ +{ + my.usrEnv = { + desktop = "Hyprland"; + wayland = { + statusBar = { + waybar.enable = true; + }; + }; + programs.screenlock.swaylock.enable = true; + }; +} From 97e6ed563abe1960897fdd7c4c8c780948c638eb Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 18:24:27 -0400 Subject: [PATCH 04/36] Added new Github workflow for automatic PR creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ“ [.github/workflows/create_pr.yml]: β€’ Created a new Github action workflow file: 'create_pr.yml' β€’ Configured it to trigger on every push to 'main' branch. β€’ Workflow checks code out, sets up git config, and adds upstream remote. β€’ It creates new branch for PR, resets files in 'systems' and 'homes', and commits changes. β€’ Workflow push changes to GitHub and creates a pull request to the upstream repository with modifications excluding 'systems' and 'homes' directories. Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/create_pr.yml diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml new file mode 100644 index 0000000..c77b065 --- /dev/null +++ b/.github/workflows/create_pr.yml @@ -0,0 +1,56 @@ +name: Create Pull Request to Upstream + +on: + push: + branches: + - main + +jobs: + create-pull-request: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup Git Config + run: | + git config --global user.name "${{ github.actor }}" + git config --global user.email "${{ github.actor }}@users.noreply.github.com" + + - name: Add Upstream Remote + run: | + git remote add upstream https://github.com/Spacebar-Cowboys/nyx.git + git fetch upstream + + - name: Create New Branch for PR + run: | + git checkout -b pr-upstream-${{ github.run_id }} + + - name: Reset Files in 'systems' and 'homes' + run: | + git checkout upstream/main -- . + git reset HEAD systems/ homes/ + git checkout -- systems/ homes/ + + - name: Commit Changes + run: | + git add . + git commit -m "Filtered changes for PR to upstream" + + - name: Push to GitHub + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: pr-upstream-${{ github.run_id }} + + - name: Create Pull Request + uses: repo-sync/pull-request@v2 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + destination_branch: "main" + source_branch: pr-upstream-${{ github.run_id }} + pr_title: "Automated PR from Use-The-Fork" + pr_body: "Automated PR to merge changes excluding 'systems' and 'homes' directories." From 5001007ed2f2c3d4d428bc6bd072aa7b49534738 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 18:35:49 -0400 Subject: [PATCH 05/36] Updated GitHub workflow to enforce PR creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ”§ - .github/workflows/create_pr.yml: β€’ Enabled 'force' option for branch creation in Github workflow β€’ Ensured PR creation even if conflicts exist Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index c77b065..3fb90d3 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -45,6 +45,7 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: pr-upstream-${{ github.run_id }} + force: true - name: Create Pull Request uses: repo-sync/pull-request@v2 From 895570df7e52d0e12dc6d7cdb1ea52a99b0a60ee Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 18:41:48 -0400 Subject: [PATCH 06/36] Updated GitHub Actions Workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ”§ - .github/workflows/create_pr.yml: β€’ Swapped GITHUB_TOKEN with MY_PERSONAL_TOKEN for the 'Push to GitHub' and 'Create Pull Request' actions β€’ Removed 'force: true' option in 'Push to GitHub' action β€’ Changed the 'pr_title' to reflect the actor of the PR in 'Create Pull Request' action Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index 3fb90d3..a16b757 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -43,15 +43,14 @@ jobs: - name: Push to GitHub uses: ad-m/github-push-action@master with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.MY_PERSONAL_TOKEN }} branch: pr-upstream-${{ github.run_id }} - force: true - name: Create Pull Request uses: repo-sync/pull-request@v2 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.MY_PERSONAL_TOKEN }} destination_branch: "main" source_branch: pr-upstream-${{ github.run_id }} - pr_title: "Automated PR from Use-The-Fork" + pr_title: "Automated PR from ${{ github.actor }}" pr_body: "Automated PR to merge changes excluding 'systems' and 'homes' directories." From c8acf586f45059bac1b37846dc44892f91f27de3 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 18:45:24 -0400 Subject: [PATCH 07/36] Updated GitHub Actions Workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactored actions in create_pr.yml to ensure correct filtering of commits. πŸ”§ [.github/workflows/create_pr.yml]: β€’ Replaced 'checkout' and 'reset' commands with 'restore' for resetting files in 'systems' and 'homes' β€’ Added 'reset' command to explicitly remove systems and homes from the staging area during Commit Changes β€’ Changed the PR title format to a fixed string "Automated PR from Use-The-Fork" instead of using the github.actor variable Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index a16b757..58a07de 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -31,14 +31,14 @@ jobs: - name: Reset Files in 'systems' and 'homes' run: | - git checkout upstream/main -- . - git reset HEAD systems/ homes/ - git checkout -- systems/ homes/ + git restore --source upstream/main --staged --worktree -- systems/ homes/ - name: Commit Changes run: | git add . + git reset -- systems/ homes/ # Explicitly remove systems and homes from the staging area git commit -m "Filtered changes for PR to upstream" + # This ensures that no changes from systems or homes are included - name: Push to GitHub uses: ad-m/github-push-action@master @@ -52,5 +52,5 @@ jobs: github_token: ${{ secrets.MY_PERSONAL_TOKEN }} destination_branch: "main" source_branch: pr-upstream-${{ github.run_id }} - pr_title: "Automated PR from ${{ github.actor }}" + pr_title: "Automated PR from Use-The-Fork" pr_body: "Automated PR to merge changes excluding 'systems' and 'homes' directories." From bb02e3da2b05072fb6221b7ac182d73ce328942c Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 18:47:05 -0400 Subject: [PATCH 08/36] Removed the "upstream" command from default commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ“‚ - default/commands.nix: β€’ Removed "Push changes to upstream" function and its related command execution instructions, involved in actions like branch creation, reset, commit picking, and pushing to the repository. Signed-off-by: use-the-fork --- shells/default/commands.nix | 47 ------------------------------------- 1 file changed, 47 deletions(-) diff --git a/shells/default/commands.nix b/shells/default/commands.nix index e72bd54..3baae99 100644 --- a/shells/default/commands.nix +++ b/shells/default/commands.nix @@ -60,53 +60,6 @@ command = "git push"; category = "source control"; } - { - help = "Push changes to upstream"; - name = "upstream"; - command = '' - - # Save the name of the current branch - current_branch=$(git rev-parse --abbrev-ref HEAD) - - # Prompt user for the new branch name - read -p "Enter the new branch name: " new_branch - - # Check if the new branch name is provided - if [[ -z "$new_branch" ]]; then - echo "No branch name provided. Exiting." - exit 1 - fi - - # Create and switch to the new branch - git checkout -b "$new_branch" - - # Reset this new branch to the state of the original forked repo - # Replace 'upstream/master' with the appropriate branch from the forked repo - git reset --hard upstream/master - - # Get all commits from the current branch except changes in 'systems' and 'homes' folders - commit_ids=$(git log $current_branch --not --grep='systems/' --grep='homes/' --pretty=format:"%H") - - # Apply each commit selectively, ignoring changes in 'systems' and 'homes' directories - for commit_id in $commit_ids; do - git cherry-pick --no-commit $commit_id - git reset HEAD - git add -u - git add $(git status --porcelain | grep -v 'systems/' | grep -v 'homes/' | awk '{print $2}') - git commit -m "Cherry-picked $commit_id" - done - - # Push the new branch to the remote repository - git push origin "$new_branch" - - # Switch back to the original branch - git checkout "$current_branch" - - echo "Selected changes committed to branch $new_branch, pushed to remote, and returned to $current_branch." - - ''; - category = "source control"; - } { help = "Update flake inputs and commit changes"; name = "update"; From b78314bc75cde5cd80abf4eddaa6a4d0f12f5184 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 18:51:58 -0400 Subject: [PATCH 09/36] Refactored GitHub Actions Workflow for PR Creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🧾 [.github/workflows/create_pr.yml]: β€’ Renamed 'Reset Files in 'systems' and 'homes'' step to 'Restore Deleted Files in 'systems' and 'homes'' and added functionality to restore Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index 58a07de..20bad62 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -29,16 +29,19 @@ jobs: run: | git checkout -b pr-upstream-${{ github.run_id }} - - name: Reset Files in 'systems' and 'homes' + - name: Restore Deleted Files in 'systems' and 'homes' + run: | + git ls-files --deleted | grep -E "^(systems/|homes/)" | xargs -r git checkout HEAD -- + + - name: Reset and Restore 'systems' and 'homes' run: | git restore --source upstream/main --staged --worktree -- systems/ homes/ - name: Commit Changes run: | git add . - git reset -- systems/ homes/ # Explicitly remove systems and homes from the staging area + git reset -- systems/ homes/ # Ensure no changes in systems or homes are staged git commit -m "Filtered changes for PR to upstream" - # This ensures that no changes from systems or homes are included - name: Push to GitHub uses: ad-m/github-push-action@master From 37c4d17c8737c0b9c3483176a3fae7e68346c0a5 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 18:54:31 -0400 Subject: [PATCH 10/36] Refactored GitHub workflow for 'create_pr.yml' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [πŸ”§ - .github/workflows/create_pr.yml]: β€’ Renamed task 'Restore Deleted Files in 'systems' and 'homes' to 'Exclude 'systems' and 'homes' Directories' β€’ Combined the tasks 'Restore Deleted Files in 'systems' and 'homes'' and 'Reset and Restore 'systems' and 'homes'' into one single command β€’ Modified command to exclude 'systems' and 'homes' directories from being staged β€’ Ensured no changes in 'systems' or 'homes' directories are staged in commit process Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index 20bad62..6ad49c7 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -29,18 +29,15 @@ jobs: run: | git checkout -b pr-upstream-${{ github.run_id }} - - name: Restore Deleted Files in 'systems' and 'homes' + - name: Exclude 'systems' and 'homes' Directories run: | - git ls-files --deleted | grep -E "^(systems/|homes/)" | xargs -r git checkout HEAD -- - - - name: Reset and Restore 'systems' and 'homes' - run: | - git restore --source upstream/main --staged --worktree -- systems/ homes/ + git ls-files --deleted 'systems/' 'homes/' | xargs -r git rm --cached + git restore --source=upstream/main --staged --worktree -- 'systems/' 'homes/' - name: Commit Changes run: | git add . - git reset -- systems/ homes/ # Ensure no changes in systems or homes are staged + git reset -- 'systems/' 'homes/' # Ensure no changes in systems or homes are staged git commit -m "Filtered changes for PR to upstream" - name: Push to GitHub From 642e1b56f79d8e9d52399a87aa72c292928c2da7 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 18:56:58 -0400 Subject: [PATCH 11/36] Refactored create_pr.yml Github Workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [🧰 - .github/workflows/create_pr.yml]: β€’ Replaced procedure to exclude 'systems' and 'homes' directories with 'git filter-branch' β€’ Simplified commit command, added handling for no changes scenarios β€’ Removed redundant git add, git reset commands Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index 6ad49c7..7aa2246 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -29,16 +29,13 @@ jobs: run: | git checkout -b pr-upstream-${{ github.run_id }} - - name: Exclude 'systems' and 'homes' Directories + - name: Exclude 'systems' and 'homes' Directories Using Filter Branch run: | - git ls-files --deleted 'systems/' 'homes/' | xargs -r git rm --cached - git restore --source=upstream/main --staged --worktree -- 'systems/' 'homes/' + git filter-branch --tree-filter 'rm -rf systems/ homes/' HEAD - name: Commit Changes run: | - git add . - git reset -- 'systems/' 'homes/' # Ensure no changes in systems or homes are staged - git commit -m "Filtered changes for PR to upstream" + git commit -am "Filtered changes for PR to upstream" || echo "No changes to commit" - name: Push to GitHub uses: ad-m/github-push-action@master From 067f77ecb3fbc0a377452bf2c06a7a551be2dab0 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 18:59:34 -0400 Subject: [PATCH 12/36] Refactored GitHub Actions Workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [πŸ”§ - .github/workflows/create_pr.yml]: β€’ Changed action step 'Create New Branch for PR' to 'Checkout New Branch' and updated the command to checkout from the upstream/main branch β€’ Replaced 'Exclude 'systems' and 'homes' Directories Using Filter Branch' step with 'Cherry-pick Commits Excluding Certain Directories' and amended the corresponding code to cherry-pick commits and remove specified directories β€’ The git commit command in 'Commit Changes' step is updated to use -m option instead of -am. Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index 7aa2246..4eaefb0 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -25,17 +25,21 @@ jobs: git remote add upstream https://github.com/Spacebar-Cowboys/nyx.git git fetch upstream - - name: Create New Branch for PR + - name: Checkout New Branch run: | - git checkout -b pr-upstream-${{ github.run_id }} + git checkout -b pr-upstream-${{ github.run_id }} upstream/main - - name: Exclude 'systems' and 'homes' Directories Using Filter Branch + - name: Cherry-pick Commits Excluding Certain Directories run: | - git filter-branch --tree-filter 'rm -rf systems/ homes/' HEAD + git log --format="%H" upstream/main..origin/main | while read commit_hash; do + git cherry-pick $commit_hash + git rm -r --cached systems/ homes/ || true + git commit --amend --no-edit + done - name: Commit Changes run: | - git commit -am "Filtered changes for PR to upstream" || echo "No changes to commit" + git commit -m "Filtered changes for PR to upstream" || echo "No changes to commit" - name: Push to GitHub uses: ad-m/github-push-action@master From 75813de86962963c5ee2f444748089b6ef4c9aaf Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:02:22 -0400 Subject: [PATCH 13/36] Updated cherry-picking process in create_pr.yml workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ“‘ - .github/workflows/create_pr.yml: β€’ Adjusted commit cherry-picking to handle conflicts β€’ Implemented removal of conflicted workflow files to resolve conflicts β€’ Continued exclusion of 'systems/' and 'homes/' directories β€’ Integrated commit amendment in the process to finalize conflict resolution. Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index 4eaefb0..ca38dc8 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -32,8 +32,11 @@ jobs: - name: Cherry-pick Commits Excluding Certain Directories run: | git log --format="%H" upstream/main..origin/main | while read commit_hash; do - git cherry-pick $commit_hash - git rm -r --cached systems/ homes/ || true + if ! git cherry-pick $commit_hash; then + git rm --cached -r .github/workflows/* || true # Remove conflicted workflow files + git commit --amend --no-edit # Amend the commit to resolve conflicts + fi + git rm -r --cached systems/ homes/ || true # Exclude directories git commit --amend --no-edit done From 3cada059d4e9935ff293f3406ad4641600b4cbb9 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:06:31 -0400 Subject: [PATCH 14/36] Refactor the 'create_pr.yml' GitHub Action workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ”§ - .github/workflows/create_pr.yml: β€’ Renamed action from "Create Pull Request to Upstream" to "Sync to Upstream" β€’ Consolidated various Git Steps into a single 'Create temporary branch' step β€’ Removed unnecessary action code to resolve conflicts and simplify workflow β€’ Changed values within the 'Push temporary branch' and 'Create Pull Request' steps to improve branch handling and PR creation β€’ Deleted 'systems' and 'homes' directories in the temp-branch in the 'Create temporary branch' step Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 55 ++++++++++----------------------- 1 file changed, 16 insertions(+), 39 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index ca38dc8..8ea0a40 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -1,4 +1,4 @@ -name: Create Pull Request to Upstream +name: Sync to Upstream on: push: @@ -8,53 +8,30 @@ on: jobs: create-pull-request: runs-on: ubuntu-latest - steps: - - name: Checkout code + - name: Checkout the repo uses: actions/checkout@v2 with: - fetch-depth: 0 - - - name: Setup Git Config - run: | - git config --global user.name "${{ github.actor }}" - git config --global user.email "${{ github.actor }}@users.noreply.github.com" - - - name: Add Upstream Remote - run: | - git remote add upstream https://github.com/Spacebar-Cowboys/nyx.git - git fetch upstream - - - name: Checkout New Branch - run: | - git checkout -b pr-upstream-${{ github.run_id }} upstream/main - - - name: Cherry-pick Commits Excluding Certain Directories - run: | - git log --format="%H" upstream/main..origin/main | while read commit_hash; do - if ! git cherry-pick $commit_hash; then - git rm --cached -r .github/workflows/* || true # Remove conflicted workflow files - git commit --amend --no-edit # Amend the commit to resolve conflicts - fi - git rm -r --cached systems/ homes/ || true # Exclude directories - git commit --amend --no-edit - done + fetch-depth: 0 # Ensures all branches are fetched - - name: Commit Changes + - name: Create temporary branch run: | - git commit -m "Filtered changes for PR to upstream" || echo "No changes to commit" + git checkout -b temp-branch + git rm -r --cached systems homes + git commit -m "Remove changes in systems and homes directories" - - name: Push to GitHub + - name: Push temporary branch uses: ad-m/github-push-action@master with: - github_token: ${{ secrets.MY_PERSONAL_TOKEN }} - branch: pr-upstream-${{ github.run_id }} + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: temp-branch - name: Create Pull Request uses: repo-sync/pull-request@v2 with: - github_token: ${{ secrets.MY_PERSONAL_TOKEN }} - destination_branch: "main" - source_branch: pr-upstream-${{ github.run_id }} - pr_title: "Automated PR from Use-The-Fork" - pr_body: "Automated PR to merge changes excluding 'systems' and 'homes' directories." + github_token: ${{ secrets.GITHUB_TOKEN }} + destination_repo_url: https://github.com/Spacebar-Cowboys/nyx + destination_branch: main + pr_title: "Update from Fork" + pr_body: "This is an automated PR to sync changes excluding specific folders." + pr_label: "automated-pr" From fdeefc1d1e953c8bd968ea65152b9e9bbd1a0e26 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:10:06 -0400 Subject: [PATCH 15/36] Refactored GitHub workflow to sync fork with upstream excluding specific directories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [πŸ”§ - .github/workflows/create_pr.yml]: β€’ Changed workflow name to 'Sync Fork with Upstream' β€’ Replaced 'actions/checkout@v2' with 'actions/checkout@v3' for checking out the repository β€’ Added Git setup commands to set up the GitHub actor as the Git user name and email β€’ Detailed the steps to exclude specific directories during forking process β€’ Switched to in-line scripts for running necessary Git commands (creating temporary branch, fetching original, merging changes, committing changes, pushing changes) instead of using GitHub actions β€’ Renamed 'Create Pull Request' step and updated pull request details (title, body, destination branch, source branch) to align with the new syncing mechanism Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 58 ++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index 8ea0a40..cf47cce 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -1,4 +1,4 @@ -name: Sync to Upstream +name: Sync Fork with Upstream on: push: @@ -6,32 +6,52 @@ on: - main jobs: - create-pull-request: + sync: runs-on: ubuntu-latest steps: - - name: Checkout the repo - uses: actions/checkout@v2 + # Setup Git and GitHub CLI + - name: Checkout repository + uses: actions/checkout@v3 with: - fetch-depth: 0 # Ensures all branches are fetched + fetch-depth: 0 # Ensure we get all commits for proper diffing - - name: Create temporary branch + - name: Setup Git run: | - git checkout -b temp-branch - git rm -r --cached systems homes - git commit -m "Remove changes in systems and homes directories" + git config --global user.name "${{ github.actor }}" + git config --global user.email "${{ github.actor }}@users.noreply.github.com" - - name: Push temporary branch - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: temp-branch + # Sync fork excluding specified directories + - name: Create temporary branch for PR + run: | + git checkout -b temp-pr-branch + + - name: Fetch original + run: | + git remote add upstream https://github.com/Spacebar-Cowboys/nyx.git + git fetch upstream + + - name: Merge changes excluding specific directories + run: | + git checkout main + git restore --source upstream/main --staged --worktree -- . + git reset HEAD systems/x86_64-linux/ homes/ + git checkout HEAD systems/x86_64-linux/ homes/ + + - name: Commit changes + run: | + git add . + git commit -m "Syncing changes with upstream excluding specific directories" + + - name: Push changes to GitHub + run: | + git push origin temp-pr-branch + # Create Pull Request using GitHub CLI - name: Create Pull Request uses: repo-sync/pull-request@v2 with: github_token: ${{ secrets.GITHUB_TOKEN }} - destination_repo_url: https://github.com/Spacebar-Cowboys/nyx - destination_branch: main - pr_title: "Update from Fork" - pr_body: "This is an automated PR to sync changes excluding specific folders." - pr_label: "automated-pr" + pr_title: "Update from upstream" + pr_body: "Merged changes from the original repository excluding 'systems/x86_64-linux' and 'homes' directories." + destination_branch: "main" + source_branch: "temp-pr-branch" From 684ad417f8a9c1e1f7bd565f7046cf23f0afdd24 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:15:47 -0400 Subject: [PATCH 16/36] Updated GitHub Actions for PR Creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [πŸ“ - .github/workflows/create_pr.yml]: β€’ Replaced GITHUB_TOKEN with MY_PERSONAL_TOKEN in Create Pull Request step Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index cf47cce..a74938c 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -50,7 +50,7 @@ jobs: - name: Create Pull Request uses: repo-sync/pull-request@v2 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.MY_PERSONAL_TOKEN }} pr_title: "Update from upstream" pr_body: "Merged changes from the original repository excluding 'systems/x86_64-linux' and 'homes' directories." destination_branch: "main" From 5784d9a3b0c7be61a1394c59cabc45ebbd9cb823 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:18:22 -0400 Subject: [PATCH 17/36] Updated GitHub Actions workflow for creating pull requests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [πŸ”§ - .github/workflows/create_pr.yml]: β€’ Changed the authentication token used to create a Pull Request from a personal token to the GitHub token β€’ Added the destination repository parameter to explicitly point to the original repository Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index a74938c..c95b8ac 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -50,8 +50,9 @@ jobs: - name: Create Pull Request uses: repo-sync/pull-request@v2 with: - github_token: ${{ secrets.MY_PERSONAL_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} pr_title: "Update from upstream" pr_body: "Merged changes from the original repository excluding 'systems/x86_64-linux' and 'homes' directories." destination_branch: "main" source_branch: "temp-pr-branch" + destination_repository: "Spacebar-Cowboys/nyx" # Point to the original repository From be0e7a1a816d33f03fbf80c6ee019f15d50a52c6 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:18:54 -0400 Subject: [PATCH 18/36] Update GitHub action to use personal access token MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [πŸ”§ - .github/workflows/create_pr.yml]: β€’ Replaced GITHUB_TOKEN with MY_PERSONAL_TOKEN in create_pr.yml Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index c95b8ac..80b7e93 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -50,7 +50,7 @@ jobs: - name: Create Pull Request uses: repo-sync/pull-request@v2 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.MY_PERSONAL_TOKEN }} pr_title: "Update from upstream" pr_body: "Merged changes from the original repository excluding 'systems/x86_64-linux' and 'homes' directories." destination_branch: "main" From 74068b5461226750001373ccb7a2ab8b74782679 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:22:03 -0400 Subject: [PATCH 19/36] Updated PR creation settings in GitHub Actions workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [πŸ”§ - .github/workflows/create_pr.yml]: β€’ Revised GitHub token comment for clarity on necessary permissions β€’ Updated source_branch to specify fork's username or organization and branch β€’ Maintained the pointer for destination_repository to the Spacebar-Cowboys/nyx repository Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index 80b7e93..175ed00 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -50,9 +50,10 @@ jobs: - name: Create Pull Request uses: repo-sync/pull-request@v2 with: - github_token: ${{ secrets.MY_PERSONAL_TOKEN }} + github_token: ${{ secrets.MY_PERSONAL_TOKEN }} # Make sure this token has the necessary permissions pr_title: "Update from upstream" pr_body: "Merged changes from the original repository excluding 'systems/x86_64-linux' and 'homes' directories." destination_branch: "main" - source_branch: "temp-pr-branch" - destination_repository: "Spacebar-Cowboys/nyx" # Point to the original repository + source_branch: "use-the-fork:temp-pr-branch" # Specify your fork's username or organization and branch + destination_repository: "Spacebar-Cowboys/nyx" + From 1176eb46c9ba0945e1039ceb98d8f8ece25b612d Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:24:59 -0400 Subject: [PATCH 20/36] Update create_pr GitHub Action Workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ”§ [.github/workflows/create_pr.yml] β€’ Removed comment from "github_token" configuration - no need to mention permissions here. β€’ Simplified "source_branch" definition, removing explicit username for clarity. β€’ Added a new configuration option "source_repository" to define origin for the action. Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index 175ed00..e345966 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -50,10 +50,11 @@ jobs: - name: Create Pull Request uses: repo-sync/pull-request@v2 with: - github_token: ${{ secrets.MY_PERSONAL_TOKEN }} # Make sure this token has the necessary permissions + github_token: ${{ secrets.MY_PERSONAL_TOKEN }} pr_title: "Update from upstream" pr_body: "Merged changes from the original repository excluding 'systems/x86_64-linux' and 'homes' directories." destination_branch: "main" - source_branch: "use-the-fork:temp-pr-branch" # Specify your fork's username or organization and branch + source_branch: "temp-pr-branch" destination_repository: "Spacebar-Cowboys/nyx" + source_repository: "use-the-fork/nyx" # Add this line if the action supports it From 6ea393adc4ce79832a9d3177db264d43f5015046 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:29:04 -0400 Subject: [PATCH 21/36] Updated GitHub workflow for syncing and creating PRs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ“ [.github/workflows/create_pr.yml]: β€’ Renamed workflow from "Sync Fork with Upstream" to "Sync Fork with Upstream and Create PR" β€’ Added permission for writing contents and pull-requests β€’ Changed job name from "sync" to "sync-and-pr" β€’ Removed old method of creating pull requests β€’ Integrated new method using GitHub CLI for creating or updating pull requests β€’ Replaced specific GIT command for push changes into GitHub with enhanced one β€’ Added environment variable for GitHub token in the new pull request method Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index e345966..09d9ce1 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -1,12 +1,16 @@ -name: Sync Fork with Upstream +name: Sync Fork with Upstream and Create PR on: push: branches: - main +permissions: + contents: write + pull-requests: write + jobs: - sync: + sync-and-pr: runs-on: ubuntu-latest steps: # Setup Git and GitHub CLI @@ -20,7 +24,6 @@ jobs: git config --global user.name "${{ github.actor }}" git config --global user.email "${{ github.actor }}@users.noreply.github.com" - # Sync fork excluding specified directories - name: Create temporary branch for PR run: | git checkout -b temp-pr-branch @@ -40,21 +43,19 @@ jobs: - name: Commit changes run: | git add . - git commit -m "Syncing changes with upstream excluding specific directories" + git commit -m "Syncing changes with upstream excluding specific directories" || echo "No changes to commit" - name: Push changes to GitHub run: | git push origin temp-pr-branch - # Create Pull Request using GitHub CLI - - name: Create Pull Request - uses: repo-sync/pull-request@v2 - with: - github_token: ${{ secrets.MY_PERSONAL_TOKEN }} - pr_title: "Update from upstream" - pr_body: "Merged changes from the original repository excluding 'systems/x86_64-linux' and 'homes' directories." - destination_branch: "main" - source_branch: "temp-pr-branch" - destination_repository: "Spacebar-Cowboys/nyx" - source_repository: "use-the-fork/nyx" # Add this line if the action supports it - + - name: Create or Update Pull Request + run: | + gh_pr_up() { gh pr create $* || gh pr edit $* } + gh_pr_up --title "Update from upstream" \ + --body "Merged changes from the original repository excluding 'systems/x86_64-linux' and 'homes' directories." \ + --head use-the-fork:temp-pr-branch \ + --base main \ + --repo Spacebar-Cowboys/nyx + env: + GITHUB_TOKEN: ${{ secrets.MY_PERSONAL_TOKEN }} From 789677aee7a385a9d1308f56c6d2f3be77685685 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:31:02 -0400 Subject: [PATCH 22/36] Refactor the create_pr.yml workflow in .github folder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ“ - .github/workflows/create_pr.yml: β€’ Removed comment about Git and GitHub CLI setup β€’ The 'git push' command has been updated to include --set-upstream β€’ Refactored the gh_pr_up function to improve clarity Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index 09d9ce1..383ed0d 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -13,11 +13,10 @@ jobs: sync-and-pr: runs-on: ubuntu-latest steps: - # Setup Git and GitHub CLI - name: Checkout repository uses: actions/checkout@v3 with: - fetch-depth: 0 # Ensure we get all commits for proper diffing + fetch-depth: 0 - name: Setup Git run: | @@ -47,11 +46,13 @@ jobs: - name: Push changes to GitHub run: | - git push origin temp-pr-branch + git push --set-upstream origin temp-pr-branch - name: Create or Update Pull Request run: | - gh_pr_up() { gh pr create $* || gh pr edit $* } + function gh_pr_up() { + gh pr create "$@" || gh pr edit "$@" + } gh_pr_up --title "Update from upstream" \ --body "Merged changes from the original repository excluding 'systems/x86_64-linux' and 'homes' directories." \ --head use-the-fork:temp-pr-branch \ From 89ae640036d312768cac20abf9048226e3135614 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:33:56 -0400 Subject: [PATCH 23/36] Updated .github/workflows/create_pr.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ“ - .github/workflows/create_pr.yml: β€’ Replaced "git reset HEAD" command with "git rm --cached -r" for systems/x86_64-linux/ and homes/ directories β€’ Maintained the "git checkout HEAD" command for systems/x86_64-linux/ and homes/ directories. Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index 383ed0d..a2a63ff 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -36,8 +36,8 @@ jobs: run: | git checkout main git restore --source upstream/main --staged --worktree -- . - git reset HEAD systems/x86_64-linux/ homes/ - git checkout HEAD systems/x86_64-linux/ homes/ + git rm --cached -r systems/x86_64-linux/ homes/ # Remove directories from tracking + git checkout HEAD systems/x86_64-linux/ homes/ # Restore your versions of the directories - name: Commit changes run: | From 65cbf4a5273565ff29a19550ebe13e9dabb6395b Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:36:23 -0400 Subject: [PATCH 24/36] Updated conditional directory exclusion in GitHub workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ”§ - .github/workflows/create_pr.yml: β€’ Introduced conditional checks for directory existence before executing removal in 'Exclude directories' step Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index a2a63ff..f89ee81 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -32,11 +32,16 @@ jobs: git remote add upstream https://github.com/Spacebar-Cowboys/nyx.git git fetch upstream - - name: Merge changes excluding specific directories + - name: Exclude directories run: | git checkout main git restore --source upstream/main --staged --worktree -- . - git rm --cached -r systems/x86_64-linux/ homes/ # Remove directories from tracking + if [ -d "systems/x86_64-linux" ]; then + git rm --cached -r systems/x86_64-linux/ + fi + if [ -d "homes" ]; then + git rm --cached -r homes/ + fi git checkout HEAD systems/x86_64-linux/ homes/ # Restore your versions of the directories - name: Commit changes From 4681c47624e507499775c82ac4c4cd872021e726 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:39:18 -0400 Subject: [PATCH 25/36] Refactored exclude directories and commit changes steps in .github/workflows/create_pr.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ“ - .github/workflows/create_pr.yml: β€’ Replaced 'Exclude directories' step with 'Merge changes excluding specific directories' β€’ Added command to explicitly exclude 'systems/x86_64-linux/' and 'homes/' directories from git add β€’ Ensured working tree doesn't track changes in these directories using git checkout β€’ Refactored 'Commit changes' step to provide feedback when there are no changes to commit β€’ Added echo statement to confirm successful commit when changes exist Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index f89ee81..1926cee 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -32,22 +32,25 @@ jobs: git remote add upstream https://github.com/Spacebar-Cowboys/nyx.git git fetch upstream - - name: Exclude directories + - name: Merge changes excluding specific directories run: | git checkout main git restore --source upstream/main --staged --worktree -- . - if [ -d "systems/x86_64-linux" ]; then - git rm --cached -r systems/x86_64-linux/ - fi - if [ -d "homes" ]; then - git rm --cached -r homes/ - fi - git checkout HEAD systems/x86_64-linux/ homes/ # Restore your versions of the directories + git add . + + # Explicitly exclude directories from being added to the commit + git reset systems/x86_64-linux/ homes/ + + # Ensure the working tree does not track changes in the excluded directories + git checkout -- systems/x86_64-linux/ homes/ - name: Commit changes run: | - git add . - git commit -m "Syncing changes with upstream excluding specific directories" || echo "No changes to commit" + if git commit -m "Syncing changes with upstream excluding specific directories"; then + echo "Changes committed." + else + echo "No changes to commit." + fi - name: Push changes to GitHub run: | From 55a6b684fbe88f3bf27cc14b1438c3961ab8853f Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:40:56 -0400 Subject: [PATCH 26/36] Updated Git Ignore Directories Workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [πŸ”§ - .github/workflows/create_pr.yml]: β€’ Reorganized the process of ignoring directories, changes are now checked if the directories exist prior to resetting and checking out β€’ Removed explicit exclusion of directories after adding all files, all checks are done in the new process β€’ Simplified workflow to ignore 'systems/x86_64-linux/' and 'homes/' directories from commits Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index 1926cee..d07e1d6 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -36,13 +36,17 @@ jobs: run: | git checkout main git restore --source upstream/main --staged --worktree -- . - git add . - - # Explicitly exclude directories from being added to the commit - git reset systems/x86_64-linux/ homes/ - # Ensure the working tree does not track changes in the excluded directories - git checkout -- systems/x86_64-linux/ homes/ + # Check if directories exist and if so, reset and checkout to ignore changes + if [ -d "systems/x86_64-linux" ]; then + git reset -- systems/x86_64-linux/ + git checkout -- systems/x86_64-linux/ + fi + if [ -d "homes" ]; then + git reset -- homes/ + git checkout -- homes/ + fi + git add . - name: Commit changes run: | From df9c7b2efd13932e692274bfdd6074151500e19a Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:43:30 -0400 Subject: [PATCH 27/36] Updated workflow to temporarily ignore certain directories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸͺ› - .github/workflows/create_pr.yml: β€’ Added commands to temporarily add "systems/x86_64-linux/" and "homes/" to .gitignore β€’ Removed manual checks and resets for these directories β€’ Ensured .gitignore itself is not committed Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index d07e1d6..5319455 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -32,21 +32,18 @@ jobs: git remote add upstream https://github.com/Spacebar-Cowboys/nyx.git git fetch upstream + - name: Temporarily ignore certain directories + run: | + echo "systems/x86_64-linux/" >> .gitignore + echo "homes/" >> .gitignore + git config --global core.excludesfile .gitignore + - name: Merge changes excluding specific directories run: | git checkout main git restore --source upstream/main --staged --worktree -- . - - # Check if directories exist and if so, reset and checkout to ignore changes - if [ -d "systems/x86_64-linux" ]; then - git reset -- systems/x86_64-linux/ - git checkout -- systems/x86_64-linux/ - fi - if [ -d "homes" ]; then - git reset -- homes/ - git checkout -- homes/ - fi git add . + git reset -- .gitignore # Make sure .gitignore itself is not committed - name: Commit changes run: | From 6de8944f990979b70a544901f441bb7b4c733d95 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:47:15 -0400 Subject: [PATCH 28/36] Updated .github workflows to create dynamic branches for PRs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [✏️ - .github/workflows/create_pr.yml]: β€’ Renamed "Create temporary branch for PR" flow to "Create dynamic branch for PR". β€’ Updated creation of branch from static 'temp-pr-branch' to dynamic branch name 'update-${{ github.run_id }}' β€’ Replaced the static branch name 'temp-pr-branch' with dynamic name '$BRANCH_NAME' in 'Push changes to GitHub' and 'Create or Update Pull Request' flows. Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index 5319455..6b27f99 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -23,9 +23,10 @@ jobs: git config --global user.name "${{ github.actor }}" git config --global user.email "${{ github.actor }}@users.noreply.github.com" - - name: Create temporary branch for PR + - name: Create dynamic branch for PR run: | - git checkout -b temp-pr-branch + BRANCH_NAME="update-${{ github.run_id }}" + git checkout -b $BRANCH_NAME - name: Fetch original run: | @@ -55,7 +56,7 @@ jobs: - name: Push changes to GitHub run: | - git push --set-upstream origin temp-pr-branch + git push --set-upstream origin $BRANCH_NAME - name: Create or Update Pull Request run: | @@ -64,7 +65,7 @@ jobs: } gh_pr_up --title "Update from upstream" \ --body "Merged changes from the original repository excluding 'systems/x86_64-linux' and 'homes' directories." \ - --head use-the-fork:temp-pr-branch \ + --head use-the-fork:$BRANCH_NAME \ --base main \ --repo Spacebar-Cowboys/nyx env: From d3b574325113010f68794cacadfd38de7d0b5f8b Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 23:47:27 +0000 Subject: [PATCH 29/36] Syncing changes with upstream excluding specific directories --- .github/workflows/create_pr.yml | 72 ---------------- flake.lock | 65 ++++++++------- shells/default/default.nix | 44 ---------- systems/x86_64-linux/sushi/default.nix | 20 ----- systems/x86_64-linux/sushi/fs/disko.nix | 82 ------------------- .../sushi/hardware-configuration.nix | 46 ----------- systems/x86_64-linux/sushi/modules/device.nix | 11 --- .../x86_64-linux/sushi/modules/modules.nix | 9 -- .../x86_64-linux/sushi/modules/profiles.nix | 5 -- systems/x86_64-linux/sushi/modules/style.nix | 49 ----------- systems/x86_64-linux/sushi/modules/system.nix | 64 --------------- systems/x86_64-linux/sushi/modules/usrEnv.nix | 11 --- 12 files changed, 35 insertions(+), 443 deletions(-) delete mode 100644 .github/workflows/create_pr.yml delete mode 100644 systems/x86_64-linux/sushi/default.nix delete mode 100644 systems/x86_64-linux/sushi/fs/disko.nix delete mode 100644 systems/x86_64-linux/sushi/hardware-configuration.nix delete mode 100644 systems/x86_64-linux/sushi/modules/device.nix delete mode 100644 systems/x86_64-linux/sushi/modules/modules.nix delete mode 100644 systems/x86_64-linux/sushi/modules/profiles.nix delete mode 100644 systems/x86_64-linux/sushi/modules/style.nix delete mode 100644 systems/x86_64-linux/sushi/modules/system.nix delete mode 100644 systems/x86_64-linux/sushi/modules/usrEnv.nix diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml deleted file mode 100644 index 6b27f99..0000000 --- a/.github/workflows/create_pr.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Sync Fork with Upstream and Create PR - -on: - push: - branches: - - main - -permissions: - contents: write - pull-requests: write - -jobs: - sync-and-pr: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Git - run: | - git config --global user.name "${{ github.actor }}" - git config --global user.email "${{ github.actor }}@users.noreply.github.com" - - - name: Create dynamic branch for PR - run: | - BRANCH_NAME="update-${{ github.run_id }}" - git checkout -b $BRANCH_NAME - - - name: Fetch original - run: | - git remote add upstream https://github.com/Spacebar-Cowboys/nyx.git - git fetch upstream - - - name: Temporarily ignore certain directories - run: | - echo "systems/x86_64-linux/" >> .gitignore - echo "homes/" >> .gitignore - git config --global core.excludesfile .gitignore - - - name: Merge changes excluding specific directories - run: | - git checkout main - git restore --source upstream/main --staged --worktree -- . - git add . - git reset -- .gitignore # Make sure .gitignore itself is not committed - - - name: Commit changes - run: | - if git commit -m "Syncing changes with upstream excluding specific directories"; then - echo "Changes committed." - else - echo "No changes to commit." - fi - - - name: Push changes to GitHub - run: | - git push --set-upstream origin $BRANCH_NAME - - - name: Create or Update Pull Request - run: | - function gh_pr_up() { - gh pr create "$@" || gh pr edit "$@" - } - gh_pr_up --title "Update from upstream" \ - --body "Merged changes from the original repository excluding 'systems/x86_64-linux' and 'homes' directories." \ - --head use-the-fork:$BRANCH_NAME \ - --base main \ - --repo Spacebar-Cowboys/nyx - env: - GITHUB_TOKEN: ${{ secrets.MY_PERSONAL_TOKEN }} diff --git a/flake.lock b/flake.lock index 43b8ec7..9e2f1b1 100644 --- a/flake.lock +++ b/flake.lock @@ -409,26 +409,24 @@ "hyprland": { "inputs": { "hyprcursor": "hyprcursor", - "hyprland-protocols": "hyprland-protocols", "hyprlang": "hyprlang_2", + "hyprwayland-scanner": "hyprwayland-scanner", "nixpkgs": [ "nixpkgs" ], "systems": "systems_4", - "wlroots": "wlroots", "xdph": "xdph" }, "locked": { - "lastModified": 1713283263, - "narHash": "sha256-Urb/njWiHYUudXpmK8EKl9Z58esTIG0PxXw5LuM2r5g=", + "lastModified": 1715381814, + "narHash": "sha256-Jg5mkbH1dKrgS9witE0Bdh+xQMC4SSr6rm0FbaydyS4=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "fe7b748eb668136dd0558b7c8279bfcd7ab4d759", + "rev": "ed3a888fc274e09a5097ebbe3d206e4bc85bbb87", "type": "github" }, "original": { "owner": "hyprwm", - "ref": "v0.39.1", "repo": "Hyprland", "type": "github" } @@ -482,19 +480,21 @@ "inputs": { "nixpkgs": [ "hyprland", + "xdph", "nixpkgs" ], "systems": [ "hyprland", + "xdph", "systems" ] }, "locked": { - "lastModified": 1714869498, - "narHash": "sha256-vbLVOWvQqo4n1yvkg/Q70VTlPbMmTiCQfNTgcWDCfJM=", + "lastModified": 1691753796, + "narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=", "owner": "hyprwm", "repo": "hyprland-protocols", - "rev": "e06482e0e611130cd1929f75e8c1cf679e57d161", + "rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03", "type": "github" }, "original": { @@ -682,6 +682,31 @@ "type": "github" } }, + "hyprwayland-scanner": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1715287423, + "narHash": "sha256-B7AJIjOyWgVMKhu7DlOnWa0VprdhywUVHuB/j+EwSxM=", + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "rev": "e2fc1c0eb8b392110588f478cce644348ead7271", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "type": "github" + } + }, "impermanence": { "locked": { "lastModified": 1708968331, @@ -1354,23 +1379,6 @@ "type": "github" } }, - "wlroots": { - "flake": false, - "locked": { - "lastModified": 1713124002, - "narHash": "sha256-vPeZCY+sdiGsz4fl3AVVujfyZyQBz6+vZdkUE4hQ+HI=", - "owner": "hyprwm", - "repo": "wlroots-hyprland", - "rev": "611a4f24cd2384378f6e500253983107c6656c64", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "wlroots-hyprland", - "rev": "611a4f24cd2384378f6e500253983107c6656c64", - "type": "github" - } - }, "xdg-portal-hyprland": { "inputs": { "hyprland-protocols": "hyprland-protocols_2", @@ -1396,10 +1404,7 @@ }, "xdph": { "inputs": { - "hyprland-protocols": [ - "hyprland", - "hyprland-protocols" - ], + "hyprland-protocols": "hyprland-protocols", "hyprlang": [ "hyprland", "hyprlang" diff --git a/shells/default/default.nix b/shells/default/default.nix index c011658..171e752 100644 --- a/shells/default/default.nix +++ b/shells/default/default.nix @@ -15,50 +15,6 @@ }; }; -# commitUpstream = pkgs.writeShellScript "commit-upstream" '' -# #!/bin/bash -# -# # Save the name of the current branch -# current_branch=$(git rev-parse --abbrev-ref HEAD) -# -# # Prompt user for the new branch name -# read -p "Enter the new branch name: " new_branch -# -# # Check if the new branch name is provided -# if [[ -z "$new_branch" ]]; then -# echo "No branch name provided. Exiting." -# exit 1 -# fi -# -# # Create and switch to the new branch -# git checkout -b "$new_branch" -# -# # Reset this new branch to the state of the original forked repo -# # Replace 'upstream/master' with the appropriate branch from the forked repo -# git reset --hard upstream/master -# -# # Get all commits from the current branch except changes in 'systems' and 'homes' folders -# commit_ids=$(git log $current_branch --not --grep='systems/' --grep='homes/' --pretty=format:"%H") -# -# # Apply each commit selectively, ignoring changes in 'systems' and 'homes' directories -# for commit_id in $commit_ids; do -# git cherry-pick --no-commit $commit_id -# git reset HEAD -# git add -u -# git add $(git status --porcelain | grep -v 'systems/' | grep -v 'homes/' | awk '{print $2}') -# git commit -m "Cherry-picked $commit_id" -# done -# -# # Push the new branch to the remote repository -# git push origin "$new_branch" -# -# # Switch back to the original branch -# git checkout "$current_branch" -# -# echo "Selected changes committed to branch $new_branch, pushed to remote, and returned to $current_branch." -# -# ''; - extra = import ./commands.nix; in inputs.devshell.legacyPackages."${system}".mkShell { diff --git a/systems/x86_64-linux/sushi/default.nix b/systems/x86_64-linux/sushi/default.nix deleted file mode 100644 index 0d9298d..0000000 --- a/systems/x86_64-linux/sushi/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{...}: { - imports = [ - ./modules/device.nix - ./modules/profiles.nix - ./modules/system.nix - ./modules/modules.nix - ./modules/usrEnv.nix - ./modules/style.nix - ./fs/disko.nix - ./hardware-configuration.nix - ]; - - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - users.sincore = {}; - }; - - networking.hostName = "sushi"; # Define your hostname. -} diff --git a/systems/x86_64-linux/sushi/fs/disko.nix b/systems/x86_64-linux/sushi/fs/disko.nix deleted file mode 100644 index dfc53a7..0000000 --- a/systems/x86_64-linux/sushi/fs/disko.nix +++ /dev/null @@ -1,82 +0,0 @@ -{ - # required by impermanence - fileSystems."/persistent".neededForBoot = true; - # fileSystems."/var/log".neededForBoot = true; - - disko.devices = { - disk.main = { - type = "disk"; - # When using disko-install, we will overwrite this value from the commandline - device = "/dev/nvme0n1"; # The device to partition - content = { - type = "gpt"; - partitions = { - # The EFI & Boot partition - ESP = { - size = "630M"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ - "defaults" - ]; - }; - }; - # The root partition - luks = { - size = "100%"; - content = { - type = "luks"; - name = "encrypted"; - settings = { - allowDiscards = true; - }; - # Whether to add a boot.initrd.luks.devices entry for the specified disk. - initrdUnlock = true; - content = { - type = "btrfs"; - extraArgs = ["-f"]; # Force override existing partition - subvolumes = { - # mount the top-level subvolume at /btr_pool - # it will be used by btrbk to create snapshots - "@" = { - mountpoint = "/"; - # we can access all other subvolumes from this subvolume. - mountOptions = ["defaults" "compress=zstd:1" "ssd" "noatime" "nodiratime"]; - }; - - "@home" = { - mountpoint = "/home"; - mountOptions = ["defaults" "compress=zstd:1" "ssd" "noatime" "nodiratime"]; - }; - - "@nix" = { - mountpoint = "/nix"; - mountOptions = ["defaults" "compress=zstd:1" "ssd" "noatime" "nodiratime"]; - }; - - "@persistent" = { - mountpoint = "/persistent"; - mountOptions = ["defaults" "compress=zstd:1" "ssd" "noatime" "nodiratime"]; - }; - - # "@log" = { - # mountpoint = "/var/log"; - # mountOptions = ["defaults" "compress=zstd:1" "ssd" "noatime" "nodiratime"]; - # }; - - "@swap" = { - mountpoint = "/.swap"; - mountOptions = ["defaults" "x-mount.mkdir" "ssd" "noatime" "nodiratime"]; - }; - }; - }; - }; - }; - }; - }; - }; - }; -} diff --git a/systems/x86_64-linux/sushi/hardware-configuration.nix b/systems/x86_64-linux/sushi/hardware-configuration.nix deleted file mode 100644 index cc93ec8..0000000 --- a/systems/x86_64-linux/sushi/hardware-configuration.nix +++ /dev/null @@ -1,46 +0,0 @@ -# Do not modify this file! It was generated by β€˜nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ - config, - lib, - modulesPath, - ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - # boot = { - # initrd = { - # availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod"]; - # kernelModules = []; - # }; - # kernelModules = ["kvm-amd"]; - # extraModulePackages = []; - # }; - - # fileSystems."/" = { - # device = "/dev/disk/by-uuid/e63a0375-6fdd-4f66-b720-73ccf75f2eda"; - # fsType = "ext4"; - # }; - # - # fileSystems."/boot" = { - # device = "/dev/disk/by-uuid/B8D5-F178"; - # fsType = "vfat"; - # }; - # - # swapDevices = [ - # {device = "/dev/disk/by-uuid/e9caf6ca-eaf8-4632-8fed-497ac209124f";} - # ]; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/systems/x86_64-linux/sushi/modules/device.nix b/systems/x86_64-linux/sushi/modules/device.nix deleted file mode 100644 index f969fe2..0000000 --- a/systems/x86_64-linux/sushi/modules/device.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - my.device = { - type = "laptop"; - cpu.type = "amd"; - gpu.type = "amd"; - monitors = ["eDP-1"]; - hasBluetooth = false; - hasSound = true; - hasTPM = true; - }; -} diff --git a/systems/x86_64-linux/sushi/modules/modules.nix b/systems/x86_64-linux/sushi/modules/modules.nix deleted file mode 100644 index 42010a9..0000000 --- a/systems/x86_64-linux/sushi/modules/modules.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ - my.modules = { - iso = false; - headless = false; - graphical = true; - workstation = true; - laptop = true; - }; -} diff --git a/systems/x86_64-linux/sushi/modules/profiles.nix b/systems/x86_64-linux/sushi/modules/profiles.nix deleted file mode 100644 index 4eb04ab..0000000 --- a/systems/x86_64-linux/sushi/modules/profiles.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - my.profiles = { - workstation.enable = true; - }; -} diff --git a/systems/x86_64-linux/sushi/modules/style.nix b/systems/x86_64-linux/sushi/modules/style.nix deleted file mode 100644 index 90526c7..0000000 --- a/systems/x86_64-linux/sushi/modules/style.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ - config, - pkgs, - ... -}: { - my.style = { - forceGtk = true; - useKvantum = true; - - gtk = { - usePortal = true; - theme = { - name = "Catppuccin-Mocha-Standard-Blue-Dark"; - package = pkgs.catppuccin-gtk.override { - size = "standard"; - accents = ["blue"]; - variant = "mocha"; - tweaks = ["normal"]; - }; - }; - - iconTheme = { - name = "Papirus-Dark"; - package = pkgs.catppuccin-papirus-folders.override { - accent = "blue"; - flavor = "mocha"; - }; - }; - - font = { - name = "Lexend"; - size = 12; - }; - }; - - qt = { - theme = { - name = "Catppuccin-Mocha-Dark"; - package = pkgs.catppuccin-kde.override { - flavour = ["mocha"]; - accents = ["blue"]; - winDecStyles = ["modern"]; - }; - }; - - kdeglobals.source = "${config.my.style.qt.theme.package}" + "/share/color-schemes/CatppuccinMochaBlue.colors"; - }; - }; -} diff --git a/systems/x86_64-linux/sushi/modules/system.nix b/systems/x86_64-linux/sushi/modules/system.nix deleted file mode 100644 index 4abbd4b..0000000 --- a/systems/x86_64-linux/sushi/modules/system.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ - my.system = { - mainUser = "sincore"; - fs = ["btrfs" "ext4" "vfat" "ntfs"]; - impermanence.root.enable = true; - autoLogin = true; - - boot = { - loader = "systemd-boot"; - enableKernelTweaks = true; - initrd.enableTweaks = true; - loadRecommendedModules = true; - tmpOnTmpfs = true; - }; - - video.enable = true; - sound.enable = true; - bluetooth.enable = false; - printing.enable = true; - printing."3d".enable = true; - - networking = { - tailscale = { - enable = true; - autoConnect = true; - }; - }; - - security = { - fprint.enable = true; - }; - - virtualization = { - enable = true; - docker.enable = true; - qemu.enable = false; - podman.enable = false; - }; - - services = { - flatpak = { - enable = false; - packages = [ - "flathub:app/com.nordpass.NordPass//stable" - ]; - }; - }; - - programs = { - cli.enable = true; - gui.enable = true; - dev.enable = true; - - google-chrome.enable = true; - signal-desktop.enable = true; - nordpass.enable = true; - gimp.enable = true; - - default = { - terminal = "kitty"; - }; - }; - }; -} diff --git a/systems/x86_64-linux/sushi/modules/usrEnv.nix b/systems/x86_64-linux/sushi/modules/usrEnv.nix deleted file mode 100644 index af0be76..0000000 --- a/systems/x86_64-linux/sushi/modules/usrEnv.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - my.usrEnv = { - desktop = "Hyprland"; - wayland = { - statusBar = { - waybar.enable = true; - }; - }; - programs.screenlock.swaylock.enable = true; - }; -} From 8080279e4a0b87ea4c1faf1a4d2262013210729e Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:49:07 -0400 Subject: [PATCH 30/36] Updated automated PR creation in GitHub workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ”§ - .github/workflows/create_pr.yml: β€’ Refactored gh_pr_up function to correctly use branch and repo syntax β€’ Added handling for PR creation failure with PR edit and automated-pr labeling β€’ Modified how the title and body of the PR are set β€’ Changed branch name reference to use "github.actor" variable β€’ Included fallback method to edit PR and add "automated-pr" label β€’ Ensured GITHUB_TOKEN is using "MY_PERSONAL_TOKEN" from secrets. Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index 6b27f99..a884dd8 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -61,12 +61,16 @@ jobs: - name: Create or Update Pull Request run: | function gh_pr_up() { - gh pr create "$@" || gh pr edit "$@" + # Ensure correct usage of the branch and repo syntax + gh pr create --title "Update from upstream" \ + --body "Merged changes from the original repository excluding 'systems/x86_64-linux' and 'homes' directories." \ + --head "${{ github.actor }}:$BRANCH_NAME" \ + --base main \ + --repo Spacebar-Cowboys/nyx \ + --fill || gh pr edit --add-label "automated-pr" \ + --title "Update from upstream" \ + --body "Automated PR to merge changes excluding specified directories." } - gh_pr_up --title "Update from upstream" \ - --body "Merged changes from the original repository excluding 'systems/x86_64-linux' and 'homes' directories." \ - --head use-the-fork:$BRANCH_NAME \ - --base main \ - --repo Spacebar-Cowboys/nyx + gh_pr_up env: GITHUB_TOKEN: ${{ secrets.MY_PERSONAL_TOKEN }} From 5903351831ce28e3c75165743fb4fc8e13c04608 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 23:49:40 +0000 Subject: [PATCH 31/36] Syncing changes with upstream excluding specific directories --- .github/workflows/create_pr.yml | 76 --------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 .github/workflows/create_pr.yml diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml deleted file mode 100644 index a884dd8..0000000 --- a/.github/workflows/create_pr.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Sync Fork with Upstream and Create PR - -on: - push: - branches: - - main - -permissions: - contents: write - pull-requests: write - -jobs: - sync-and-pr: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Git - run: | - git config --global user.name "${{ github.actor }}" - git config --global user.email "${{ github.actor }}@users.noreply.github.com" - - - name: Create dynamic branch for PR - run: | - BRANCH_NAME="update-${{ github.run_id }}" - git checkout -b $BRANCH_NAME - - - name: Fetch original - run: | - git remote add upstream https://github.com/Spacebar-Cowboys/nyx.git - git fetch upstream - - - name: Temporarily ignore certain directories - run: | - echo "systems/x86_64-linux/" >> .gitignore - echo "homes/" >> .gitignore - git config --global core.excludesfile .gitignore - - - name: Merge changes excluding specific directories - run: | - git checkout main - git restore --source upstream/main --staged --worktree -- . - git add . - git reset -- .gitignore # Make sure .gitignore itself is not committed - - - name: Commit changes - run: | - if git commit -m "Syncing changes with upstream excluding specific directories"; then - echo "Changes committed." - else - echo "No changes to commit." - fi - - - name: Push changes to GitHub - run: | - git push --set-upstream origin $BRANCH_NAME - - - name: Create or Update Pull Request - run: | - function gh_pr_up() { - # Ensure correct usage of the branch and repo syntax - gh pr create --title "Update from upstream" \ - --body "Merged changes from the original repository excluding 'systems/x86_64-linux' and 'homes' directories." \ - --head "${{ github.actor }}:$BRANCH_NAME" \ - --base main \ - --repo Spacebar-Cowboys/nyx \ - --fill || gh pr edit --add-label "automated-pr" \ - --title "Update from upstream" \ - --body "Automated PR to merge changes excluding specified directories." - } - gh_pr_up - env: - GITHUB_TOKEN: ${{ secrets.MY_PERSONAL_TOKEN }} From 1dc07c663ca0df56f39434d5696ffc2389c19d7d Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:51:19 -0400 Subject: [PATCH 32/36] Added a new workflow for automatic syncing with the upstream repository and PR creation [ Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 76 +++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/create_pr.yml diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml new file mode 100644 index 0000000..a884dd8 --- /dev/null +++ b/.github/workflows/create_pr.yml @@ -0,0 +1,76 @@ +name: Sync Fork with Upstream and Create PR + +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +jobs: + sync-and-pr: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Git + run: | + git config --global user.name "${{ github.actor }}" + git config --global user.email "${{ github.actor }}@users.noreply.github.com" + + - name: Create dynamic branch for PR + run: | + BRANCH_NAME="update-${{ github.run_id }}" + git checkout -b $BRANCH_NAME + + - name: Fetch original + run: | + git remote add upstream https://github.com/Spacebar-Cowboys/nyx.git + git fetch upstream + + - name: Temporarily ignore certain directories + run: | + echo "systems/x86_64-linux/" >> .gitignore + echo "homes/" >> .gitignore + git config --global core.excludesfile .gitignore + + - name: Merge changes excluding specific directories + run: | + git checkout main + git restore --source upstream/main --staged --worktree -- . + git add . + git reset -- .gitignore # Make sure .gitignore itself is not committed + + - name: Commit changes + run: | + if git commit -m "Syncing changes with upstream excluding specific directories"; then + echo "Changes committed." + else + echo "No changes to commit." + fi + + - name: Push changes to GitHub + run: | + git push --set-upstream origin $BRANCH_NAME + + - name: Create or Update Pull Request + run: | + function gh_pr_up() { + # Ensure correct usage of the branch and repo syntax + gh pr create --title "Update from upstream" \ + --body "Merged changes from the original repository excluding 'systems/x86_64-linux' and 'homes' directories." \ + --head "${{ github.actor }}:$BRANCH_NAME" \ + --base main \ + --repo Spacebar-Cowboys/nyx \ + --fill || gh pr edit --add-label "automated-pr" \ + --title "Update from upstream" \ + --body "Automated PR to merge changes excluding specified directories." + } + gh_pr_up + env: + GITHUB_TOKEN: ${{ secrets.MY_PERSONAL_TOKEN }} From 8249d80ab46019c1b5bc667bcfb1025b4593f9fb Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 23:51:38 +0000 Subject: [PATCH 33/36] Syncing changes with upstream excluding specific directories --- .github/workflows/create_pr.yml | 76 --------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 .github/workflows/create_pr.yml diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml deleted file mode 100644 index a884dd8..0000000 --- a/.github/workflows/create_pr.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Sync Fork with Upstream and Create PR - -on: - push: - branches: - - main - -permissions: - contents: write - pull-requests: write - -jobs: - sync-and-pr: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Git - run: | - git config --global user.name "${{ github.actor }}" - git config --global user.email "${{ github.actor }}@users.noreply.github.com" - - - name: Create dynamic branch for PR - run: | - BRANCH_NAME="update-${{ github.run_id }}" - git checkout -b $BRANCH_NAME - - - name: Fetch original - run: | - git remote add upstream https://github.com/Spacebar-Cowboys/nyx.git - git fetch upstream - - - name: Temporarily ignore certain directories - run: | - echo "systems/x86_64-linux/" >> .gitignore - echo "homes/" >> .gitignore - git config --global core.excludesfile .gitignore - - - name: Merge changes excluding specific directories - run: | - git checkout main - git restore --source upstream/main --staged --worktree -- . - git add . - git reset -- .gitignore # Make sure .gitignore itself is not committed - - - name: Commit changes - run: | - if git commit -m "Syncing changes with upstream excluding specific directories"; then - echo "Changes committed." - else - echo "No changes to commit." - fi - - - name: Push changes to GitHub - run: | - git push --set-upstream origin $BRANCH_NAME - - - name: Create or Update Pull Request - run: | - function gh_pr_up() { - # Ensure correct usage of the branch and repo syntax - gh pr create --title "Update from upstream" \ - --body "Merged changes from the original repository excluding 'systems/x86_64-linux' and 'homes' directories." \ - --head "${{ github.actor }}:$BRANCH_NAME" \ - --base main \ - --repo Spacebar-Cowboys/nyx \ - --fill || gh pr edit --add-label "automated-pr" \ - --title "Update from upstream" \ - --body "Automated PR to merge changes excluding specified directories." - } - gh_pr_up - env: - GITHUB_TOKEN: ${{ secrets.MY_PERSONAL_TOKEN }} From 9e83ca7971fc7d60bb78e788055ab2e05d0e5667 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:54:59 -0400 Subject: [PATCH 34/36] Refactored Pull Request creation in GitHub Actions workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [πŸ“ - .github/workflows/create_pr.yml]: β€’ Simplified dynamic branch creation command. β€’ Modified Push command to directly use dynamic branch creation syntax. β€’ Removed usage of function 'gh_pr_up()' for Pull Request creation, refactored it to a straightforward command. β€’ Updated the error message for scenarios when there are no changes to create a PR. Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index a884dd8..fdbcbfd 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -25,8 +25,7 @@ jobs: - name: Create dynamic branch for PR run: | - BRANCH_NAME="update-${{ github.run_id }}" - git checkout -b $BRANCH_NAME + git checkout -b "update-${{ github.run_id }}" - name: Fetch original run: | @@ -56,21 +55,15 @@ jobs: - name: Push changes to GitHub run: | - git push --set-upstream origin $BRANCH_NAME + git push --set-upstream origin "update-${{ github.run_id }}" - name: Create or Update Pull Request run: | - function gh_pr_up() { - # Ensure correct usage of the branch and repo syntax - gh pr create --title "Update from upstream" \ - --body "Merged changes from the original repository excluding 'systems/x86_64-linux' and 'homes' directories." \ - --head "${{ github.actor }}:$BRANCH_NAME" \ - --base main \ - --repo Spacebar-Cowboys/nyx \ - --fill || gh pr edit --add-label "automated-pr" \ - --title "Update from upstream" \ - --body "Automated PR to merge changes excluding specified directories." - } - gh_pr_up + gh pr create --title "Update from upstream" \ + --body "Merged changes from the original repository excluding 'systems/x86_64-linux' and 'homes' directories." \ + --head "${{ github.actor }}:update-${{ github.run_id }}" \ + --base main \ + --repo Spacebar-Cowboys/nyx \ + --fill || echo "Error or no changes to create a PR." env: GITHUB_TOKEN: ${{ secrets.MY_PERSONAL_TOKEN }} From 6e6ad9d3e3b5b6751c35b07c1675080c1730a695 Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 19:58:35 -0400 Subject: [PATCH 35/36] Update target branch in PR creation workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ”§ - .github/workflows/create_pr.yml: β€’ Changed target branch from 'main' to 'upstream' in PR creation workflow Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index fdbcbfd..79bb298 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -3,7 +3,7 @@ name: Sync Fork with Upstream and Create PR on: push: branches: - - main + - upstream permissions: contents: write From a78517806777c57cb7bc5b9f051aad531e66178c Mon Sep 17 00:00:00 2001 From: use-the-fork Date: Mon, 13 May 2024 20:07:29 -0400 Subject: [PATCH 36/36] Updated the `create_pr.yml` GitHub Workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ§ͺ `.github/workflows/create_pr.yml`: β€’ Changed the triggering branch from 'upstream' to 'main' for pushes β€’ Added a condition to prevent the workflow running in the original repository 'Spacebar-Cowboys/nyx' Signed-off-by: use-the-fork --- .github/workflows/create_pr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create_pr.yml b/.github/workflows/create_pr.yml index 79bb298..d93e62b 100644 --- a/.github/workflows/create_pr.yml +++ b/.github/workflows/create_pr.yml @@ -3,7 +3,7 @@ name: Sync Fork with Upstream and Create PR on: push: branches: - - upstream + - main permissions: contents: write @@ -12,6 +12,7 @@ permissions: jobs: sync-and-pr: runs-on: ubuntu-latest + if: github.repository != 'Spacebar-Cowboys/nyx' # Ensure it does not run in the original repository steps: - name: Checkout repository uses: actions/checkout@v3