From c09fae4e8059022164c59862d80ab44e2cf13d4b Mon Sep 17 00:00:00 2001 From: Justin Dalrymple Date: Sun, 17 Oct 2021 14:22:06 -0400 Subject: [PATCH] Fixing protect request format (#2155) --- .circleci/config.yml | 19 ++++++ .github/workflows/codeql-analysis.yml | 58 +++++++++---------- .../core/src/resources/ProtectedBranches.ts | 6 +- .../test/unit/resources/ProtectedBranches.ts | 6 +- 4 files changed, 56 insertions(+), 33 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 442f8f79..d434e420 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -80,6 +80,9 @@ workflows: - canary: name: 'Deploy Canary Build' + filters: + branches: + ignore: master requires: - Lint Src - Lint Docs @@ -403,6 +406,14 @@ jobs: - image: node:lts-alpine steps: - checkout + - restore_cache: + name: Restore yarn package cache + keys: + - yarn-{{ checksum "yarn.lock" }} + - restore_cache: + name: Restore build cache + keys: + - build-{{ .Environment.CIRCLE_WORKFLOW_ID }} - run: | npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN npm config set always-auth=true @@ -420,6 +431,14 @@ jobs: - image: node:lts-alpine steps: - checkout + - restore_cache: + name: Restore yarn package cache + keys: + - yarn-{{ checksum "yarn.lock" }} + - restore_cache: + name: Restore build cache + keys: + - build-{{ .Environment.CIRCLE_WORKFLOW_ID }} - run: | npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN npm config set always-auth=true diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4ae0a81e..e8d9cea5 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -9,14 +9,14 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: "CodeQL" +name: 'CodeQL' on: push: - branches: [ master ] + branches: [master] pull_request: # The branches below must be a subset of the branches above - branches: [ master ] + branches: [master] schedule: - cron: '16 0 * * 4' @@ -32,40 +32,40 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript' ] + language: ['javascript'] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] # Learn more: # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed steps: - - name: Checkout repository - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v2 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - #- run: | - # make bootstrap - # make release + #- run: | + # make bootstrap + # make release - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/packages/core/src/resources/ProtectedBranches.ts b/packages/core/src/resources/ProtectedBranches.ts index 61deec9d..d2b5f921 100644 --- a/packages/core/src/resources/ProtectedBranches.ts +++ b/packages/core/src/resources/ProtectedBranches.ts @@ -37,8 +37,10 @@ export class ProtectedBranches extends BaseResource()(this, `projects/${pId}/protected_branches`, { - name: branchName, - ...options, + query: { + name: branchName, + ...options, + }, }); } diff --git a/packages/core/test/unit/resources/ProtectedBranches.ts b/packages/core/test/unit/resources/ProtectedBranches.ts index 531cf09e..1697214b 100644 --- a/packages/core/test/unit/resources/ProtectedBranches.ts +++ b/packages/core/test/unit/resources/ProtectedBranches.ts @@ -47,8 +47,10 @@ describe('ProtectedBranches.protect', () => { await service.protect(1, 'name', { test: 1 }); expect(RequestHelper.post()).toHaveBeenCalledWith(service, 'projects/1/protected_branches', { - name: 'name', - test: 1, + query: { + name: 'name', + test: 1, + }, }); }); });