Skip to content

Commit

Permalink
Minor Fixes (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
gvatsal60 authored Nov 24, 2024
2 parents 8cd5ea3 + 54afc37 commit 35f19b8
Show file tree
Hide file tree
Showing 11 changed files with 175 additions and 23 deletions.
6 changes: 5 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"bradzacher.vscode-copy-filename",
"esbenp.prettier-vscode",
"gurumukhi.selected-lines-count",
"marvhen.reflow-markdown",
"ms-azuretools.vscode-docker",
"streetsidesoftware.code-spell-checker",
"usernamehw.errorlens"
Expand Down Expand Up @@ -43,6 +44,9 @@
},
"files.eol": "\n"
},
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
},
"[shellscript]": {
"editor.defaultFormatter": "foxundermoon.shell-format",
"editor.tabSize": 4,
Expand Down Expand Up @@ -88,7 +92,7 @@
},
"image": "mcr.microsoft.com/devcontainers/base:noble",
"mounts": [
"source=${containerWorkspaceFolder}/snippets,target=${containerWorkspaceFolder}/.vscode,type=bind,consistency=cached,readonly"
"source=${localWorkspaceFolder}/snippets,target=${containerWorkspaceFolder}/.vscode,type=bind,consistency=cached"
],
"postCreateCommand": "chmod +x ${containerWorkspaceFolder}/.devcontainer/postCreateScript.sh && ${containerWorkspaceFolder}/.devcontainer/postCreateScript.sh",
"runArgs": [
Expand Down
27 changes: 25 additions & 2 deletions .devcontainer/postCreateScript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
##########################################################################################
# Constants
##########################################################################################
readonly ALIAS_SOURCE_URL="https://raw.githubusercontent.com/gvatsal60/Linux-Aliases/HEAD/install.sh"
readonly SNIPPETS_DIR="snippets"
readonly VSCODE_DIR=".vscode"
readonly SNIPPET_FILES_PATTERN="*.code-snippets"

readonly ALIAS_SRC_URL="https://raw.githubusercontent.com/gvatsal60/Linux-Aliases/HEAD/install.sh"

##########################################################################################
# Functions
Expand All @@ -43,8 +47,27 @@ readonly ALIAS_SOURCE_URL="https://raw.githubusercontent.com/gvatsal60/Linux-Ali
# Install Linux aliases from external script using curl and execute immediately
# Note: Make sure to review scripts fetched from external sources for security reasons
if command -v curl >/dev/null 2>&1; then
curl -fsSL ${ALIAS_SOURCE_URL} | sh
curl -fsSL ${ALIAS_SRC_URL} | sh
else
echo "Error: curl is not installed. Unable to use Linux aliases"
exit 1
fi

# As bind mounts not supported in GitHub Codespaces
if [ -n "${CODESPACE_NAME}" ]; then
# Generate symlinks for snippet files
# Create the .vscode directory if it doesn't already exist.
mkdir -p "${VSCODE_DIR}"
# Unlink all symbolic links in the '.vscode' directory
find "${VSCODE_DIR}" -type l -name "${SNIPPET_FILES_PATTERN}" | while read -r file; do
unlink "${file}"
done
# Check if the 'snippets' directory exists
if [ -d "${SNIPPETS_DIR}" ]; then
# Find all .code-snippet files in the 'snippets' directory and create symbolic links
find "${SNIPPETS_DIR}" -type f -name "${SNIPPET_FILES_PATTERN}" | while read -r file; do
# Create a symbolic link in '.vscode' with the same base name
ln -s "$(realpath "${file}")" "${VSCODE_DIR}/$(basename "${file}")"
done
fi
fi
11 changes: 10 additions & 1 deletion .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
56 changes: 56 additions & 0 deletions .github/workflows/codacy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow checks out code, performs a Codacy security scan
# and integrates the results with the
# GitHub Advanced Security code scanning feature. For more information on
# the Codacy security scan action usage and parameters, see
# https://github.com/codacy/codacy-analysis-cli-action.
# For more information on Codacy Analysis CLI in general, see
# https://github.com/codacy/codacy-analysis-cli.

name: Codacy Security Scan
on:
push:
branches: ["master"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["master"]
schedule:
- cron: "17 16 * * 5"
permissions:
contents: read
jobs:
codacy-security-scan:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
name: Codacy Security Scan
runs-on: ubuntu-latest
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v4
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
- name: Run Codacy Analysis CLI
uses: codacy/codacy-analysis-cli-action@97bf5df3c09e75f5bcd72695998f96ebd701846e
with:
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
# You can also omit the token and run the tools that support default configurations
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
verbose: true
output: results.sarif
format: sarif
# Adjust severity of non-security issues
gh-code-scanning-compat: true
# Force 0 exit code to allow SARIF file generation
# This will handover control about PR rejection to the GitHub side
max-allowed-issues: 2147483647
# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
5 changes: 3 additions & 2 deletions .github/workflows/readme-checker.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name: markdown-lint
on:
push:
pull_request:
permissions:
contents: write
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Markdown Lint
uses: DavidAnson/markdownlint-cli2-action@v16
uses: DavidAnson/markdownlint-cli2-action@eb5ca3ab411449c66620fe7f1b3c9e10547144b0
with:
fix: true
globs: |
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/shell-format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Shell Format
on:
push:
branches: ["master"]
permissions:
contents: write
pull-requests: write
jobs:
shell-format:
name: Shell Format (shfmt)
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Install shfmt
run: |
sudo apt-get install shfmt -y
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Format, Commit and Push Changes
run: |
BRANCH_NAME="fix/shfmt"
# Check if the branch exists, and switch to it, otherwise create a new branch
if git rev-parse --verify ${BRANCH_NAME}; then
git checkout ${BRANCH_NAME}
git pull origin master
else
git checkout -b ${BRANCH_NAME}
fi
# Format Shell Scripts
find . -type f -name "*.sh" -exec shfmt -w -i 4 {} \;
# Commit and Push
git diff --exit-code || (
COMMIT_MSG="Format shell scripts with shfmt"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "${COMMIT_MSG}" # Use the commit message here
git push -f --set-upstream origin ${BRANCH_NAME}
gh pr create --title "${COMMIT_MSG}" --body "This PR formats shell scripts with shfmt."
)
env:
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
5 changes: 5 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"MD013": {
"line_length": 120
}
}
2 changes: 0 additions & 2 deletions .markdownlint.yaml

This file was deleted.

20 changes: 12 additions & 8 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers
pledge to make participation in our project and our community a harassment-free experience for everyone,
regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and orientation.
In the interest of fostering an open and welcoming environment,
we as contributors and maintainers pledge to make participation
in our project and our community a harassment-free experience for everyone,
regardless of age, body size, disability, ethnicity, gender identity
and expression, level of experience, nationality, personal appearance,
race, religion, or sexual identity and orientation.

## Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected
to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting
the project team at [contact email]. All complaints will be reviewed and investigated promptly and fairly.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [contact email](github-actions[bot]@users.noreply.github.com).
All complaints will be reviewed and investigated promptly and fairly.

## Attribution

Expand Down
7 changes: 4 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ We follow the [coding style guide](link_to_style_guide) for this project.

## Reporting Bugs

Please report bugs using the GitHub issue tracker. Include steps to reproduce the bug and
any relevant error messages.
Please report bugs using the GitHub issue tracker.
Include steps to reproduce the bug and any relevant error messages.

## Contact

If you have questions or need further assistance, feel free to contact us at [contact email].
If you have questions or need further assistance,
feel free to contact us at [contact email](github-actions[bot]@users.noreply.github.com).
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
![GitHub forks](https://img.shields.io/github/forks/gvatsal60/project-template)
![GitHub stars](https://img.shields.io/github/stars/gvatsal60/project-template)

This repository serves as a foundational template for new projects, equipped with essential tools for
maintaining code quality and documentation consistency. It includes:
This repository serves as a foundational template for new projects,
equipped with essential tools for maintaining code quality and documentation consistency.
It includes:

1. README.md
2. LICENSE
Expand Down Expand Up @@ -43,5 +44,6 @@ before submitting pull requests.

## License

This project is licensed under the Apache License 2.0 License - see the
[LICENSE](https://github.com/gvatsal60/project-template/blob/HEAD/LICENSE) file for details.
This project is licensed under the Apache License 2.0 License -
see the [LICENSE](https://github.com/gvatsal60/project-template/blob/HEAD/LICENSE)
file for details.

0 comments on commit 35f19b8

Please sign in to comment.