Skip to content

Commit

Permalink
Merge branch 'ChrisTitusTech:main' into SoundSwitch
Browse files Browse the repository at this point in the history
  • Loading branch information
MyDrift-user authored Jul 17, 2024
2 parents 8c51d66 + 508f909 commit 7d245cc
Show file tree
Hide file tree
Showing 54 changed files with 1,445 additions and 446 deletions.
11 changes: 5 additions & 6 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,23 @@ about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
## Describe the bug
A clear and concise description of what the bug is.

**To Reproduce**
## To Reproduce
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
## Expected behavior
A clear and concise description of what you expected to happen.

**Screenshots**
## Screenshots
If applicable, add screenshots to help explain your problem.

**Additional context**
## Additional context
Add any other context about the problem here.
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
[Discuss the impact of your changes on the project. This might include effects on performance, new dependencies, or changes in behaviour.]

## Issue related to PR
[What issue is related to this PR (if any)]
[What issue/discussion is related to this PR (if any)]
- Resolves #

## Additional Information
Expand All @@ -33,4 +33,4 @@
- [ ] I have performed a self-review of my own code.
- [ ] I have commented my code, particularly in hard-to-understand areas.
- [ ] I have made corresponding changes to the documentation.
- [ ] My changes generate no errors/warnings/merge conflicts.
- [ ] My changes generate no errors/warnings/merge conflicts.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
ignore:
- dependency-name: "actions/stale"
versions: '>= 9'
30 changes: 30 additions & 0 deletions .github/workflows/close-discussion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Close Discussion on PR Merge

on:
pull_request:
types: [closed]

jobs:
closeDiscussion:
runs-on: ubuntu-latest
steps:
- name: Check if PR was merged
if: github.event.pull_request.merged == true
run: echo "PR was merged"

- name: Extract Discussion Number
if: github.event.pull_request.merged == true
id: extract-discussion
run: |
echo "discussion=$(echo '${{ github.event.pull_request.body }}' | grep -oP '(?<=Resolves #)\d+')" >> $GITHUB_OUTPUT
shell: bash

- name: Close the discussion
if: github.event.pull_request.merged == true && steps.extract-discussion.outputs.discussion
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DISCUSSION_ID: ${{ steps.extract-discussion.outputs.discussion }}
run: |
curl -X PATCH -H "Authorization: token $GITHUB_TOKEN" \
-d '{"state": "closed"}' \
"https://api.github.com/repos/${{ github.repository }}/discussions/${DISCUSSION_ID}"
42 changes: 42 additions & 0 deletions .github/workflows/createchangelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Update update.mb on Release

on:
release:
types: [published, prereleased]
workflow_dispatch: # Add this line to enable manual triggering

jobs:
update-file:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Get all releases and update update.mb file
run: |
# Fetch all releases including pre-releases using GitHub CLI
gh release list --limit 5 > releases.txt
# Extract numeric versions and create update.mb content
echo "" > docs/update.mb
while read -r line; do
tag=$(echo "$line" | awk '{print $1}')
name=$(echo "$line" | awk -F'\t' '{print $2}')
version_numeric=$(echo "$tag" | grep -o -E '[0-9.]+')
body=$(gh release view "$tag" --json body --jq .body)
echo "## $version_numeric" >> docs/update.mb
echo "Release name: $name" >> docs/update.mb
echo "Release body: $body" >> docs/update.mb
echo "" >> docs/update.mb
done < releases.txt
- name: Commit and Push Changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add docs/update.mb
git commit -m "Update update.mb with all releases"
git push
23 changes: 23 additions & 0 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: GitHub Pages Deploy
on:
push:
branches:
- master
- main
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: actions/cache@v4
with:
key: ${{ github.ref }}
path: .cache
- run: pip install mkdocs-material
- run: pip install pillow cairosvg
- run: mkdocs gh-deploy --force
43 changes: 43 additions & 0 deletions .github/workflows/issue-slash-commands.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Close issue on /close

on:
issue_comment:
types: [created, edited]

jobs:
closeIssueOnClose:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: none
contents: read

steps:
- name: Check for /close comment
id: check_comment
run: |
if [[ "${{ contains(github.event.comment.body, '/close') }}" == "true" ]]; then
echo "comment=true" >> $GITHUB_ENV
else
echo "comment=false" >> $GITHUB_ENV
fi
- name: Check if the user is allowed
id: check_user
if: env.comment == 'true'
run: |
ALLOWED_USERS=("ChrisTitusTech" "og-mrk" "Marterich" "MyDrift-user" "Real-MullaC")
if [[ " ${ALLOWED_USERS[@]} " =~ " ${{ github.event.comment.user.login }} " ]]; then
echo "user=true" >> $GITHUB_ENV
else
echo "user=false" >> $GITHUB_ENV
fi
- name: Close issue if conditions are met
if: env.comment == 'true' && env.user == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
run: |
echo Closing the issue...
gh issue close $ISSUE_NUMBER --repo ${{ github.repository }}
42 changes: 24 additions & 18 deletions .github/workflows/pre-release.yaml
Original file line number Diff line number Diff line change
@@ -1,46 +1,52 @@
name: Pre-Release WinUtil

