-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from zendesk/victor.piolin/update-readme
chore: Update README files
- Loading branch information
Showing
11 changed files
with
376 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @zendesk/zendesk-labs @tristan-vu @cuneytcelebican @Vico1993 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: ".github/workflows" | ||
schedule: | ||
interval: weekly | ||
day: monday | ||
labels: | ||
- "dependabot" | ||
- package-ecosystem: npm | ||
directory: / | ||
schedule: | ||
interval: weekly | ||
day: monday | ||
labels: | ||
- "dependabot" | ||
- "version: Patch" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## Expectations | ||
|
||
<!-- | ||
I showed up, expecting to have my mind blown. | ||
--> | ||
|
||
## Reality | ||
|
||
<!-- | ||
But all I got was this lousy {insert screenshot}. | ||
--> | ||
|
||
## Steps to Reproduce | ||
|
||
1. | ||
1. | ||
1. | ||
|
||
### Issue details | ||
|
||
- Command: <!-- zcli apps server --> | ||
- Version: <!-- your issue might already be fixed with the latest version --> | ||
- OS: <!-- windows, ubuntu, mac or all --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
## Description | ||
|
||
<!-- What did you change in this PR --> | ||
|
||
<!-- If this is a UI change, please add some screenshots of the change using the <details><summary></summary></details> tags --> | ||
|
||
## How to manually test | ||
|
||
<!-- Which steps need to be followed to test your changes. See example below --> | ||
|
||
1. Install version x.x.x | ||
2. Use service ... | ||
3. ... | ||
|
||
## Include label | ||
|
||
<!-- What kind of change do you want to bring --> | ||
|
||
We are following [this pattern](https://semver.org/) to keep our package version updated. Please add the appropriate label to your Pull requests between the following: | ||
|
||
- Version: Major | ||
- Version: Minor | ||
- Version: Patch | ||
|
||
## Acceptation criteria | ||
|
||
<!-- Bullet point list to validate you did not missed anything. Please add the acceptation criterias for your issue. --> | ||
|
||
- [ ] Added the corrected label to my pull request | ||
- [ ] Added/updated tests impacted by the change | ||
- [ ] Documentation is up-to-date (README.md / INSTALL.md) | ||
- [ ] Manually tested? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Bump server version | ||
on: | ||
pull_request: | ||
paths: | ||
- "src/*" | ||
- "**.yaml" | ||
- "**.ts" | ||
- "**.json" | ||
- "!.github/*" | ||
types: | ||
- unlabeled | ||
- labeled | ||
- synchronize | ||
- opened | ||
- reopened | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
jobs: | ||
bump-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: zendesk/checkout@v4 | ||
|
||
- name: Bump version | ||
uses: zendesk/[email protected] | ||
with: | ||
file_path: "package.json" | ||
comment: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Main workflow | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "src/*" | ||
- "**.json" | ||
jobs: | ||
get_version: | ||
name: Retrieve version | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.package_version.outputs.version }} | ||
steps: | ||
- uses: zendesk/checkout@v4 | ||
- name: Get Package version | ||
id: package_version | ||
run: | | ||
echo "Reading package.json" | ||
PACKAGE_VERSION=$(cat ./package.json | jq '.version' | tr -d '"') | ||
echo "version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT | ||
create-release: | ||
name: Create release | ||
runs-on: ubuntu-latest | ||
needs: | ||
- get_version | ||
env: | ||
VERSION: ${{ needs.get_version.outputs.version }} | ||
GH_TOKEN: ${{ github.token }} | ||
steps: | ||
- name: Create release | ||
run: | | ||
gh release create ${{ env.VERSION }} -R '${{ github.repository }}' --generate-notes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Size a PR | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
pr_size: | ||
name: Label the PR size | ||
runs-on: ubuntu-latest | ||
if: always() | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: zendesk/checkout@v4 | ||
|
||
- uses: zendesk/pr-size-labeler@main | ||
with: | ||
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} | ||
xs_label: "size: XS" | ||
xs_max_size: "10" | ||
s_label: "size: S" | ||
s_max_size: "100" | ||
m_label: "size: M" | ||
m_max_size: "250" | ||
l_label: "size: L" | ||
l_max_size: "500" | ||
xl_label: "size: XL" | ||
fail_if_xl: "true" | ||
message_if_xl: > | ||
This PR is so big! Please, split it 😊 | ||
# We can't exclude folder for now (ref: https://github.com/CodelyTV/pr-size-labeler/issues/38) | ||
# If we want to exclude a file we don't need to include the path. Just the fileName is enough. | ||
# Instead of "./server/openapi/oas-1.yml OR ./openapi/oas-1.yml" JUST "oas-1.yml" is enough | ||
files_to_ignore: "package-lock.json" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
name: Lint, build, test | ||
on: | ||
pull_request: | ||
paths: | ||
- ".prettierrc" | ||
- "**.ts" | ||
- "**.json" | ||
- "openapi/*.yaml" | ||
jobs: | ||
pre_workflow: | ||
name: Pre-workflow clean up | ||
runs-on: ubuntu-latest | ||
if: github.event.action == 'synchronize' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
- name: Dismiss Bot review | ||
run: | | ||
reviews=$( gh api /repos/${{ github.repository }}/pulls/${{ github.event.number }}/reviews | jq -r '.[] | if (.state == "APPROVED" and .user.type == "Bot") then .id else empty end' ) | ||
for reviewId in $reviews | ||
do | ||
gh api --method PUT /repos/${{ github.repository }}/pulls/${{ github.event.number }}/reviews/$reviewId/dismissals -f message="Dismiss bot." -f event="DISMISS" --silent | ||
done | ||
- name: Clean Bot comment | ||
run: | | ||
# Find all comments in the pr | ||
comments=$( gh api /repos/${{ github.repository }}/issues/${{ github.event.number }}/comments | jq -r '.[] | if .user.login == "github-actions[bot]" then .id else empty end' ) | ||
for commentId in $comments | ||
do | ||
gh api --method DELETE /repos/${{ github.repository }}/issues/comments/$commentId --silent | ||
done | ||
- name: Checkout code | ||
uses: zendesk/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Check if we need to remove the approvals | ||
if: ${{ github.event.before != github.event.after && github.event.before != '' }} | ||
run: | | ||
# Capture all commits from head to previous commit | ||
# Convert output to an array of commit hashes | ||
# Iterate through each commit | ||
commits=$( git rev-list --ancestry-path ${{ github.event.before }}..${{ github.event.after }} ) | ||
readarray -t commit_hashes <<< "$commits" | ||
for commit_hash in "${commit_hashes[@]}"; do | ||
# Getting the commit | ||
commit=$( gh api /repos/${{ github.repository }}/commits/$commit_hash ) | ||
# Type of User who trigger the update | ||
committerType=$(jq -r -n --argjson data "$commit" '$data.committer.type') | ||
# Number of parents the commit has | ||
# 1 parent, classic commit | ||
# 2 parent it's a merge commit | ||
parentLength=$(jq -n --argjson data "$commit" '$data.parents | length') | ||
# Dismiss Logic | ||
# If it's a User that push a commit we dismiss | ||
# Break out of the loop if it's a user commit | ||
# Everything else we don't ( Bot pushed / Bot merged / User Merged ) | ||
if [[ $committerType == "User" && $parentLength == 1 ]]; then | ||
# Bot is going to list all review and dismiss one by one | ||
# And get id from review who approved the change | ||
reviews=$( gh api /repos/${{ github.repository }}/pulls/${{ github.event.number }}/reviews | jq -r '.[] | if .state == "APPROVED" then .id else empty end' ) | ||
# For each reviewId we need to dismiss | ||
for reviewId in $reviews | ||
do | ||
gh api --method PUT /repos/${{ github.repository }}/pulls/${{ github.event.number }}/reviews/$reviewId/dismissals -f message="Please, I need your help and look at this code again! :eyes:" -f event="DISMISS" --silent | ||
done | ||
break | ||
fi | ||
done | ||
lint: | ||
name: Lint the API | ||
runs-on: ubuntu-latest | ||
outputs: | ||
job_name: "Lint and verify code formatting in the API" | ||
steps: | ||
- uses: zendesk/checkout@v4 | ||
- uses: zendesk/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: "npm" | ||
cache-dependency-path: "package-lock.json" | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Execute linter | ||
run: npm run lint | ||
- name: Validate code format with prettier | ||
run: npm run prettier | ||
build: | ||
name: Build package | ||
runs-on: ubuntu-latest | ||
outputs: | ||
job_name: "Build package" | ||
steps: | ||
- uses: zendesk/checkout@v4 | ||
- uses: zendesk/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: "npm" | ||
cache-dependency-path: "package-lock.json" | ||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build the application | ||
run: npm run build | ||
test: | ||
name: Execute tests | ||
runs-on: ubuntu-latest | ||
outputs: | ||
job_name: "Execute tests" | ||
steps: | ||
- uses: zendesk/checkout@v4 | ||
- uses: zendesk/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: "npm" | ||
cache-dependency-path: "package-lock.json" | ||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Execute the tests | ||
run: npm run test:ci | ||
pr_review: | ||
name: Bot reviewer | ||
if: always() | ||
needs: | ||
- pre_workflow | ||
- lint | ||
- build | ||
- test | ||
runs-on: ubuntu-latest | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
- name: Failure -> Request changes | ||
if: ${{ needs.build.result == 'failure' || needs.lint.result == 'failure' }} | ||
env: | ||
MSG_FILE: "msg.txt" | ||
JOBS_REQUEST_FILE: "jobs_rq.json" | ||
run: | | ||
gh api /repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs --paginate >> ${{ env.JOBS_REQUEST_FILE }} | ||
echo "Sorry...:sweat: The following steps failed:" >> ${{ env.MSG_FILE }} | ||
if [[ "${{ needs.build.result }}" == "failure" ]]; then | ||
url=$(jq -r --arg job_name "${{ needs.build.outputs.job_name }}" '.jobs | map(select(.name == $job_name)) | .[0].html_url' ${{ env.JOBS_REQUEST_FILE }}) | ||
echo " * [${{ needs.build.outputs.job_name }}]($url)" >> ${{ env.MSG_FILE }}; | ||
fi | ||
if [[ "${{ needs.lint.result }}" == "failure" ]]; then | ||
url=$(jq -r --arg job_name "${{ needs.lint.outputs.job_name }}" '.jobs | map(select(.name == $job_name)) | .[0].html_url' ${{ env.JOBS_REQUEST_FILE }}) | ||
echo " * [${{ needs.lint.outputs.job_name }}]($url)" >> ${{ env.MSG_FILE }}; | ||
fi | ||
if [[ "${{ needs.test.result }}" == "failure" ]]; then | ||
url=$(jq -r --arg job_name "${{ needs.test.outputs.job_name }}" '.jobs | map(select(.name == $job_name)) | .[0].html_url' ${{ env.JOBS_REQUEST_FILE }}) | ||
echo " * [${{ needs.test.outputs.job_name }}]($url)" >> ${{ env.MSG_FILE }}; | ||
fi | ||
gh pr review ${{ github.event.pull_request.number }} -r -F ${{ env.MSG_FILE }} -R ${{ github.repository }} | ||
- name: Succeed -> Approve changes | ||
if: ${{ needs.build.result == 'success' && needs.lint.result == 'success' }} | ||
run: | | ||
gh pr review ${{ github.event.pull_request.number }} -a -b "LGTM! :robot: :rocket: :fire:" -R ${{ github.repository }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Release package workflow | ||
on: | ||
release: | ||
types: | ||
- released | ||
jobs: | ||
release: | ||
name: Release package on Github Packages | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- uses: zendesk/checkout@v4 | ||
- uses: zendesk/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: "npm" | ||
cache-dependency-path: "package-lock.json" | ||
registry-url: https://npm.pkg.github.com/ | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Build package | ||
run: npm run build | ||
- name: Publish to Github Packages | ||
run: npm publish --access restricted | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.