Skip to content

Commit

Permalink
feat: initial release (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
prescottprue authored Mar 14, 2024
1 parent 51e83f2 commit e061dc5
Show file tree
Hide file tree
Showing 20 changed files with 5,985 additions and 591 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
.yarn
44 changes: 44 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
module.exports = {
root: true,
extends: [
'@side/base',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:jsdoc/recommended',
],
parser: '@typescript-eslint/parser',
settings: {
'import/extensions': ['.js', '.jsx', '.ts', '.tsx'],
'import/resolver': {
node: {
extensions: ['.js', '.json', '.jsx', '.ts', '.tsx'],
},
typescript: {
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
},
},
},
rules: {
'jsdoc/require-returns-type': 0,
'jsdoc/require-param-type': 0,
quotes: ['error', 'single', { avoidEscape: true }],
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
// Override airbnb extensions settings
// TODO: Move this to lint-config base
// Ensure consistent use of file extension within the import path
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
mjs: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
},
overrides: [],
};
6 changes: 6 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# https://github.com/orgs/reside-eng/teams/core/members
* @reside-eng/platform-tools

# Skip assigning dep updates (handled by Renovate)
package.json
yarn.lock
112 changes: 112 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Release

on:
push:
branches:
- main
- next
- next-major
- alpha
- beta
# N.x (maintenance release branches)
- '[0-9]+.x'

concurrency:
group: release-${{ github.ref }}

env:
NODE_VERSION: 20.x

jobs:
publish:
name: publish
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'

- name: Configure package manager
run: |
echo Configuring NPM_TOKEN globally for .npmrc
npm config set '//registry.npmjs.org/:_authToken' ${{ env.NPM_TOKEN }}
npm whoami
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Verify formatting
run: yarn format:check

- name: Lint
run: yarn lint

# - name: Test
# run: yarn test --coverage --silent

# - name: Upload coverage to Coveralls
# uses: coverallsapp/[email protected]
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build
run: yarn build

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
id: semantic
with:
semantic_version: ^18
branches: |
[
'+([0-9])?(.{+([0-9]),x}).x',
'main',
'next',
'next-major',
{name: 'beta', prerelease: true},
{name: 'alpha', prerelease: true}
]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Push updates to branch for major version
# If a new version is published, i.e. v1.2.3 then this step will update
# branch "v1" to this commit.
# https://github.com/reside-eng/npm-dependency-stats-action/branches
# The dist folder (built) is included so that action can be used directly from Github
# ref (where exact versions can pull from npm)
if: steps.semantic.outputs.new_release_published == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NOTE: Git user must be set in order for amend of commit to add dist folder
# --force is used because dist is within gitignore
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add --force dist
git commit -C HEAD --amend
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:refs/heads/v${{steps.semantic.outputs.new_release_major_version}}
notification:
if: always()
name: notification
needs: [publish]
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- uses: technote-space/[email protected]

- uses: reside-eng/[email protected]
with:
current-status: ${{ env.WORKFLOW_CONCLUSION }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK_PLATFORM_PROD }}
github-token: ${{ secrets.GITHUB_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Verify

on: [pull_request]

env:
NODE_VERSION: 20.x

jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Verify formatting
run: yarn format:check

- name: Lint
run: yarn lint

# - name: Test
# run: yarn test --coverage --silent

# - name: Upload coverage to Coveralls
# uses: coverallsapp/[email protected]
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build
run: yarn build
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
node_modules
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
Empty file removed .npmrc
Empty file.
893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.1.1.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
yarnPath: .yarn/releases/yarn-4.1.1.cjs

nodeLinker: node-modules
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Replace Comment HTML
# Replace Comment HTML Action

This action upserts HTML in GitHub issue or pull request comments using CSS selectors.

Expand All @@ -23,10 +23,10 @@ jobs:
# ... steps to deploy preview envionment ...

# Create a comment with an empty table
- uses: htunnicliff/replace-comment-html@v1
- uses: reside-eng/replace-comment-html-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
selector: "#preview-links"
selector: '#preview-links'
mode: create-only # This will create the table if it doesn't exist
html: |
<table id="preview-links">
Expand All @@ -44,8 +44,8 @@ jobs:
- uses: htunnicliff/replace-comment-html@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
parent-selector: "#preview-links tbody" # Append this row to the <tbody>
selector: "tr#preview-link-${{ matrix.env }}"
parent-selector: '#preview-links tbody' # Append this row to the <tbody>
selector: 'tr#preview-link-${{ matrix.env }}'
mode: upsert # This will update the row if it exists, or create it if it doesn't
html: |
<tr id="preview-link-${{ matrix.env }}">
Expand Down Expand Up @@ -112,3 +112,7 @@ If this workflow runs again and a row exists with the given CSS selector, it wil
| `comment-id` | The ID of the comment that was created or updated |

[PAT]: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token

## Credits

This repo was forked from [htunnicliff/replace-comment-html](https://github.com/htunnicliff/replace-comment-html) made by [@htunnicliff](https://github.com/htunnicliff)
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ inputs:
description: The issue or pull request to operate on
default: ${{ github.event.number || github.event.issue.number }}
mode:
description: "Which strategy to use for modifying comments: upsert (default), create-only"
description: 'Which strategy to use for modifying comments: upsert (default), create-only'
default: upsert
html:
description: HTML to create or update
Expand Down
3 changes: 3 additions & 0 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@side/commitlint-config'],
};
4 changes: 2 additions & 2 deletions dist/index.js

Large diffs are not rendered by default.

Loading

0 comments on commit e061dc5

Please sign in to comment.