Skip to content

Commit

Permalink
Contributing and code of conduct and improve maintainers duties (#816)
Browse files Browse the repository at this point in the history
* Add contributing guidelines

Signed-off-by: Marcos Candeia <[email protected]>

* Add issue template

Signed-off-by: Marcos Candeia <[email protected]>

* Improve pull request

Signed-off-by: Marcos Candeia <[email protected]>

* Add releaser

Signed-off-by: Marcos Candeia <[email protected]>

* Run on synchronize

Signed-off-by: Marcos Candeia <[email protected]>

* Add maintainers list

Signed-off-by: Marcos Candeia <[email protected]>

* Testing the message

Signed-off-by: Marcos Candeia <[email protected]>

* Ignore prelease versions

Signed-off-by: Marcos Candeia <[email protected]>

* Echo latest tag

Signed-off-by: Marcos Candeia <[email protected]>

* Get latest tag from git

Signed-off-by: Marcos Candeia <[email protected]>

* Use new way to define outputs

Signed-off-by: Marcos Candeia <[email protected]>

* Echoing latest tag

Signed-off-by: Marcos Candeia <[email protected]>

* Fetch tags

Signed-off-by: Marcos Candeia <[email protected]>

* Add fetch tags

Signed-off-by: Marcos Candeia <[email protected]>

---------

Signed-off-by: Marcos Candeia <[email protected]>
  • Loading branch information
mcandeia authored Aug 29, 2024
1 parent f0614de commit fa408bf
Show file tree
Hide file tree
Showing 8 changed files with 374 additions and 99 deletions.
42 changes: 42 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: Issue Report
about: Report a bug, suggest an enhancement, or ask a question
title: ""
labels: ""
assignees: ""
---

## Issue Type

Please select the type of issue you are reporting:

- [ ] Bug Report
- [ ] Feature Request
- [ ] Discussion
- [ ] Question

## Description

Please provide a clear and concise description of the issue or enhancement. Include any relevant information that could help reproduce the issue or understand the request.

## Steps to Reproduce (for bugs)

1. Step one
2. Step two
3. ...

## Expected Behavior

Describe what you expected to happen.

## Actual Behavior

Describe what actually happened.

## Additional Context

Add any other context about the issue here, including screenshots, logs, or other supporting information.

---

Thank you for taking the time to report this issue!
19 changes: 14 additions & 5 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
<!-- deno-fmt-ignore-file -->
## What is this contribution about?
## What is this Contribution About?

## Loom
> Record a quick screencast describing your changes to show the team and help reviewers.
Please provide a brief description of the changes or enhancements you are proposing in this pull request.

## Link
> Please provide a link to a branch that demonstrates this pull request in action.
## Issue Link

Please link to the relevant issue that this pull request addresses:

- Issue: [#ISSUE_NUMBER](link_to_issue)

## Loom Video

> Record a quick screencast describing your changes to help the team understand and review your contribution. This will greatly assist in the review process.
## Demonstration Link

> Provide a link to a branch or environment where this pull request can be tested and seen in action.
126 changes: 126 additions & 0 deletions .github/workflows/releaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Release Tagging

on:
pull_request:
types: [opened, reopened, synchronize, closed]

permissions:
contents: write # Allows pushing changes and creating tags
pull-requests: write # Allows adding comments to pull requests
issues: write

jobs:
tag-discussion:
if: github.event.action == 'opened'
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Calculate new versions
id: calculate_versions
run: |
git fetch --tags
LATEST_TAG=$(git tag --sort=-v:refname | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)
echo "latest tag: $LATEST_TAG"
MAJOR=$(echo $LATEST_TAG | cut -d. -f1)
MINOR=$(echo $LATEST_TAG | cut -d. -f2)
PATCH=$(echo $LATEST_TAG | cut -d. -f3)
NEW_PATCH_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
NEW_MINOR_VERSION="$MAJOR.$((MINOR + 1)).0"
NEW_MAJOR_VERSION="$((MAJOR + 1)).0.0"
echo "patch_version=$NEW_PATCH_VERSION" >> $GITHUB_OUTPUT
echo "minor_version=$NEW_MINOR_VERSION" >> $GITHUB_OUTPUT
echo "major_version=$NEW_MAJOR_VERSION" >> $GITHUB_OUTPUT
- name: Start Discussion for Tagging
uses: peter-evans/create-or-update-comment@v2
id: comment
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
## Tagging Options
Should a new tag be published when this PR is merged?
- 👍 for **Patch** ${{ steps.calculate_versions.outputs.patch_version }} update
- 🎉 for **Minor** ${{ steps.calculate_versions.outputs.minor_version }} update
- 🚀 for **Major** ${{ steps.calculate_versions.outputs.major_version }} update
determine-tag:
if: github.event.action == 'closed' && github.event.pull_request.merged == true && github.ref == 'refs/heads/main'
needs: tag-discussion
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Determine the next version based on comments
id: determine_version
run: |
git fetch --tags
LATEST_TAG=$(git tag --sort=-v:refname | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)
MAJOR=$(echo $LATEST_TAG | cut -d. -f1)
MINOR=$(echo $LATEST_TAG | cut -d. -f2)
PATCH=$(echo $LATEST_TAG | cut -d. -f3)
# Define allowed users
ALLOWED_USERS=$(cat MAINTAINERS.txt | tr '\n' ' ')
echo "Maintainers list: $ALLOWED_USERS"
# Fetch reactions and filter by allowed users
REACTION=$(gh api graphql -f query='
query {
repository(owner:"${{ github.repository_owner }}", name:"${{ github.event.repository.name }}") {
pullRequest(number: ${{ github.event.pull_request.number }}) {
comments(last: 100) {
nodes {
body
id
reactions(last: 100) {
nodes {
content
user {
login
}
}
}
}
}
}
}
}' | jq -r '
.data.repository.pullRequest.comments.nodes[] |
select(.body | contains("## Tagging Options")) |
.reactions.nodes[] |
select(.user.login | inside(["'${ALLOWED_USERS[*]}'"])) |
.content'
)
# Determine the new tag version based on the allowed reactions
if [[ "$REACTION" == *"ROCKET"* ]]; then
NEW_TAG="$((MAJOR + 1)).0.0"
elif [[ "$REACTION" == *"TADA"* ]]; then
NEW_TAG="$MAJOR.$((MINOR + 1)).0"
else
NEW_TAG="$MAJOR.$MINOR.$((PATCH + 1))"
fi
echo "new_version=$NEW_TAG" >> $GITHUB_OUTPUT
- name: Update deno.json Version
run: |
jq --arg new_version "${{ steps.determine_version.outputs.new_version }}" '.version = $new_version' deno.json > tmp.$$.json && mv tmp.$$.json deno.json
git config user.name "decobot"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add deno.json
git commit -m "Update version to ${{ steps.determine_version.outputs.new_version }}"
git push origin main
- name: Create and Push Tag
run: |
git tag ${{ steps.determine_version.outputs.new_version }}
git push origin ${{ steps.determine_version.outputs.new_version }}
20 changes: 0 additions & 20 deletions .github/workflows/update.yml

This file was deleted.

73 changes: 73 additions & 0 deletions CODE-OF-CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making 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,
education, socio-economic status, nationality, personal appearance, race,
religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our 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 have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at {{ email }}. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org
64 changes: 64 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Contributing Guidelines

Thank you for your interest in contributing to the `deco-cx/apps` repository! We are excited to have community members like you involved in improving our collection of powerful apps. This document outlines how you can contribute effectively to the project.

## How to Contribute

### Issues

When submitting an issue, please use one of the following types:

- **Issue/Bug**: Report bugs or track existing issues.
- **Issue/Discussion**: Start a discussion to gather input on a topic before it becomes a proposal.
- **Issue/Proposal**: Propose a new idea or functionality. This allows for feedback before any code is written.
- **Issue/Question**: Ask for help or clarification on any topic related to the project.

### Before You File an Issue

Before submitting an issue, ensure the following:

1. **Correct Repository**: Verify that you are filing the issue in the correct repository within the deco ecosystem.
2. **Existing Issues**: Search through [open issues](./issues) to check if the issue has already been reported or the feature has already been requested.
3. **For Bugs**:
- Confirm that it’s not an environment-specific issue. Ensure all prerequisites (e.g., dependencies, configurations) are met.
- Provide detailed logs, stack traces, or any other relevant data to help diagnose the issue.
4. **For Proposals**:
- Discuss potential features in the appropriate issue to gather feedback before coding.

### Pull Requests

We welcome contributions via pull requests (PRs). Follow this workflow to submit your changes:

1. **Issue Reference**: Ensure there is an issue raised that corresponds to your PR.
2. **Fork and Branch**: Fork the repository and create a new branch for your changes.
3. **Code Changes**:
- Include appropriate tests with your code changes.
- Run linters and format the code according to project standards:
- Run `deno task check`
4. **Documentation**: Update any relevant documentation with your changes.
5. **Commit and PR**: Commit your changes and submit a PR for review.
6. **CI Checks**: Ensure that all Continuous Integration (CI) checks pass successfully.
7. **Review Process**: A maintainer will review your PR, usually within a few days.

#### Work-in-Progress (WIP) PRs

If you’d like early feedback on your work, you can create a PR with the prefix `[WIP]` to indicate that it is still under development and not ready for merging.

### Testing Your Contributions

Since this repository contains integrations that must be tested against a deco site, you cannot test your contributions in isolation. Please refer to this [Helpful content](https://www.notion.so/decocx/Helpful-Community-Content-101eec7ce64f4becaebb685dd9571e24) for instructions on how to set up a deco site for testing purposes.

### Use of Third-Party Code

- Ensure that any third-party code included in your contributions comes with the appropriate licenses.

### Releasing a New Version

We follow semantic versioning, and all apps in this repository are versioned collectively using git tags. To release a new version:

1. Fork the repository and create a pull request with your changes.
2. After the PR is approved and merged, request a maintainer to run the release task:

```sh
deno task release
```
8 changes: 8 additions & 0 deletions MAINTAINERS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
mcandeia
tlgimenes
guitavano
matheusgr
igorbrasileiro
hugo-ccabral
viktormarinho
caroluchoa
Loading

0 comments on commit fa408bf

Please sign in to comment.