Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Achixz committed Jul 17, 2024
0 parents commit 2cce317
Show file tree
Hide file tree
Showing 21 changed files with 2,130 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: barudakrosul # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: [
"https://www.trakteer.id/barudakrosul",
] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Bug report
description: Create a report to help us improve.
labels:
- "bug"
body:
- type: textarea
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
attributes:
label: Expected behavior
description:
A clear and concise description of what you expected to happen.
- type: textarea
attributes:
label: Screenshots / Link Image
description: If applicable, add screenshots to help explain your problem.
placeholder: Paste the screenshots image link as markdown image
- type: textarea
attributes:
label: Additional context
description: Add any other context about the problem here.
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Feature request
description: Suggest an idea for this project.
labels:
- "enhancement"
body:
- type: textarea
attributes:
label: Is your feature request related to a problem? Please describe.
description:
A clear and concise description of what the problem is. Ex. I'm always
frustrated when [...]
validations:
required: true
- type: textarea
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen.
- type: textarea
attributes:
label: Describe alternatives you've considered
description:
A clear and concise description of any alternative solutions or features
you've considered.
- type: textarea
attributes:
label: Additional context
description:
Add any other context or screenshots about the feature request here.
21 changes: 21 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 2
updates:
# Maintain dependencies for NPM
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 100
commit-message:
prefix: "build(deps)"
prefix-development: "build(deps-dev)"

# Maintain dependencies for GitHub Actions
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 100
commit-message:
prefix: "build(deps)"
prefix-development: "build(deps-dev)"
32 changes: 32 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
queue_rules:
- name: dep-update
batch_size: 100
batch_max_wait_time: 30 min
queue_conditions:
- author = dependabot[bot]

pull_request_rules:
- name: Automatic approve for Dependabot pull requests
conditions:
- author = dependabot[bot]
actions:
review:
type: APPROVE
- name: Automatic merge for Dependabot pull requests
conditions:
- author = dependabot[bot]
- "#approved-reviews-by>=1"
actions:
queue:
- name: Automatic approve for GitHub Actions pull requests
conditions:
- author = github-actions[bot]
actions:
review:
type: APPROVE
- name: Automatic merge for GitHub Actions pull requests
conditions:
- author = github-actions[bot]
- "#approved-reviews-by>=1"
actions:
merge:
83 changes: 83 additions & 0 deletions .github/workflows/auto-build-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Auto Build All Dependencies and DevDependencies
on:
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# * * * * *
- cron: "0 0 */7 * *"
workflow_dispatch:

permissions:
actions: read
checks: read
contents: write
deployments: read
issues: read
discussions: read
packages: read
pages: read
pull-requests: write
repository-projects: read
security-events: read
statuses: read

jobs:
autoBuild:
runs-on: ubuntu-latest
name: Auto build deps
strategy:
matrix:
node-version: [18.x]
if: github.repository == 'BarudakRosul/swap-case'

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Setup Node
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: ${{ matrix.node-version }}
cache: npm

# Fix the unsafe repo error which was introduced by the CVE-2022-24765 git patches.
- name: Fix unsafe repo error
run: git config --global --add safe.directory ${{ github.workspace }}

- name: Run npm install and update
run: |
npm install
npm update --save
env:
CI: true

- name: Set up Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Push commit to a new branch
run: |
branch="auto_build_and_bump"
message="build(deps): bump all dependencies and devDependencies version"
body=$(printf "## Changes File\n\n\`\`\`diff\n$(git diff)\n\`\`\`\n\n> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>")
if [[ ${#body} >= 65000 ]]; then
body="⚠️ The text diff is too longer, [view changes](https://github.com/BarudakRosul/swap-case/pull/${{ github.event.number }}/files)."
fi
if [[ "$(git status --porcelain)" != "" ]]; then
git branch -D ${branch} || true
git checkout -b ${branch}
git add package.json package-lock.json
git commit --message "${message}"
git remote add origin-${branch} "https://github.com/BarudakRosul/swap-case.git"
git push --force --quiet --set-upstream origin-${branch} ${branch}
gh pr create --title "${message}" --body "${body}"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47 changes: 47 additions & 0 deletions .github/workflows/prs-cache-clean.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: prs cache clean
on:
pull_request:
types:
- closed

permissions:
actions: write
checks: read
contents: read
deployments: read
issues: read
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish package to NPM.js
on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
# Defaults to the user or organization that owns the workflow file
scope: "@barudakrosul"
- run: npm install
- run: npm publish --public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test
on:
push:
branches:
- master
pull_request:
branches:
- master

permissions: read-all

jobs:
build:
name: Perform check
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
if: github.repository == 'BarudakRosul/swap-case'

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Setup Node
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: ${{ matrix.node-version }}
cache: npm

- name: Install package
run: npm install

- name: Testing code
run: npm test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.github/
node_modules/
image/
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
@barudakrosul:registry=https://registry.npmjs.org
always-auth=true
Loading

0 comments on commit 2cce317

Please sign in to comment.