Skip to content

Commit

Permalink
fix: adding workflows for the repository (#30)
Browse files Browse the repository at this point in the history
* fix: adding workflows for the repository

* fix: added more workflows

* fix: update the node version

* fix: update the index.js

* chore: some more changes to build the dist

* chore: update the package json with build command without cache

* chore: rebuilt the dist file

* chore: move towards node v20 when executing the action

* chore: remove the engine from package.json
  • Loading branch information
abhimanyubabbar authored Sep 23, 2024
1 parent 5032406 commit cb4a2db
Show file tree
Hide file tree
Showing 10 changed files with 1,111 additions and 660 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/check-dist.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Check dist

on:
push:
branches:
- main
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
workflow_dispatch:

jobs:
check-dist:
runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]

- name: Set Node.js 20.14.x
uses: actions/setup-node@v4
with:
node-version: 20.14.x

- name: Install dependencies
run: npm ci

- name: Rebuild the index.js file
run: npm run build

- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
13 changes: 13 additions & 0 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Lint Commit Messages
on: [pull_request]

permissions:
contents: read
pull-requests: read

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: wagoid/commitlint-github-action@v6
22 changes: 22 additions & 0 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
push:
branches:
- "main"
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- uses: google-github-actions/release-please-action@v3
with:
token: ${{ secrets.PAT }}
pull-request-title-pattern: "chore: release ${version}"
release-type: node
package-name: rudder-transformation-action
default-branch: ${{ steps.extract_branch.outputs.branch }}
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false},{"type":"refactor","section":"Miscellaneous","hidden":false},{"type":"test","section":"Miscellaneous","hidden":false},{"type":"doc","section":"Documentation","hidden":false}]'
bump-minor-pre-major: true
49 changes: 49 additions & 0 deletions .github/workflows/semantic-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "Semantic pull requests"

on: pull_request

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
fix
feat
chore
refactor
exp
doc
test
requireScope: false
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character.
# For work-in-progress PRs you can typically use draft pull requests
# from GitHub. However, private repositories on the free plan don't have
# this option and therefore this action allows you to opt-in to using the
# special "[WIP]" prefix to indicate this state. This will avoid the
# validation of the PR title and the pull request checks remain pending.
# Note that a second check will be reported if this is enabled.
wip: true
# When using "Squash and merge" on a PR with only one commit, GitHub
# will suggest using that commit message instead of the PR title for the
# merge commit, and it's easy to commit this by mistake. Enable this option
# to also validate the commit message for one commit PRs.
validateSingleCommit: true
# Related to `validateSingleCommit` you can opt-in to validate that the PR
# title matches a single commit to avoid confusion.
validateSingleCommitMatchesPrTitle: true
# If the PR contains one of these labels, the validation is skipped.
# Multiple labels can be separated by newlines.
# If you want to rerun the validation when labels change, you might want
# to use the `labeled` and `unlabeled` event triggers in your workflow.
ignoreLabels: |
bot
dependencies
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules/
package-lock.json
.env
.env
coverage/
test-outputs/
Empty file added CHANGELOG.md
Empty file.
44 changes: 22 additions & 22 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
name: 'Rudder Transformation Action'
description: 'Tests transformations and libraries from your repo and publishes them to your Rudderstack workspace'
name: "Rudder Transformation Action"
description: "Tests transformations and libraries from your repo and publishes them to your Rudderstack workspace"
branding:
icon: activity
color: purple
icon: activity
color: purple
inputs:
metaPath:
description: 'File containing metadata about transformation and libraries'
required: true
email:
description: 'Owner email of the workspace'
required: true
accessToken:
description: 'accessToken generated for a workspace'
required: true
serverEndpoint:
description: 'backend url'
required: false
default: 'https://api.rudderstack.com'
uploadTestArtifact:
description: 'Toggle for enabling artifacts'
required: false
metaPath:
description: "File containing metadata about transformation and libraries"
required: true
email:
description: "Owner email of the workspace"
required: true
accessToken:
description: "accessToken generated for a workspace"
required: true
serverEndpoint:
description: "backend url"
required: false
default: "https://api.rudderstack.com"
uploadTestArtifact:
description: "Toggle for enabling artifacts"
required: false
runs:
using: 'node12'
main: 'dist/index.js'
using: "node20"
main: "dist/index.js"
10 changes: 10 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
rules: {
"type-enum": () => [
2,
"always",
["fix", "feat", "chore", "refactor", "docs", "test"],
],
},
};
Loading

0 comments on commit cb4a2db

Please sign in to comment.