-
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.
- Loading branch information
0 parents
commit f4c48c5
Showing
57 changed files
with
31,938 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,19 @@ | ||
const YAML = require("yaml"); | ||
const tablemark = require("tablemark"); | ||
const fs = require("fs"); | ||
|
||
const file = fs.readFileSync("./action.yml", "utf8"); | ||
|
||
const yml = YAML.parse(file); | ||
const table = []; | ||
|
||
Object.keys(yml.inputs).forEach((input) => { | ||
table.push({ | ||
input, | ||
required: yml.inputs[input] && yml.inputs[input].required ? "yes" : "", | ||
default: yml.inputs[input] && yml.inputs[input].default ? yml.inputs[input].default : "", | ||
description: yml.inputs[input] && yml.inputs[input].description ? yml.inputs[input].description : "", | ||
}); | ||
}); | ||
|
||
fs.writeFileSync("./docs/inputs.md", tablemark(table)); |
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,27 @@ | ||
# This script is used for repos that need to commit a build folder (eg. Github actions) | ||
|
||
# Add more sources/destinations by separating them by spaces (ie. source="src lib") | ||
source="src" | ||
build="dist" | ||
|
||
# If some changes in $source are staged | ||
if [[ $(git status --porcelain $source | egrep '^M') ]] | ||
|
||
then | ||
|
||
# Run build command | ||
echo "Verifying $build is built and committed..." | ||
yarn build -q | ||
|
||
# If this generated unstaged changes in $build folder(s) | ||
if [[ $(git status --porcelain $build | egrep '^(([M ]M)|\?\?)') ]] | ||
|
||
then | ||
|
||
yarn test | ||
git add $build | ||
echo "ℹ️ Added $build to your commit" | ||
|
||
fi | ||
|
||
fi |
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,55 @@ | ||
{ | ||
"enable": { | ||
"scopes": false, | ||
"customScopes": true | ||
}, | ||
"sentenceCase": { | ||
"type": true, | ||
"scope": false, | ||
"subject": true | ||
}, | ||
"types": [ | ||
{ | ||
"name": "feat", | ||
"description": "feat: A new feature", | ||
"logSection": "Features", | ||
"releaseType": "minor", | ||
"allowBreakingChange": true | ||
}, | ||
{ | ||
"name": "fix", | ||
"description": "fix: A bug fix", | ||
"logSection": "Bug Fixes", | ||
"releaseType": "patch", | ||
"allowBreakingChange": true | ||
}, | ||
{ | ||
"name": "perf", | ||
"description": "perf: A code change that improves performance", | ||
"releaseType": "patch", | ||
"allowBreakingChange": true | ||
}, | ||
{ | ||
"name": "docs", | ||
"description": "docs: Documentation only changes" | ||
}, | ||
{ | ||
"name": "chore", | ||
"description": "chore: Changes to the build process or auxiliary tools", | ||
"scopeOverrides": ["build", "ci"] | ||
}, | ||
{ | ||
"name": "style", | ||
"description": "style: Changes that do not affect the meaning of the code\n (white-space, formatting, missing semi-colons, etc)" | ||
}, | ||
{ | ||
"name": "refactor", | ||
"description": "refactor: A code change that neither fixes a bug nor adds a feature" | ||
}, | ||
{ | ||
"name": "test", | ||
"description": "test: Adding missing tests" | ||
} | ||
], | ||
"scopes": ["parser", "lang"] | ||
} |
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,26 @@ | ||
# This script is used for repos that need to commit a build folder (eg. Github actions) | ||
|
||
# Add more sources/destinations by separating them by spaces (ie. source="src lib") | ||
source="action.yml" | ||
build="docs/inputs.md" | ||
|
||
# If some changes in $source are staged | ||
if [[ $(git status --porcelain $source | egrep '^M') ]] | ||
|
||
then | ||
|
||
# Run build command | ||
echo "Generating $build..." | ||
node .config/autodoc.js | ||
|
||
# If this generated unstaged changes in $build folder(s) | ||
if [[ $(git status --porcelain $build | egrep '^(([M ]M)|\?\?)') ]] | ||
|
||
then | ||
|
||
git add $build | ||
echo "ℹ️ Added $build to your commit" | ||
|
||
fi | ||
|
||
fi |
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 @@ | ||
/** | ||
* This configuration is based on the content of cz-config.js | ||
* Check it out first before modifying this file | ||
*/ | ||
|
||
const { types, scopes, scopeOverrides, allowCustomScopes, upperCaseSubject } = require(__dirname + "/cz-config.js"); | ||
|
||
/** | ||
* Types | ||
*/ | ||
|
||
// Determine if types should be sentence-case based on wether the first type is | ||
const upperCaseType = types[0].value.charAt(0).toUpperCase() === types[0].value.charAt(0); | ||
|
||
// Determine valid types | ||
const validTypes = types.map((type) => type.value); | ||
|
||
/** | ||
* Scopes | ||
*/ | ||
|
||
// Valid scopes are any of scopes and scopes overrides | ||
let validScopes = scopes.map((scope) => scope.name); | ||
Object.keys(scopeOverrides).forEach((k) => Array.prototype.push.apply(validScopes, scopeOverrides[k])); | ||
|
||
// If custom scopes are not allowed, throw an error | ||
// Otherwise only warn if the commit contains a custom scope | ||
const scopeValidationLevel = allowCustomScopes ? 1 : 2; | ||
|
||
module.exports = { | ||
extends: ["@commitlint/config-conventional"], | ||
|
||
// Add your own rules. See https://commitlint.js.org/#/reference-rules | ||
rules: { | ||
"scope-enum": [scopeValidationLevel, "always", validScopes], | ||
"type-enum": [2, "always", validTypes], | ||
"subject-case": upperCaseSubject ? [1, "always", ["sentence-case"]] : undefined, | ||
"type-case": upperCaseType ? [1, "always", ["sentence-case"]] : undefined, | ||
}, | ||
}; |
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,47 @@ | ||
/** | ||
* Configuration file for commitizen customizable preset | ||
* https://github.com/leonardoanalista/cz-customizable#options | ||
* https://github.com/leonardoanalista/cz-customizable/blob/master/cz-config-EXAMPLE.js | ||
*/ | ||
|
||
// Import your custom convention configuration | ||
const convention = require(__dirname + '/commit-convention.json') | ||
|
||
// Enforce convention's sentence case settings | ||
const sentenceCase = (str, sentenceCase = true) => | ||
str.replace(/^./, sentenceCase ? str[0].toUpperCase() : str[0].toLowerCase()) | ||
|
||
// Types | ||
const types = convention.types.map(({ name, description }) => ({ | ||
value: sentenceCase(name, convention.sentenceCase.type), | ||
name: sentenceCase(description, convention.sentenceCase.type), | ||
})) | ||
|
||
// Scopes | ||
const scopes = convention.scopes.map((name) => ({ | ||
name: sentenceCase(name, convention.sentenceCase.scope), | ||
})) | ||
|
||
const scopeOverrides = {} | ||
const allowBreakingChanges = [] | ||
|
||
convention.types.forEach(({ name, scopeOverrides, allowBreakingChange }) => { | ||
// Types that can contain breaking changes | ||
if (allowBreakingChange === true) allowBreakingChanges.push(name) | ||
|
||
// Types with scopes overrides | ||
if (Array.isArray(scopeOverrides)) | ||
scopeOverrides[name] = scopeOverrides.map((scope) => | ||
sentenceCase(scope, convention.sentenceCase.scope) | ||
) | ||
}) | ||
|
||
module.exports = { | ||
types, | ||
scopes, | ||
scopeOverrides, | ||
allowBreakingChanges, | ||
allowCustomScopes: convention.enable.customScopes, | ||
skipQuestions: [convention.enable.scopes ? '' : 'scope'], | ||
upperCaseSubject: convention.sentenceCase.subject, | ||
} |
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,55 @@ | ||
// Import your custom convention configuration | ||
const convention = require(__dirname + "/commit-convention.json"); | ||
|
||
// Enforce convention's sentence case settings | ||
const sentenceCase = (str, sentenceCase = true) => | ||
str.replace(/^./, sentenceCase ? str[0].toUpperCase() : str[0].toLowerCase()); | ||
|
||
// Release rules for each type | ||
const releaseRules = convention.types.map(({ name, releaseType }) => ({ | ||
type: sentenceCase(name, convention.sentenceCase.type), | ||
release: releaseType || false, | ||
})); | ||
|
||
// Changelog sections for each type | ||
const logSections = convention.types.map(({ name, logSection }) => ({ | ||
type: sentenceCase(name, false), | ||
section: logSection, | ||
hidden: logSection ? false : true, | ||
})); | ||
|
||
module.exports = { | ||
branches: ["main"], | ||
plugins: [ | ||
[ | ||
"@semantic-release/commit-analyzer", | ||
{ | ||
preset: "conventionalcommits", | ||
releaseRules, | ||
}, | ||
], | ||
["@semantic-release/changelog", { changelogFile: "docs/CHANGELOG.md" }], | ||
[ | ||
"@semantic-release/release-notes-generator", | ||
{ | ||
preset: "conventionalcommits", | ||
presetConfig: { types: logSections }, | ||
}, | ||
], | ||
[ | ||
"@semantic-release/exec", | ||
{ | ||
prepareCmd: | ||
"find docs/*.md -type f -exec sed -i -E 's/copybara-action@[^s]+/copybara-action@v${nextRelease.version}/g' {} +", | ||
}, | ||
], | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
assets: ["docs", "package.json"], | ||
message: "Chore(release): ${nextRelease.version}\n\n${nextRelease.notes}", | ||
}, | ||
], | ||
["@semantic-release/github"], | ||
], | ||
}; |
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,3 @@ | ||
dist/ | ||
lib/ | ||
node_modules/ |
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,43 @@ | ||
{ | ||
"env": { | ||
"es2020": true, | ||
"node": true, | ||
"jest": true | ||
}, | ||
"ignorePatterns": ["dist/*"], | ||
"plugins": ["node", "jest", "@typescript-eslint"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:import/errors", | ||
"plugin:import/warnings", | ||
"plugin:import/typescript", | ||
"plugin:node/recommended", | ||
"plugin:jest/recommended", | ||
"plugin:jest/style", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:prettier/recommended", | ||
"prettier", | ||
"prettier/@typescript-eslint" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 9, | ||
"sourceType": "module", | ||
"project": "./tsconfig.json" | ||
}, | ||
"settings": { | ||
"node": { | ||
"tryExtensions": [".js", ".json", ".node", ".ts"] | ||
} | ||
}, | ||
"rules": { | ||
"node/no-unsupported-features/es-syntax": 0, | ||
"node/no-unsupported-features/es-builtins": 0, | ||
"node/no-extraneous-import": [ | ||
"error", | ||
{ | ||
"allowModules": ["@jest/globals"] | ||
} | ||
] | ||
} | ||
} |
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 @@ | ||
dist/** -diff linguist-generated=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,38 @@ | ||
# Copyright 2016 Google Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
FROM gcr.io/cloud-builders/bazel:latest AS build | ||
COPY . . | ||
RUN ./cloudbuild.sh build //java/com/google/copybara:copybara_deploy.jar | ||
RUN mkdir -p /tmp/copybara && \ | ||
cp bazel-bin/java/com/google/copybara/copybara_deploy.jar /tmp/copybara/ | ||
|
||
FROM golang:latest AS buildtools | ||
RUN go install github.com/bazelbuild/buildtools/buildozer@latest | ||
RUN go install github.com/bazelbuild/buildtools/buildifier@latest | ||
|
||
FROM openjdk:11-jre-slim | ||
WORKDIR /usr/src/app | ||
ENV COPYBARA_CONFIG=copy.bara.sky \ | ||
COPYBARA_SUBCOMMAND=migrate \ | ||
COPYBARA_OPTIONS='' \ | ||
COPYBARA_WORKFLOW=default \ | ||
COPYBARA_SOURCEREF='' | ||
COPY --from=build /tmp/copybara/ /opt/copybara/ | ||
COPY --from=buildtools /go/bin/buildozer /go/bin/buildifier /usr/bin/ | ||
COPY .docker/entrypoint.sh /usr/local/bin/copybara | ||
RUN chmod +x /usr/local/bin/copybara | ||
RUN apt-get update && \ | ||
apt-get install -y git && \ | ||
apt-get clean |
Oops, something went wrong.