Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishkurmi committed Dec 3, 2023
1 parent b939b8c commit a5191d3
Show file tree
Hide file tree
Showing 27 changed files with 20,782 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist/
lib/
node_modules/
jest.config.js
77 changes: 77 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"plugins": [
"jest",
"@typescript-eslint"
],
"extends": [
"plugin:github/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"github/array-foreach": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
"accessibility": "no-public"
}
],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowExpressions": true
}
],
"@typescript-eslint/func-call-spacing": [
"error",
"never"
],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/semi": [
"error",
"never"
],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/** -diff linguist-generated=true
52 changes: 52 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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, sex characteristics, 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 protected].
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

For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'daily'
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
49 changes: 49 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
repository:
name: semver-utils
description: One-stop shop for working with semantic versions in your GitHub Actions workflows
topics: github-actions, actions, semver, semantic-versions, utils
private: false
has_wiki: false
has_issues: true
has_projects: false
default_branch: main
allow_merge_commit: true
allow_squash_merge: false
allow_rebase_merge: true
labels:
- name: bug
color: '#D73A4A'
description: Something isn't working
- name: chore
color: '#C49307'
description: Boring, unpleasant, but easy tasks
- name: CI/CD
color: '#95CD57'
description: Continious integration & delivery
- name: dependencies
color: '#0366D6'
description: Pull requests that update a dependency file
- name: documentation
color: '#0075CA'
description: Improvements or additions to documentation
- name: duplicate
color: '#CFD3D7'
description: This issue or pull request already exists
- name: enhancement
color: '#A2EEEF'
description: New feature or request
- name: good first issue
color: '#7057FF'
description: Good for newcomers
- name: help wanted
color: '#008672'
description: Extra attention is needed
- name: invalid
color: '#E4E669'
description: This doesn't seem right
- name: question
color: '#D876E3'
description: Further information is requested
- name: wontfix
color: '#FFFFFF'
description: This will not be worked on
106 changes: 106 additions & 0 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Default

on:
push:
branches-ignore:
- main

jobs:
default:
name: Default
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- run: npm install
- run: npm run all

- uses: ./
id: test-1
with:
version: wrong
lenient: false
continue-on-error: true
- run: '[[ "failure" == "${{ steps.test-1.outcome }}" ]]'
- run: '[[ "success" == "${{ steps.test-1.conclusion }}" ]]'

- uses: ./
id: test-2
with:
version: wrong
lenient: 'false'
continue-on-error: true
- run: '[[ "failure" == "${{ steps.test-2.outcome }}" ]]'
- run: '[[ "success" == "${{ steps.test-2.conclusion }}" ]]'

- uses: ./
id: test-3
with:
version: wrong
- run: '[[ "" == "${{ steps.test-3.outputs.release }}" ]]'
- run: '[[ "" == "${{ steps.test-3.outputs.major }}" ]]'
- run: '[[ "" == "${{ steps.test-3.outputs.minor }}" ]]'
- run: '[[ "" == "${{ steps.test-3.outputs.patch }}" ]]'
- run: '[[ "" == "${{ steps.test-3.outputs.any_other_property }}" ]]'

- uses: ./
id: test-4
with:
version: wrong
lenient: true
- run: '[[ "" == "${{ steps.test-4.outputs.release }}" ]]'
- run: '[[ "" == "${{ steps.test-4.outputs.major }}" ]]'
- run: '[[ "" == "${{ steps.test-4.outputs.minor }}" ]]'
- run: '[[ "" == "${{ steps.test-4.outputs.patch }}" ]]'
- run: '[[ "" == "${{ steps.test-4.outputs.any_other_property }}" ]]'

- uses: ./
id: test-5
with:
version: 1.2.3-alpha.gamma+4.5.6
- run: '[[ "1.2.3" == "${{ steps.test-5.outputs.release }}" ]]'
- run: '[[ "1" == "${{ steps.test-5.outputs.major }}" ]]'
- run: '[[ "2" == "${{ steps.test-5.outputs.minor }}" ]]'
- run: '[[ "3" == "${{ steps.test-5.outputs.patch }}" ]]'
- run: '[[ "alpha.gamma" == "${{ steps.test-5.outputs.prerelease }}" ]]'
- run: '[[ "2" == "${{ steps.test-5.outputs.prerelease-parts }}" ]]'
- run: '[[ "alpha" == "${{ steps.test-5.outputs.prerelease-0 }}" ]]'
- run: '[[ "gamma" == "${{ steps.test-5.outputs.prerelease-1 }}" ]]'
- run: '[[ "4.5.6" == "${{ steps.test-5.outputs.build }}" ]]'
- run: '[[ "3" == "${{ steps.test-5.outputs.build-parts }}" ]]'
- run: '[[ "4" == "${{ steps.test-5.outputs.build-0 }}" ]]'
- run: '[[ "5" == "${{ steps.test-5.outputs.build-1 }}" ]]'
- run: '[[ "6" == "${{ steps.test-5.outputs.build-2 }}" ]]'

- uses: ./
id: test-6
with:
version: 1.0.0
compare-to: 2.0.0
- run: '[[ "<" == "${{ steps.test-6.outputs.comparison-result }}" ]]'

- uses: ./
id: test-7
with:
version: 1.2.3
satisfies: 1.x
- run: '[[ "true" == "${{ steps.test-7.outputs.satisfies }}" ]]'

- uses: ./
id: test-8
with:
version: 1.2.3
- run: '[[ "2.0.0" == "${{ steps.test-8.outputs.inc-major }}" ]]'
- run: '[[ "2.0.0-0" == "${{ steps.test-8.outputs.inc-premajor }}" ]]'
- run: '[[ "1.3.0" == "${{ steps.test-8.outputs.inc-minor }}" ]]'
- run: '[[ "1.3.0-0" == "${{ steps.test-8.outputs.inc-preminor }}" ]]'
- run: '[[ "1.2.4" == "${{ steps.test-8.outputs.inc-patch }}" ]]'
- run: '[[ "1.2.4-0" == "${{ steps.test-8.outputs.inc-prepatch }}" ]]'
- run: '[[ "1.2.4-0" == "${{ steps.test-8.outputs.inc-prerelease }}" ]]'

actions-typing:
name: Validate actions typing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: krzema12/github-actions-typing@v1
32 changes: 32 additions & 0 deletions .github/workflows/pr_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: PR to main

on:
pull_request:
branches:
- main

jobs:
pr_main:
name: PR to main
runs-on: ubuntu-latest
if: ${{ github.event.sender.login != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.base.sha }}

- run: node -p "'version=' + require('./package.json').version" >> $GITHUB_OUTPUT
id: base-version

- uses: actions/checkout@v3

- run: node -p "'version=' + require('./package.json').version" >> $GITHUB_OUTPUT
id: new-version

- uses: step-security/semver-utils@v1
id: comparison
with:
version: ${{ steps.new-version.outputs.version }}
compare-to: ${{ steps.base-version.outputs.version }}

- run: '[[ ">" == "${{ steps.comparison.outputs.comparison-result }}" ]]'
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release new action version
on:
workflow_dispatch:
inputs:
TAG_NAME:
description: 'Tag name that the major tag will point to'
required: true

env:
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
defaults:
run:
shell: pwsh

permissions:
contents: read

jobs:
update_tag:
name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} changes
# Remember to configure the releaseNewActionVersion environment with required approvers in the repository settings
environment:
name: releaseNewActionVersion
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423
with:
egress-policy: audit

- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11

- name: Update the ${{ env.TAG_NAME }} tag
uses: step-security/publish-action@00f33a2a7d8b77187d08ce666d0d5d73ad1dfb93
with:
source-tag: ${{ env.TAG_NAME }}
Loading

0 comments on commit a5191d3

Please sign in to comment.