Skip to content

Commit

Permalink
Workflow Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Vatsal Gupta committed Dec 17, 2024
1 parent 171a77e commit f29855f
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 6 deletions.
7 changes: 3 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,11 @@
}
},
"features": {
"ghcr.io/gvatsal60/dev-container-features/pre-commit": {},
"ghcr.io/gvatsal60/dev-container-features/sonarlint": {}
"ghcr.io/gvatsal60/dev-container-features/pre-commit": {}
},
"image": "mcr.microsoft.com/devcontainers/base:noble",
"image": "mcr.microsoft.com/devcontainers/javascript-node",
"mounts": [
"source=${containerWorkspaceFolder}/snippets,target=${containerWorkspaceFolder}/.vscode,type=bind,consistency=cached,readonly"
"source=${localWorkspaceFolder}/snippets,target=${containerWorkspaceFolder}/.vscode,type=bind,consistency=cached,readonly"
],
"postCreateCommand": "chmod +x ${containerWorkspaceFolder}/.devcontainer/postCreateScript.sh && ${containerWorkspaceFolder}/.devcontainer/postCreateScript.sh",
"runArgs": [
Expand Down
23 changes: 23 additions & 0 deletions .devcontainer/postCreateScript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
##########################################################################################
# Constants
##########################################################################################
readonly SNIPPETS_DIR="snippets"
readonly VSCODE_DIR=".vscode"
readonly SNIPPET_FILES_PATTERN="*.code-snippets"

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

##########################################################################################
Expand All @@ -48,3 +52,22 @@ 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
4 changes: 4 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ updates:
directory: "/"
schedule:
interval: weekly
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
25 changes: 25 additions & 0 deletions .github/workflows/dependabot-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Dependabot Auto Approve & Merge
on: pull_request
permissions:
pull-requests: write
contents: write
jobs:
dependabot:
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'dependabot[bot]'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@dbb049abf0d677abbd7f7eee0375145b417fdd34
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
20 changes: 20 additions & 0 deletions .github/workflows/pre-commit-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Pre-commit Auto Approve & Merge
on: pull_request
permissions:
pull-requests: write
contents: write
jobs:
pre-commit:
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'pre-commit-ci[bot]'
steps:
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
3 changes: 1 addition & 2 deletions .github/workflows/readme-checker.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: markdown-lint
on:
push:
pull_request:
jobs:
lint:
Expand All @@ -9,7 +8,7 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Markdown Lint
uses: DavidAnson/markdownlint-cli2-action@v16
uses: DavidAnson/markdownlint-cli2-action@v18
with:
fix: true
globs: |
Expand Down

0 comments on commit f29855f

Please sign in to comment.