diff --git a/.github/labels.yaml b/.github/labels.yaml new file mode 100644 index 0000000..a8db383 --- /dev/null +++ b/.github/labels.yaml @@ -0,0 +1,17 @@ +area: + - 'bug' + - 'important' + +kind: + - 'failing-test' + - 'cleanup' + +priority: + - 'low' + - 'high' + +tests: + - '**/*.test.ts' + +source: + - 'src/**' diff --git a/.github/workflows/issueComment.yml b/.github/workflows/issueComment.yml new file mode 100644 index 0000000..6859985 --- /dev/null +++ b/.github/workflows/issueComment.yml @@ -0,0 +1,31 @@ +name: "Test issue comments" +on: + issue_comment: + types: [created] + +jobs: + execute: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - run: npm install + - run: npm run build + - uses: ./ + with: + prow-commands: '/assign + /unassign + /approve + /retitle + /area + /kind + /priority + /remove + /lgtm + /close + /reopen + /lock + /milestone + /hold + /cc + /uncc' + github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/lgtm-merger.yml b/.github/workflows/lgtm-merger.yml new file mode 100644 index 0000000..a3c2174 --- /dev/null +++ b/.github/workflows/lgtm-merger.yml @@ -0,0 +1,17 @@ +name: "Merge on lgtm label" +on: + schedule: + - cron: "*/20 * * * *" + +jobs: + execute: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - run: npm install + - run: npm run build + - uses: ./ + with: + jobs: 'lgtm' + github-token: "${{ secrets.GITHUB_TOKEN }}" + merge-method: 'squash' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 431ea35..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,34 +0,0 @@ -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - hello_world_job: - runs-on: windows-latest - name: Build and Analyse - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Set up JDK 11 - uses: actions/setup-java@v2 - with: - java-version: '11' - distribution: 'adopt' - - uses: actions/setup-node@v2 - with: - node-version: '14' - - run: npm install - - id: main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - LANG: JS - uses: applibgroup/HarmonyOs-build@v2.8 - - name: Upload Artifact - uses: actions/upload-artifact@v2 - with: - name: assets-for-download - path: build\outputs\hap\debug\phone diff --git a/.github/workflows/onPr.yml b/.github/workflows/onPr.yml new file mode 100644 index 0000000..91b0c00 --- /dev/null +++ b/.github/workflows/onPr.yml @@ -0,0 +1,14 @@ +name: "Run Jobs on PR" +on: pull_request + +jobs: + execute: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - run: npm install + - run: npm run build + - uses: ./ + with: + jobs: 'lgtm' + github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/prLabeler.yml b/.github/workflows/prLabeler.yml new file mode 100644 index 0000000..d89f0a3 --- /dev/null +++ b/.github/workflows/prLabeler.yml @@ -0,0 +1,12 @@ +name: "Label PRs from globs" +on: +- pull_request_target + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@main + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + configuration-path: .github/labels.yaml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..0ccc265 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,19 @@ +name: Mark stale issues and pull requests + +on: + schedule: + - cron: "0 0 * * *" + +jobs: + stale: + + runs-on: ubuntu-latest + + steps: + - uses: actions/stale@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'Issue is stale' + stale-pr-message: 'Pull req is stale' + stale-issue-label: 'no-issue-activity' + stale-pr-label: 'no-pr-activity' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b59d082 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,12 @@ +name: "Build and test code" +on: [push, pull_request] + +jobs: + build-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - run: | + npm install + npm run build + npm run test diff --git a/build.gradle b/build.gradle index 596901b..bbf2db6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. apply plugin: 'com.huawei.ohos.app' -apply plugin: "org.sonarqube" + //For instructions on signature configuration, see https://developer.harmonyos.com/en/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 ohos { @@ -19,7 +19,7 @@ buildscript { dependencies { classpath 'com.huawei.ohos:hap:3.0.3.4' classpath 'com.huawei.ohos:decctest:1.2.6.0' - classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3" + } } @@ -32,13 +32,4 @@ allprojects { url 'https://developer.huawei.com/repo/' } } - sonarqube { - properties { - property "sonar.projectKey", "applibgroup_Buttons" - property "sonar.organization", "applibgroup" - property "sonar.host.url", "https://sonarcloud.io/" - property "sonar.sources", "entry/src" - property "sonar.java.binaries", "entry/build" - } -} -} + diff --git a/package.json b/package.json index 0967ef4..541cbe7 100644 --- a/package.json +++ b/package.json @@ -1 +1,50 @@ -{} +{ + "name": "prow-github-actions", + "version": "1.1.3", + "description": "Slash commands, jobs, and chat-ops for Github actions inspired by Kubernetes Prow", + "main": "lib/main.js", + "scripts": { + "build": "tsc", + "format": "prettier --write **/*.ts", + "format-check": "prettier --check **/*.ts", + "lint": "eslint src/**/*.ts", + "pack": "ncc build", + "test": "jest", + "test-all": "npm run build && npm run pack && npm test", + "all": "npm run build && npm run format && npm run lint && npm run pack && npm test" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/jpmcb/prow-github-actions.git" + }, + "keywords": [ + "actions", + "prow" + ], + "author": "John McBride", + "license": "MIT", + "dependencies": { + "@actions/core": "^1.2.6", + "@actions/github": "^2.1.1", + "@octokit/webhooks": "^7.2.0", + "minimatch": "^3.0.4" + }, + "devDependencies": { + "@types/jest": "^24.0.23", + "@types/js-yaml": "^3.12.3", + "@types/minimatch": "^3.0.3", + "@types/node": "^12.7.12", + "@typescript-eslint/parser": "^2.8.0", + "@zeit/ncc": "^0.20.5", + "eslint": "^5.16.0", + "eslint-plugin-github": "^2.0.0", + "eslint-plugin-jest": "^22.21.0", + "jest": "^26.6.3", + "jest-circus": "^26.6.3", + "js-yaml": "^3.13.1", + "nock": "^12.0.3", + "prettier": "^1.19.1", + "ts-jest": "^26.4.1", + "typescript": "^3.6.4" + } +}