permissions:
contents: write
actions: read

on:
workflow_run:
workflows: ["Compile"] #Ensure Compile winget.ps1 is done
workflows: ["Compile"]
types:
- completed
workflow_dispatch: # Manual trigger added

jobs:
build-runspace:
runs-on: windows-latest
outputs:
version: ${{ steps.extract_version.outputs.version }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Extract Version from winutil.ps1
id: extract_version
run: |
$version = ''
Get-Content ./winutil.ps1 -TotalCount 30 | ForEach-Object {
if ($_ -match 'Version\s*:\s*(\d{2}\.\d{2}\.\d{2})') {
$version = "pre"+$matches[1]
echo "version=$version" >> $GITHUB_ENV
echo "::set-output name=version::$version"
break
}
}
if (-not $version) {
Write-Error "Version not found in winutil.ps1"
exit 1
$version = (Get-Date -Format "yy.MM.dd")
echo "version=$version" >> $env:GITHUB_ENV
shell: pwsh

- name: Create Tag
id: create_tag
run: |
$tagExists = git tag -l $env:VERSION
if ($tagExists -eq "") {
git tag $env:VERSION
git push origin $env:VERSION
} else {
Write-Host "Tag $env:VERSION already exists, skipping tag creation"
}
shell: pwsh

- name: Create and Upload Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.extract_version.outputs.version }}
name: Pre-Release ${{ steps.extract_version.outputs.version }}
tag_name: ${{ env.VERSION }}
name: Pre-Release ${{ env.VERSION }}
body: "![GitHub Downloads (specific asset, specific tag)](https://img.shields.io/github/downloads/ChrisTitusTech/winutil/${{ env.VERSION }}/winutil.ps1)"
append_body: false
files: ./winutil.ps1
prerelease: true
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 3 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ jobs:
Get-Content ./winutil.ps1 -TotalCount 30 | ForEach-Object {
if ($_ -match 'Version\s*:\s*(\d{2}\.\d{2}\.\d{2})') {
$version = $matches[1]
echo "version=$version" >> $GITHUB_ENV
echo "::set-output name=version::$version"
echo "version=$version" >> $GITHUB_OUTPUT
break
}
}
Expand All @@ -36,6 +35,8 @@ jobs:
with:
tag_name: ${{ steps.extract_version.outputs.version }}
name: Release ${{ steps.extract_version.outputs.version }}
body: "![GitHub Downloads (specific asset, specific tag)](https://img.shields.io/github/downloads/ChrisTitusTech/winutil/${{ steps.extract_version.outputs.version }}/winutil.ps1)"
append_body: true
files: ./winutil.ps1
prerelease: false
make_latest: "true"
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/sponsors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Generate Sponsors README
on:
workflow_dispatch:
schedule:
- cron: 30 15 * * 0-6
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Generate Sponsors 💖
uses: JamesIves/github-sponsors-readme-action@v1
with:
token: ${{ secrets.PAT }}
file: 'README.md'

- name: Deploy to GitHub Pages 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: main
folder: '.'
4 changes: 2 additions & 2 deletions .github/workflows/unittests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: PS Script Analyzer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: lint
uses: devblackops/github-action-psscriptanalyzer@master
with:
Expand All @@ -22,7 +22,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install Pester
run: |
Expand Down
20 changes: 0 additions & 20 deletions CONTRIBUTING.md

This file was deleted.

8 changes: 3 additions & 5 deletions Compile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@ Get-ChildItem .\config | Where-Object {$psitem.extension -eq ".json"} | ForEach-

# Replace every XML Special Character so it'll render correctly in final build
# Only do so if json files has content to be displayed (for example the applications, tweaks, features json files)
# Some Type Convertion using Casting and Cleaning Up of the convertion result using 'Replace' Method
# Make an Array List containing every name at first level of Json File
$jsonAsObject = $json | convertfrom-json
$firstLevelJsonList = ([System.String]$jsonAsObject).split('=;') | ForEach-Object {
$_.Replace('=}','').Replace('@{','').Replace(' ','')
}

$firstLevelJsonList = [System.Collections.ArrayList]::new()
$jsonAsObject.PSObject.Properties.Name | ForEach-Object {$null = $firstLevelJsonList.Add($_)}
# Note:
# Avoid using HTML Entity Codes, for example '&rdquo;' (stands for "Right Double Quotation Mark"),
# Use **HTML decimal/hex codes instead**, as using HTML Entity Codes will result in XML parse Error when running the compiled script.
Expand Down
Loading

0 comments on commit 7d245cc

Please sign in to comment.