Skip to content

Commit

Permalink
Merge branch 'main' into nala
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisTitusTech authored Sep 18, 2024
2 parents 16fbd33 + 512392a commit e3b2530
Show file tree
Hide file tree
Showing 32 changed files with 1,190 additions and 147 deletions.
5 changes: 0 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Pull Request

## Title
<!--[Provide a succinct and descriptive title for the pull request.]-->

## Type of Change
- [ ] New feature
- [ ] Bug fix
Expand Down
28 changes: 17 additions & 11 deletions .github/workflows/pr-labels.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
name: Manage labels based on PR body

on:
pull_request:
pull_request_target:
types: [opened, edited, reopened, synchronize]

jobs:
manage-labels:
runs-on: ubuntu-latest
steps:
- name: Analyze PR Body and manage labels
shell: bash
run: |
body="${{ github.event.pull_request.body }}"
body=$(jq -r '.pull_request.body' "$GITHUB_EVENT_PATH")
labels_to_add=()
labels_to_remove=()
declare -A label_checks=(
Expand All @@ -20,19 +21,23 @@ jobs:
["Refactoring"]="refactor"
["UI/UX improvement"]="UI/UX"
)
for key in "${!label_checks[@]}"; do
if echo "$body" | grep -q "\- \[x\] $key"; then
labels_to_add+=("${label_checks[$key]}")
for pattern in "${!label_checks[@]}"; do
label="${label_checks[$pattern]}"
if echo "$body" | grep -Eq "\- \[x\] ($pattern)"; then
labels_to_add+=("$label")
else
labels_to_remove+=("${label_checks[$key]}")
labels_to_remove+=("$label")
fi
done
echo "LABELS_TO_ADD=${labels_to_add[*]}" >> $GITHUB_ENV
echo "LABELS_TO_REMOVE=${labels_to_remove[*]}" >> $GITHUB_ENV
echo "LABELS_TO_ADD=$(IFS=,; echo "${labels_to_add[*]}")" >> $GITHUB_ENV
echo "LABELS_TO_REMOVE=$(IFS=,; echo "${labels_to_remove[*]}")" >> $GITHUB_ENV
- name: Add labels if necessary
if: env.LABELS_TO_ADD != ''
run: |
for label in ${{ env.LABELS_TO_ADD }}; do
IFS=',' read -ra labels <<< "${LABELS_TO_ADD}"
for label in "${labels[@]}"; do
curl -s -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
Expand All @@ -42,9 +47,10 @@ jobs:
- name: Remove labels if necessary
if: env.LABELS_TO_REMOVE != ''
run: |
for label in ${{ env.LABELS_TO_REMOVE }}; do
IFS=',' read -ra labels <<< "${LABELS_TO_REMOVE}"
for label in "${labels[@]}"; do
curl -s -X DELETE \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels/$label
done
done
2 changes: 1 addition & 1 deletion start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh -e

rc='\033[0m'
red='\033[0;31m'
Expand Down
4 changes: 2 additions & 2 deletions startdev.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh -e

RC='\033[0m'
RED='\033[0;31m'
Expand Down Expand Up @@ -35,7 +35,7 @@ check() {
local message=$2

if [ $exit_code -ne 0 ]; then
echo -e "${RED}ERROR: $message${RC}"
printf "%b\n" "${RED}ERROR: $message${RC}"
exit 1
fi
}
Expand Down
11 changes: 6 additions & 5 deletions tabs/applications-setup/alacritty-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

. ../common-script.sh

setupAlacritty() {
echo "Install Alacritty if not already installed..."
installAlacritty() {
echo "Installing Alacritty..."
if ! command_exists alacritty; then
case "$PACKAGER" in
pacman)
Expand All @@ -14,21 +14,22 @@ setupAlacritty() {
;;
esac
else
echo "alacritty is already installed."
printf "%b\n" "${GREEN}alacritty is already installed.${RC}"
fi
}

setupAlacrittyConfig() {
echo "Copy alacritty config files"
printf "%b\n" "${YELLOW}Copy alacritty config files${RC}"
if [ -d "${HOME}/.config/alacritty" ] && [ ! -d "${HOME}/.config/alacritty-bak" ]; then
cp -r "${HOME}/.config/alacritty" "${HOME}/.config/alacritty-bak"
fi
mkdir -p "${HOME}/.config/alacritty/"
curl -sSLo "${HOME}/.config/alacritty/alacritty.toml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/alacritty.toml"
curl -sSLo "${HOME}/.config/alacritty/nordic.toml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/nordic.toml"
printf "%b\n" "${GREEN}Alacritty configuration files copied.${RC}"
}

checkEnv
checkEscalationTool
setupAlacritty
installAlacritty
setupAlacrittyConfig
Loading

0 comments on commit e3b2530

Please sign in to comment.