-
Notifications
You must be signed in to change notification settings - Fork 0
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 juspay/worklows-added
ci: added worklows
- Loading branch information
Showing
6 changed files
with
260 additions
and
0 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 @@ | ||
- @ArushKapoorJuspay @PritishBudhiraja @seekshiva |
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,67 @@ | ||
## Type of Change | ||
|
||
<!-- Put an `x` in the boxes that apply --> | ||
|
||
- [ ] Bugfix | ||
- [ ] New feature | ||
- [ ] Enhancement | ||
- [ ] Refactoring | ||
- [ ] Dependency updates | ||
- [ ] Documentation | ||
- [ ] CI/CD | ||
|
||
--- | ||
|
||
## **Description** | ||
|
||
<!-- Describe your changes in detail --> | ||
<!-- Mention any relevant issues or feature requests (e.g., Fixes #123 or Implements #456) --> | ||
|
||
--- | ||
|
||
## **How did you test it?** | ||
|
||
<!-- | ||
Provide detailed information on testing: | ||
- Did you add or update unit tests? | ||
- How did you manually verify the changes (e.g., screenshots, console logs)? | ||
- Have you verified it works in consuming projects? | ||
--> | ||
|
||
--- | ||
|
||
## **Usage Notes** | ||
|
||
<!-- Provide information about how this change impacts package consumers: | ||
- Are there breaking changes? | ||
- Any new APIs or configuration options added? | ||
- Backward compatibility ensured? | ||
--> | ||
|
||
--- | ||
|
||
## **Version Update** | ||
|
||
- [ ] I have bumped the package version in `package.json` following semantic versioning: | ||
- `x.x.x` for major changes (breaking). | ||
- `x.x.x` for minor changes (new feature, no breaking changes). | ||
- `x.x.x` for patch changes (bug fixes, minor improvements). | ||
|
||
--- | ||
|
||
## **Checklist** | ||
|
||
<!-- Put an `x` in the boxes that apply --> | ||
|
||
- [ ] I ran `npm run re:build` and verified the build artifacts. | ||
- [ ] I reviewed the code for style, readability, and consistency. | ||
- [ ] I verified the changes are backward compatible (if applicable). | ||
- [ ] I tested this change in a real or simulated consuming project. | ||
- [ ] I updated documentation, README, or usage examples if necessary. | ||
|
||
--- | ||
|
||
## **Screenshots or Logs** | ||
|
||
<!-- Add relevant screenshots, console logs, or output to help reviewers understand the change --> | ||
<!-- Optional, remove if not applicable --> |
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,36 @@ | ||
name: CI/CD Pipeline | ||
|
||
on: | ||
pull_request: | ||
merge_group: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.AUTORELEASE_PAT || github.token }} | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "20" | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Display Node.js version | ||
run: node --version | ||
|
||
- name: "Rescript Code Compile" | ||
run: npm run re:build | ||
|
||
- name: "Build" | ||
run: npm run build |
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,86 @@ | ||
name: Conventional Commit Message Check | ||
|
||
on: | ||
# This is a dangerous event trigger as it causes the workflow to run in the | ||
# context of the target repository. | ||
# Avoid checking out the head of the pull request or building code from the | ||
# pull request whenever this trigger is used. | ||
# Since we only label pull requests, do not have a checkout step in this | ||
# workflow, and restrict permissions on the token, this is an acceptable | ||
# use of this trigger. | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- reopened | ||
- ready_for_review | ||
- synchronize | ||
|
||
merge_group: | ||
types: | ||
- checks_requested | ||
|
||
permissions: | ||
# Reference: https://github.com/cli/cli/issues/6274 | ||
repository-projects: read | ||
pull-requests: write | ||
|
||
env: | ||
# Allow more retries for network requests in cargo (downloading crates) and | ||
# rustup (installing toolchains). This should help to reduce flaky CI failures | ||
# from transient network timeouts or other issues. | ||
CARGO_NET_RETRY: 10 | ||
RUSTUP_MAX_RETRIES: 10 | ||
# Use cargo's sparse index protocol | ||
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | ||
|
||
jobs: | ||
pr_title_check: | ||
name: Verify PR title follows conventional commit standards | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: stable 2 weeks ago | ||
|
||
- uses: baptiste0928/[email protected] | ||
with: | ||
crate: cocogitto | ||
|
||
- name: Verify PR title follows conventional commit standards | ||
id: pr_title_check | ||
if: ${{ github.event_name == 'pull_request_target' }} | ||
shell: bash | ||
env: | ||
TITLE: ${{ github.event.pull_request.title }} | ||
continue-on-error: true | ||
run: cog verify "$TITLE" | ||
|
||
- name: Verify commit message follows conventional commit standards | ||
id: commit_message_check | ||
if: ${{ github.event_name == 'merge_group' }} | ||
shell: bash | ||
# Fail on error, we don't have context about PR information to update labels | ||
continue-on-error: false | ||
run: cog verify '${{ github.event.merge_group.head_commit.message }}' | ||
|
||
# GitHub CLI returns a successful error code even if the PR has the label already attached | ||
- name: Attach 'S-conventions-not-followed' label if PR title check failed | ||
if: ${{ github.event_name == 'pull_request_target' && steps.pr_title_check.outcome == 'failure' }} | ||
shell: bash | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
gh --repo ${{ github.event.repository.full_name }} pr edit --add-label 'S-conventions-not-followed' ${{ github.event.pull_request.number }} | ||
echo "::error::PR title does not follow conventional commit standards" | ||
exit 1 | ||
# GitHub CLI returns a successful error code even if the PR does not have the label attached | ||
- name: Remove 'S-conventions-not-followed' label if PR title check succeeded | ||
if: ${{ github.event_name == 'pull_request_target' && steps.pr_title_check.outcome == 'success' }} | ||
shell: bash | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: gh --repo ${{ github.event.repository.full_name }} pr edit --remove-label 'S-conventions-not-followed' ${{ github.event.pull_request.number }} |
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: Update PR Label to Closed | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
pr-label: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Remove all labels | ||
run: | | ||
PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") | ||
curl -L \ | ||
-X DELETE \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/labels | ||
- name: Add new label | ||
run: | | ||
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} | ||
gh pr edit ${{ github.event.pull_request.number }} --add-label "Closed" |
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,40 @@ | ||
name: PR Title Spell Check | ||
|
||
on: | ||
merge_group: | ||
pull_request: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
typos: | ||
name: Spell check PR title | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Store PR title in a file | ||
shell: bash | ||
env: | ||
TITLE: ${{ github.event.pull_request.title }} | ||
run: echo $TITLE > pr_title.txt | ||
|
||
- name: Spell check | ||
uses: crate-ci/typos@master | ||
with: | ||
files: ./pr_title.txt | ||
|
||
- name: Assign to author | ||
run: | | ||
PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") | ||
curl -L \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/assignees \ | ||
-d '{"assignees":["${{ github.event.pull_request.user.login }}"]}' |