Skip to content

Commit

Permalink
Github Workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Bashamega committed Aug 14, 2024
1 parent 2701791 commit c6b0622
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Run Format

on:
push:
pull_request:

jobs:
prettier:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "18" # Updated Node.js version

- name: Install dependencies
run: npm install

- name: Run script
run: npm run format:check # Replace with the path to your script
39 changes: 39 additions & 0 deletions .github/workflows/greet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Greet New PRs and Issues

on:
pull_request:
types: [opened]
issues:
types: [opened]

permissions:
issues: write
pull-requests: write

jobs:
greet:
runs-on: ubuntu-latest
steps:
- name: Greet on PRs and Issues
uses: actions/github-script@v7
with:
script: |
try {
const isPR = context.payload.pull_request !== undefined;
const number = isPR ? context.payload.pull_request.number : context.payload.issue.number;
const commentBody = isPR
? `Hey there! 👋 Thanks for taking the time to send in this pull request. We are happy to have your contribution! If you have any questions or need any help, feel free to ask.`
: `Hello! 👋 Thanks for opening this issue. We appreciate your feedback and will look into it as soon as possible. Feel free to add more details if necessary.`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: number,
body: commentBody
});
console.log('Comment successfully created.');
} catch (error) {
console.error('Error creating comment:', error);
// Do not mark the step as failed; continue with the workflow.
}
4 changes: 4 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
tabWidth: 2,
useTabs: false,
};

0 comments on commit c6b0622

Please sign in to comment.