forked from Olivr/copybara-action
-
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 385eb84
Showing
39 changed files
with
28,716 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,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,54 @@ | ||
{ | ||
"plugins": ["jest", "@typescript-eslint"], | ||
"extends": ["plugin:github/recommended"], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 9, | ||
"sourceType": "module", | ||
"project": "./tsconfig.json" | ||
}, | ||
"rules": { | ||
"eslint-comments/no-use": "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 | ||
} | ||
} |
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,15 @@ | ||
name: Test build | ||
|
||
on: | ||
pull_request: | ||
push: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: yarn install | ||
- run: yarn build | ||
- run: yarn package | ||
- run: yarn test |
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,22 @@ | ||
name: Publish Copybara Docker Image | ||
on: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
publish-copybara: | ||
runs-on: ubuntu-latest | ||
name: Publish to Docker Hub | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: google/copybara | ||
fetch-depth: 1 | ||
|
||
- name: Build and push Docker images | ||
uses: docker/[email protected] | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
repository: olivr/copybara | ||
tags: latest |
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,91 @@ | ||
name: "Test 'PR' Workflow" | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
# When new code is pushed on destination, create a PR to trigger an E2E test of the PR workflow | ||
prepare-test: | ||
name: "[Chore] Create Test Pull Request" | ||
if: github.repository == 'olivr/copybara-action-test' && github.event_name == 'push' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get Commit Message | ||
run: | | ||
MSG=$(git log --format=%B -n 1 ${{ github.event.after }}) | ||
echo "::set-env name=COMMIT_MESSAGE::${MSG}" | ||
- name: Toggle test file | ||
run: '[ -e "./.test-pr-workflow" ] && rm -rf ./.test-pr-workflow || echo "${{ github.sha }}" > ./.test-pr-workflow' | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
commit-message: "[Test PR] ${{env.COMMIT_MESSAGE}}" | ||
title: "[Test PR] ${{env.COMMIT_MESSAGE}}" | ||
body: "Generated by workflow [${{ github.run_id }}](../actions/runs/${{ github.run_id }})" | ||
token: ${{ secrets.GH_TOKEN }} | ||
branch: test-pr-workflow | ||
branch-suffix: short-commit-hash | ||
|
||
# When a new test PR is created on destination (by the job above), copy it to SoT | ||
e2e-test: | ||
name: "'PR' E2E tests" | ||
if: github.repository == 'olivr/copybara-action-test' && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Test PR]') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: "[Test] Basic usage" | ||
uses: ./ | ||
with: | ||
sot_repo: olivr/copybara-action | ||
destination_repo: olivr/copybara-action-test | ||
access_token: ${{ secrets.GH_TOKEN }} | ||
ssh_key: ${{ secrets.SSH_KEY }} | ||
|
||
- name: "🧹 Close Pull Request" | ||
uses: actions/github-script@v3 | ||
with: | ||
github-token: ${{secrets.GH_TOKEN}} | ||
script: | | ||
github.pulls.update({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: context.payload.pull_request.number, | ||
state: 'closed' | ||
}); | ||
- name: "🧹 Delete PR branch" | ||
run: git push origin :${{github.head_ref}} | ||
|
||
# When a new test PR is created on SoT (by the job above), close it | ||
cleanup-test: | ||
name: "[Chore] Close Test Pull Request" | ||
if: github.repository == 'olivr/copybara-action' && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Test PR]') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: "🧹 Close Pull Request" | ||
uses: actions/github-script@v3 | ||
with: | ||
github-token: ${{secrets.GH_TOKEN}} | ||
script: | | ||
github.pulls.update({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: context.payload.pull_request.number, | ||
state: 'closed' | ||
}); | ||
- name: "🧹 Delete PR branch" | ||
run: git push origin :${{github.head_ref}} |
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 @@ | ||
name: "Test 'Push' Workflow" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
e2e-test: | ||
name: "'Push' E2E tests" | ||
if: github.repository == 'olivr/copybara-action' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: "[Test] Basic usage" | ||
uses: ./ | ||
with: | ||
sot_repo: olivr/copybara-action | ||
destination_repo: olivr/copybara-action-test | ||
access_token: ${{ secrets.GH_TOKEN }} | ||
ssh_key: ${{ secrets.SSH_KEY }} | ||
|
||
- name: "[Test] Missing repos" | ||
id: missing-repos | ||
continue-on-error: true | ||
uses: ./ | ||
with: | ||
destination_repo: olivr/copybara-action-test | ||
ssh_key: ${{ secrets.SSH_KEY }} | ||
workflow: push | ||
- name: ".........⏳" | ||
if: steps.missing-repos.outcome != 'failure' || !startsWith(steps.missing-repos.outputs.msg, '[action] 51') | ||
run: exit 1 | ||
|
||
- name: "[Test] Missing token" | ||
id: missing-token | ||
continue-on-error: true | ||
uses: ./ | ||
with: | ||
sot_repo: olivr/copybara-action | ||
destination_repo: olivr/copybara-action-test | ||
ssh_key: ${{ secrets.SSH_KEY }} | ||
- name: "..........⏳" | ||
if: steps.missing-token.outcome != 'failure' || !startsWith(steps.missing-token.outputs.msg, '[action] 51') | ||
run: exit 1 |
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 @@ | ||
# Dependency directory | ||
node_modules | ||
|
||
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
.secrets | ||
|
||
# OS metadata | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# Ignore built ts files | ||
__tests__/runner/* | ||
lib/**/* |
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,3 @@ | ||
{ | ||
"printWidth": 120 | ||
} |
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,22 @@ | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2018 GitHub, Inc. and contributors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
Oops, something went wrong.