Skip to content

Commit

Permalink
feat: add new Github workflows (#115)
Browse files Browse the repository at this point in the history
* feat(github): add new action for welcome contributors

* feat(github): add action to assign issue to contributor

* chore: small fix contributing page
  • Loading branch information
alexghirelli authored Feb 4, 2024
1 parent 487daf9 commit 39de0f7
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 3 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/take-issue.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# .github/workflows/take.yml
name: Assign issue to contributor
on:
issue_comment:

jobs:
assign:
name: Take an issue
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: take the issue
uses: bdougie/take-action@main
with:
message: Thanks for taking this issue! Let us know if you have any questions!
blockingLabels: in progress
blockingLabelsMessage: This issue is already taken by someone else and is in progress. You can find another one by surfing the issues page.
trigger: .take
token: ${{ secrets.GITHUB_TOKEN }}
46 changes: 46 additions & 0 deletions .github/workflows/welcome-contributors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Welcome New Contributors

on:
issues:
types: [opened]
pull_request_target:
types: [opened]

jobs:
welcome:
runs-on: ubuntu-latest
steps:
- name: Welcome Issue
if: github.event_name == 'issues'
uses: actions/github-script@v5
with:
script: |
const issue = context.issue;
const repo = context.repo;
const issueAuthor = context.payload.sender.login;
const welcomeMessage = `
Hi @${issueAuthor}! :wave:
Thank you for creating an issue in our repository! We appreciate your contribution and will get back to you as soon as possible.
`;
github.rest.issues.createComment({
...repo,
issue_number: issue.number,
body: welcomeMessage
});
- name: Welcome Pull Request
if: github.event_name == 'pull_request_target'
uses: actions/github-script@v5
with:
script: |
const pr = context.issue;
const repo = context.repo;
const prAuthor = context.payload.sender.login;
const welcomeMessage = `
Hi @${prAuthor}! :wave:
Thank you for submitting a pull request! We appreciate your contribution and will review your changes as soon as possible.
`;
github.rest.issues.createComment({
...repo,
issue_number: pr.number,
body: welcomeMessage
});
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ Some thoughts to help you contribute to this project
```sh
$ git clone https://github.com/<your-name>/projectx
$ cd projectx
$ yarn install
$ pnpm i
```

## Building

```sh
$ yarn build
$ pnpm run build
```

## Pull Requests
Expand All @@ -32,7 +32,7 @@ $ yarn build
1. Fork the repo and create your branch
2. Name your branch something that is descriptive to the work you are doing. i.e. adds-new-thing or fixes-mobile
3. Make sure you address any lint warnings.
4. Run yarn format if your unsure
4. Run `pnpm run format` if your unsure
5. If you make the existing code better, please let us know in your PR description.
6. A PR description and title are required. The title is required to begin with: "feat:" or "fix:"
7. [Link to an issue](https://help.github.com/en/github/writing-on-github/autolinked-references-and-urls) in the project. Unsolicited code is welcomed, but an issue is required for announce your intentions. PR's without a linked issue will be marked invalid and closed.
Expand Down

0 comments on commit 39de0f7

Please sign in to comment.