From 3e134ed9c1d04ae2bc2835de8e5b140d3c576924 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Tue, 3 Aug 2021 16:30:31 -0500 Subject: [PATCH 01/23] trying out changed files --- .github/workflow-templates/_setup.yml | 15 +++++++++++++++ .github/workflow-templates/pr-actions.yml | 10 +++++----- .github/workflows/pr-actions.yml | 18 ++++++++++++++++++ 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/.github/workflow-templates/_setup.yml b/.github/workflow-templates/_setup.yml index bf0810b..7e264c7 100644 --- a/.github/workflow-templates/_setup.yml +++ b/.github/workflow-templates/_setup.yml @@ -7,3 +7,18 @@ setup: setup: checkout steps: - run: yarn + changed-files: + steps: + - name: Get All Changed Files + uses: jitterbit/get-changed-files@v1 + id: changed + with: + format: 'json' + + - uses: actions/github-script@0.3.0 + with: + script: | + const core = require('@actions/core') + core.exportVariable('ALL_CHANGED_FILES', JSON.stringify(${{ steps.changed.outputs.added_modified }})) + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true diff --git a/.github/workflow-templates/pr-actions.yml b/.github/workflow-templates/pr-actions.yml index 5cfa67c..34273f7 100644 --- a/.github/workflow-templates/pr-actions.yml +++ b/.github/workflow-templates/pr-actions.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Run eslint uses: Khan/eslint-action@main - setup: yarn + setup: [yarn, changed-files] with: eslint-lib: ./node_modules/eslint env: @@ -19,7 +19,7 @@ jobs: - name: Run jest tests uses: Khan/jest-action@main - setup: yarn + setup: [yarn, changed-files] with: jest-bin: ./node_modules/.bin/jest env: @@ -27,7 +27,7 @@ jobs: - name: Run jest coverage uses: Khan/jest-coverage-action@main - setup: yarn + setup: [yarn, changed-files] with: jest-bin: ./node_modules/.bin/jest coverage-data-path: ./coverage/coverage-final.json @@ -36,7 +36,7 @@ jobs: - name: Run flow uses: Khan/flow-action@main - setup: yarn + setup: [yarn, changed-files] with: flow-bin: ./node_modules/.bin/flow env: @@ -44,7 +44,7 @@ jobs: - name: Run flow coverage uses: Khan/flow-coverage-action@main - setup: yarn + setup: [yarn, changed-files] with: flow-bin: ./node_modules/.bin/flow env: diff --git a/.github/workflows/pr-actions.yml b/.github/workflows/pr-actions.yml index a12230c..5b0f011 100644 --- a/.github/workflows/pr-actions.yml +++ b/.github/workflows/pr-actions.yml @@ -9,6 +9,24 @@ jobs: steps: - uses: actions/checkout@v1 name: '▶️ Setup checkout: get the repo' + - name: "\U0001F53D Start setup [changed-files]" + run: echo "Setting something up" + - name: Get All Changed Files + uses: jitterbit/get-changed-files@v1 + id: changed + with: + format: json + - uses: actions/github-script@0.3.0 + with: + script: > + const core = require('@actions/core') + + core.exportVariable('ALL_CHANGED_FILES', JSON.stringify(${{ + steps.changed.outputs.added_modified }})) + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + - name: "\U0001F53C Finished setup [changed-files]" + run: echo "Finished setting it up" - run: yarn name: '▶️ Setup yarn: ' - name: Run eslint From f238119e9877c72d402cc75ed62bac61abed1a04 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Tue, 3 Aug 2021 16:31:35 -0500 Subject: [PATCH 02/23] debug --- .github/workflow-templates/_setup.yml | 3 +++ .github/workflows/pr-actions.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/.github/workflow-templates/_setup.yml b/.github/workflow-templates/_setup.yml index 7e264c7..f201d1e 100644 --- a/.github/workflow-templates/_setup.yml +++ b/.github/workflow-templates/_setup.yml @@ -15,6 +15,9 @@ setup: with: format: 'json' + - name: Debug + run: echo '${{ steps.changed.outputs.added_modified }}' + - uses: actions/github-script@0.3.0 with: script: | diff --git a/.github/workflows/pr-actions.yml b/.github/workflows/pr-actions.yml index 5b0f011..ca6a10b 100644 --- a/.github/workflows/pr-actions.yml +++ b/.github/workflows/pr-actions.yml @@ -16,6 +16,8 @@ jobs: id: changed with: format: json + - name: Debug + run: 'echo ''${{ steps.changed.outputs.added_modified }}''' - uses: actions/github-script@0.3.0 with: script: > From e830de41bd54e8668efa11e95fd9c3c4c93f05d1 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 4 Aug 2021 10:07:55 -0500 Subject: [PATCH 03/23] simpler maybe --- .github/workflow-templates/_setup.yml | 18 ++++++++++-------- .github/workflows/pr-actions.yml | 16 ++++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflow-templates/_setup.yml b/.github/workflow-templates/_setup.yml index f201d1e..4feb05e 100644 --- a/.github/workflow-templates/_setup.yml +++ b/.github/workflow-templates/_setup.yml @@ -14,14 +14,16 @@ setup: id: changed with: format: 'json' - - - name: Debug - run: echo '${{ steps.changed.outputs.added_modified }}' - - - uses: actions/github-script@0.3.0 + + - name: set environment variables + uses: allenevans/set-env@v2.0.0 with: - script: | - const core = require('@actions/core') - core.exportVariable('ALL_CHANGED_FILES', JSON.stringify(${{ steps.changed.outputs.added_modified }})) + ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' + ALL_CHANGED_FILES_BASE: '${{ github.workspace }}' env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true + + - name: Debug + run: | + echo The files that were changed: ${ALL_CHANGED_FILES} + echo The base directory for those files: ${ALL_CHANGED_FILES_BASE} diff --git a/.github/workflows/pr-actions.yml b/.github/workflows/pr-actions.yml index ca6a10b..81bdabe 100644 --- a/.github/workflows/pr-actions.yml +++ b/.github/workflows/pr-actions.yml @@ -16,17 +16,17 @@ jobs: id: changed with: format: json - - name: Debug - run: 'echo ''${{ steps.changed.outputs.added_modified }}''' - - uses: actions/github-script@0.3.0 + - name: set environment variables + uses: allenevans/set-env@v2.0.0 with: - script: > - const core = require('@actions/core') - - core.exportVariable('ALL_CHANGED_FILES', JSON.stringify(${{ - steps.changed.outputs.added_modified }})) + ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' + ALL_CHANGED_FILES_BASE: '${{ github.workspace }}' env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true + - name: Debug + run: | + echo The files that were changed: ${ALL_CHANGED_FILES} + echo The base directory for those files: ${ALL_CHANGED_FILES_BASE} - name: "\U0001F53C Finished setup [changed-files]" run: echo "Finished setting it up" - run: yarn From 4822a53cb707befae86bd10bdf37e7de82c64e2e Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 4 Aug 2021 10:20:46 -0500 Subject: [PATCH 04/23] absolute option --- .github/workflow-templates/_setup.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflow-templates/_setup.yml b/.github/workflow-templates/_setup.yml index 4feb05e..d8614c3 100644 --- a/.github/workflow-templates/_setup.yml +++ b/.github/workflow-templates/_setup.yml @@ -10,20 +10,18 @@ setup: changed-files: steps: - name: Get All Changed Files - uses: jitterbit/get-changed-files@v1 + uses: jaredly/get-changed-files@absolute id: changed with: format: 'json' - - - name: set environment variables - uses: allenevans/set-env@v2.0.0 + absolute: true + + - uses: allenevans/set-env@v2.0.0 with: ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' - ALL_CHANGED_FILES_BASE: '${{ github.workspace }}' env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true - name: Debug run: | echo The files that were changed: ${ALL_CHANGED_FILES} - echo The base directory for those files: ${ALL_CHANGED_FILES_BASE} From e64ab27fd44d72190a77fbda3750614dd7c1b767 Mon Sep 17 00:00:00 2001 From: Khan Actions Bot Date: Wed, 4 Aug 2021 15:21:31 +0000 Subject: [PATCH 05/23] Committing autofixes --- .github/workflows/pr-actions.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-actions.yml b/.github/workflows/pr-actions.yml index 81bdabe..d3f86b3 100644 --- a/.github/workflows/pr-actions.yml +++ b/.github/workflows/pr-actions.yml @@ -12,21 +12,19 @@ jobs: - name: "\U0001F53D Start setup [changed-files]" run: echo "Setting something up" - name: Get All Changed Files - uses: jitterbit/get-changed-files@v1 + uses: jaredly/get-changed-files@absolute id: changed with: format: json - - name: set environment variables - uses: allenevans/set-env@v2.0.0 + absolute: true + - uses: allenevans/set-env@v2.0.0 with: ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' - ALL_CHANGED_FILES_BASE: '${{ github.workspace }}' env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true - name: Debug run: | echo The files that were changed: ${ALL_CHANGED_FILES} - echo The base directory for those files: ${ALL_CHANGED_FILES_BASE} - name: "\U0001F53C Finished setup [changed-files]" run: echo "Finished setting it up" - run: yarn From 02c44c0653b49c0b5ba54196fc36318ff3d7796c Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 4 Aug 2021 10:39:24 -0500 Subject: [PATCH 06/23] try without that --- .github/workflow-templates/_setup.yml | 2 -- .github/workflows/pr-actions.yml | 10 +++------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflow-templates/_setup.yml b/.github/workflow-templates/_setup.yml index d8614c3..5afc346 100644 --- a/.github/workflow-templates/_setup.yml +++ b/.github/workflow-templates/_setup.yml @@ -19,8 +19,6 @@ setup: - uses: allenevans/set-env@v2.0.0 with: ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - name: Debug run: | diff --git a/.github/workflows/pr-actions.yml b/.github/workflows/pr-actions.yml index 81bdabe..6aa88a3 100644 --- a/.github/workflows/pr-actions.yml +++ b/.github/workflows/pr-actions.yml @@ -12,21 +12,17 @@ jobs: - name: "\U0001F53D Start setup [changed-files]" run: echo "Setting something up" - name: Get All Changed Files - uses: jitterbit/get-changed-files@v1 + uses: jaredly/get-changed-files@absolute id: changed with: format: json - - name: set environment variables - uses: allenevans/set-env@v2.0.0 + absolute: true + - uses: allenevans/set-env@v2.0.0 with: ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' - ALL_CHANGED_FILES_BASE: '${{ github.workspace }}' - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - name: Debug run: | echo The files that were changed: ${ALL_CHANGED_FILES} - echo The base directory for those files: ${ALL_CHANGED_FILES_BASE} - name: "\U0001F53C Finished setup [changed-files]" run: echo "Finished setting it up" - run: yarn From 4d3eaa7c6b5d325588bd304fdad13c2b23919db0 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 4 Aug 2021 10:42:31 -0500 Subject: [PATCH 07/23] simplify --- .github/workflow-templates/_setup.yml | 4 ---- .github/workflows/pr-actions.yml | 3 --- 2 files changed, 7 deletions(-) diff --git a/.github/workflow-templates/_setup.yml b/.github/workflow-templates/_setup.yml index 5afc346..87c5b58 100644 --- a/.github/workflow-templates/_setup.yml +++ b/.github/workflow-templates/_setup.yml @@ -19,7 +19,3 @@ setup: - uses: allenevans/set-env@v2.0.0 with: ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' - - - name: Debug - run: | - echo The files that were changed: ${ALL_CHANGED_FILES} diff --git a/.github/workflows/pr-actions.yml b/.github/workflows/pr-actions.yml index 6aa88a3..aed7bad 100644 --- a/.github/workflows/pr-actions.yml +++ b/.github/workflows/pr-actions.yml @@ -20,9 +20,6 @@ jobs: - uses: allenevans/set-env@v2.0.0 with: ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' - - name: Debug - run: | - echo The files that were changed: ${ALL_CHANGED_FILES} - name: "\U0001F53C Finished setup [changed-files]" run: echo "Finished setting it up" - run: yarn From da16c43dd352e1e606c838008e7f25e3bf3fbf97 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 4 Aug 2021 10:51:41 -0500 Subject: [PATCH 08/23] try out the all changed files --- dist/index.js | 26 +++++++++++++++++++++++++- package.json | 2 +- yarn.lock | 9 +++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 9d3a814..6658d60 100755 --- a/dist/index.js +++ b/dist/index.js @@ -2660,7 +2660,7 @@ const cannedGithubErrorMessage = () /*:string*/ => { `you reparented, and the old parent no longer exists. This is a bug on GitHub; unless ` + `you push a new commit, the old base ref won't update. You can try solving this by: \n` + `\t1. Merging the new base branch into your pull-request and re-running your checks.\n` + - `\t2. Rebasing the new base branch into your pull-request and re-running your checks.\n` + + `\t2. Rebasing your pull-request branch onto the new base branch and re-running your checks.\n` + `\t3. Creating and pushing an empty commit (e.g., \`$ git commit --allow-empty -m ` + `'Trigger checks' && git push\`).` : `No valid base ref given. The envar \`GITHUB_BASE_REF\` was null and no other base ref could ` + @@ -86595,12 +86595,36 @@ const isFileIgnored = (workingDirectory, file) => { /** * This lists the files that have changed when compared to `base` (a git ref), * limited to the files that are a descendent of `cwd`. + * It also respects '.gitattributes', filtering out files that have been marked + * as "binary" or "linguist-generated=true". */ const gitChangedFiles = async ( base /*:string*/, cwd /*:string*/, ) /*: Promise>*/ => { cwd = path.resolve(cwd); + + // Github actions jobs can run the following steps to get a fully accurate + // changed files list. Otherwise, we fallback to a simple diff between the + // current and base branch, which might give false positives if the base + // is ahead of the current branch. + // + // - name: Get All Changed Files + // uses: jaredly/get-changed-files@absolute + // id: changed + // with: + // format: 'json' + // absolute: true + // + // - uses: allenevans/set-env@v2.0.0 + // with: + // ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' + // + if (process.env.ALL_CHANGED_FILES) { + const files = JSON.parse(process.env.ALL_CHANGED_FILES) + return files.filter(path => !isFileIgnored(cwd, path)) + } + const { stdout } = await execProm( `git diff --name-only ${base} --relative`, { cwd, encoding: 'utf8', rejectOnError: true }, diff --git a/package.json b/package.json index 56bd1f9..1b72abe 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@babel/core": "^7.9.6", "@babel/register": "^7.9.0", "@zeit/ncc": "^0.22.1", - "actions-utils": "git+https://git@github.com/Khan/actions-utils#v1.2.5", + "actions-utils": "git+https://git@github.com/Khan/actions-utils#changed-better", "actions-workflow-tools": "git+https://git@github.com/Khan/actions-workflow-tools#v1.2.5", "babel-eslint": "^10.1.0", "chalk": "^2.4.2", diff --git a/yarn.lock b/yarn.lock index 816ceca..d4d5195 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1168,6 +1168,15 @@ acorn@^7.1.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.2.0.tgz#17ea7e40d7c8640ff54a694c889c26f31704effe" integrity sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ== +"actions-utils@git+https://git@github.com/Khan/actions-utils#changed-better": + version "1.2.4" + resolved "git+https://git@github.com/Khan/actions-utils#4d660a61d586f1581182c282a68c67385e695c36" + dependencies: + "@actions/github" "^2.1.1" + chalk "^2.4.2" + cli-highlight "^2.1.4" + minimatch "^3.0.4" + "actions-utils@git+https://git@github.com/Khan/actions-utils#v1.2.5": version "1.2.4" resolved "git+https://git@github.com/Khan/actions-utils#2fb7c74158e8f96f7f891c0d58f5c5feb08e8615" From a716f60c76287b456d3956b90cd12b2340064b2c Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 4 Aug 2021 10:52:08 -0500 Subject: [PATCH 09/23] ok --- .github/workflow-templates/pr-actions.yml | 2 +- .github/workflows/pr-actions.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflow-templates/pr-actions.yml b/.github/workflow-templates/pr-actions.yml index 34273f7..24cf5d6 100644 --- a/.github/workflow-templates/pr-actions.yml +++ b/.github/workflow-templates/pr-actions.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Run eslint - uses: Khan/eslint-action@main + uses: Khan/eslint-action@da16c43dd352e1e606c838008e7f25e3bf3fbf97 setup: [yarn, changed-files] with: eslint-lib: ./node_modules/eslint diff --git a/.github/workflows/pr-actions.yml b/.github/workflows/pr-actions.yml index aed7bad..8f94932 100644 --- a/.github/workflows/pr-actions.yml +++ b/.github/workflows/pr-actions.yml @@ -25,7 +25,7 @@ jobs: - run: yarn name: '▶️ Setup yarn: ' - name: Run eslint - uses: Khan/eslint-action@main + uses: Khan/eslint-action@da16c43dd352e1e606c838008e7f25e3bf3fbf97 with: eslint-lib: ./node_modules/eslint env: From 4fc7b9efefae550d2add5447ca2f6f5393bb9991 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 4 Aug 2021 11:09:43 -0500 Subject: [PATCH 10/23] change --- eslint.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eslint.js b/eslint.js index 1c8fad6..9012d5d 100644 --- a/eslint.js +++ b/eslint.js @@ -13,6 +13,8 @@ // $FlowFixMe: shhhhh require('@babel/register'); // flow-uncovered-line +// A change to trigger things + const sendReport = require('actions-utils/send-report'); const gitChangedFiles = require('actions-utils/git-changed-files'); const getBaseRef = require('actions-utils/get-base-ref'); From 2c11a91a0d5124a11f720e075eb0e5fd3208c317 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 4 Aug 2021 11:10:37 -0500 Subject: [PATCH 11/23] change other file --- types.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types.js b/types.js index e488284..f86c001 100644 --- a/types.js +++ b/types.js @@ -13,6 +13,8 @@ type LintSuggestion = { type Severity = 0 | 1 | 2; +// Change this file, and see if the child PR thinks it's changed as well + type LintMessage = { column: number, line: number, From a42306d5792ce70aa79a3df05217d169269757e4 Mon Sep 17 00:00:00 2001 From: Khan Actions Bot Date: Wed, 4 Aug 2021 16:10:45 +0000 Subject: [PATCH 12/23] Committing autofixes --- dist/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dist/index.js b/dist/index.js index 6658d60..d0d676c 100755 --- a/dist/index.js +++ b/dist/index.js @@ -106471,6 +106471,8 @@ module.exports = function(hljs) { // $FlowFixMe: shhhhh __webpack_require__(4285); // flow-uncovered-line +// A change to trigger things + const sendReport = __webpack_require__(1876); const gitChangedFiles = __webpack_require__(5042); const getBaseRef = __webpack_require__(254); From fe837ea149a3f0e077821b290924f77c8df7035f Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 4 Aug 2021 11:10:49 -0500 Subject: [PATCH 13/23] bump --- eslint.js | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint.js b/eslint.js index 9012d5d..fe9bce4 100644 --- a/eslint.js +++ b/eslint.js @@ -14,6 +14,7 @@ require('@babel/register'); // flow-uncovered-line // A change to trigger things +// Bump const sendReport = require('actions-utils/send-report'); const gitChangedFiles = require('actions-utils/git-changed-files'); From f6ba1550c4c687fd2a883a929b93cebba307a476 Mon Sep 17 00:00:00 2001 From: Khan Actions Bot Date: Wed, 4 Aug 2021 16:11:52 +0000 Subject: [PATCH 14/23] Committing autofixes --- dist/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/index.js b/dist/index.js index d0d676c..38a0533 100755 --- a/dist/index.js +++ b/dist/index.js @@ -106472,6 +106472,7 @@ module.exports = function(hljs) { __webpack_require__(4285); // flow-uncovered-line // A change to trigger things +// Bump const sendReport = __webpack_require__(1876); const gitChangedFiles = __webpack_require__(5042); From e3a22a1a9eb6e06de7e4e60759cc5a9509d59bf2 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 4 Aug 2021 11:13:15 -0500 Subject: [PATCH 15/23] disable --- .github/workflow-templates/_setup.yml | 2 +- .github/workflows/pr-actions.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflow-templates/_setup.yml b/.github/workflow-templates/_setup.yml index 87c5b58..25ffd21 100644 --- a/.github/workflow-templates/_setup.yml +++ b/.github/workflow-templates/_setup.yml @@ -18,4 +18,4 @@ setup: - uses: allenevans/set-env@v2.0.0 with: - ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' + ALL_CHANGED_FILES_DISABLED: '${{ steps.changed.outputs.added_modified }}' diff --git a/.github/workflows/pr-actions.yml b/.github/workflows/pr-actions.yml index 8f94932..f6c9f1a 100644 --- a/.github/workflows/pr-actions.yml +++ b/.github/workflows/pr-actions.yml @@ -19,7 +19,7 @@ jobs: absolute: true - uses: allenevans/set-env@v2.0.0 with: - ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' + ALL_CHANGED_FILES_DISABLED: '${{ steps.changed.outputs.added_modified }}' - name: "\U0001F53C Finished setup [changed-files]" run: echo "Finished setting it up" - run: yarn From fe121112459dfb114a53d658f029e6a75905c9a2 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 4 Aug 2021 11:14:17 -0500 Subject: [PATCH 16/23] back again --- .github/workflow-templates/_setup.yml | 2 +- .github/workflows/pr-actions.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflow-templates/_setup.yml b/.github/workflow-templates/_setup.yml index 25ffd21..87c5b58 100644 --- a/.github/workflow-templates/_setup.yml +++ b/.github/workflow-templates/_setup.yml @@ -18,4 +18,4 @@ setup: - uses: allenevans/set-env@v2.0.0 with: - ALL_CHANGED_FILES_DISABLED: '${{ steps.changed.outputs.added_modified }}' + ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' diff --git a/.github/workflows/pr-actions.yml b/.github/workflows/pr-actions.yml index f6c9f1a..8f94932 100644 --- a/.github/workflows/pr-actions.yml +++ b/.github/workflows/pr-actions.yml @@ -19,7 +19,7 @@ jobs: absolute: true - uses: allenevans/set-env@v2.0.0 with: - ALL_CHANGED_FILES_DISABLED: '${{ steps.changed.outputs.added_modified }}' + ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' - name: "\U0001F53C Finished setup [changed-files]" run: echo "Finished setting it up" - run: yarn From 322f5d78d389eb499d4ce4c5a50695d63fa7bec1 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 4 Aug 2021 11:17:58 -0500 Subject: [PATCH 17/23] shallow clone --- .github/workflow-templates/_setup.yml | 8 ++++++-- .github/workflows/pr-actions.yml | 14 +++++++++++--- .github/workflows/pr-autofix.yml | 12 ++++++++++-- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflow-templates/_setup.yml b/.github/workflow-templates/_setup.yml index 87c5b58..ffdb05c 100644 --- a/.github/workflow-templates/_setup.yml +++ b/.github/workflow-templates/_setup.yml @@ -1,8 +1,12 @@ setup: checkout: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 name: get the repo + - uses: actions/checkout@v2 + name: get the base ref + with: + ref: '${{ github.base_ref }}' yarn: setup: checkout steps: @@ -18,4 +22,4 @@ setup: - uses: allenevans/set-env@v2.0.0 with: - ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' + ALL_CHANGED_FILES_DISABLED: '${{ steps.changed.outputs.added_modified }}' diff --git a/.github/workflows/pr-actions.yml b/.github/workflows/pr-actions.yml index 8f94932..96af2ef 100644 --- a/.github/workflows/pr-actions.yml +++ b/.github/workflows/pr-actions.yml @@ -7,8 +7,16 @@ jobs: lint_and_unit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - name: '▶️ Setup checkout: get the repo' + - name: "\U0001F53D Start setup [checkout]" + run: echo "Setting something up" + - uses: actions/checkout@v2 + name: get the repo + - uses: actions/checkout@v2 + name: get the repo + with: + ref: '${{ github.base_ref }}' + - name: "\U0001F53C Finished setup [checkout]" + run: echo "Finished setting it up" - name: "\U0001F53D Start setup [changed-files]" run: echo "Setting something up" - name: Get All Changed Files @@ -19,7 +27,7 @@ jobs: absolute: true - uses: allenevans/set-env@v2.0.0 with: - ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' + ALL_CHANGED_FILES_DISABLED: '${{ steps.changed.outputs.added_modified }}' - name: "\U0001F53C Finished setup [changed-files]" run: echo "Finished setting it up" - run: yarn diff --git a/.github/workflows/pr-autofix.yml b/.github/workflows/pr-autofix.yml index 719ee66..0186f1d 100644 --- a/.github/workflows/pr-autofix.yml +++ b/.github/workflows/pr-autofix.yml @@ -8,8 +8,16 @@ jobs: runs-on: ubuntu-latest if: github.actor != 'khan-actions-bot' steps: - - uses: actions/checkout@v1 - name: '▶️ Setup checkout: get the repo' + - name: "\U0001F53D Start setup [checkout]" + run: echo "Setting something up" + - uses: actions/checkout@v2 + name: get the repo + - uses: actions/checkout@v2 + name: get the repo + with: + ref: '${{ github.base_ref }}' + - name: "\U0001F53C Finished setup [checkout]" + run: echo "Finished setting it up" - id: paths__github_workflow_templates_ name: 'Check paths: .github/workflow-templates/**' run: >- From 7fa4352f8254f1e44bce58985dfc77009cb6a1cf Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 4 Aug 2021 11:31:36 -0500 Subject: [PATCH 18/23] helloz From c0837a2f6f4815b4ba04c07defaee72441db44c6 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 4 Aug 2021 11:41:54 -0500 Subject: [PATCH 19/23] aexactlu --- .github/workflow-templates/_setup.yml | 2 +- .github/workflows/pr-actions.yml | 4 ++-- .github/workflows/pr-autofix.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflow-templates/_setup.yml b/.github/workflow-templates/_setup.yml index ffdb05c..5f852a9 100644 --- a/.github/workflow-templates/_setup.yml +++ b/.github/workflow-templates/_setup.yml @@ -14,7 +14,7 @@ setup: changed-files: steps: - name: Get All Changed Files - uses: jaredly/get-changed-files@absolute + uses: jaredly/get-changed-files@696e6f79663205e7f00ff5856e87d59c03160982 id: changed with: format: 'json' diff --git a/.github/workflows/pr-actions.yml b/.github/workflows/pr-actions.yml index 96af2ef..745bbbd 100644 --- a/.github/workflows/pr-actions.yml +++ b/.github/workflows/pr-actions.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v2 name: get the repo - uses: actions/checkout@v2 - name: get the repo + name: get the base ref with: ref: '${{ github.base_ref }}' - name: "\U0001F53C Finished setup [checkout]" @@ -20,7 +20,7 @@ jobs: - name: "\U0001F53D Start setup [changed-files]" run: echo "Setting something up" - name: Get All Changed Files - uses: jaredly/get-changed-files@absolute + uses: jaredly/get-changed-files@696e6f79663205e7f00ff5856e87d59c03160982 id: changed with: format: json diff --git a/.github/workflows/pr-autofix.yml b/.github/workflows/pr-autofix.yml index 0186f1d..ad61bb7 100644 --- a/.github/workflows/pr-autofix.yml +++ b/.github/workflows/pr-autofix.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v2 name: get the repo - uses: actions/checkout@v2 - name: get the repo + name: get the base ref with: ref: '${{ github.base_ref }}' - name: "\U0001F53C Finished setup [checkout]" From 643cae06ef9911d336214bfc7a8498982480d6fc Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 4 Aug 2021 11:47:04 -0500 Subject: [PATCH 20/23] wat --- .github/workflow-templates/_setup.yml | 2 +- .github/workflows/pr-actions.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflow-templates/_setup.yml b/.github/workflow-templates/_setup.yml index 5f852a9..decefc2 100644 --- a/.github/workflow-templates/_setup.yml +++ b/.github/workflow-templates/_setup.yml @@ -14,7 +14,7 @@ setup: changed-files: steps: - name: Get All Changed Files - uses: jaredly/get-changed-files@696e6f79663205e7f00ff5856e87d59c03160982 + uses: jaredly/get-changed-files@89d3dca932c398add78c3a16b639ee42f9cae4d2 id: changed with: format: 'json' diff --git a/.github/workflows/pr-actions.yml b/.github/workflows/pr-actions.yml index 745bbbd..96e76ff 100644 --- a/.github/workflows/pr-actions.yml +++ b/.github/workflows/pr-actions.yml @@ -20,7 +20,7 @@ jobs: - name: "\U0001F53D Start setup [changed-files]" run: echo "Setting something up" - name: Get All Changed Files - uses: jaredly/get-changed-files@696e6f79663205e7f00ff5856e87d59c03160982 + uses: jaredly/get-changed-files@89d3dca932c398add78c3a16b639ee42f9cae4d2 id: changed with: format: json From e586e84802d210e279e39c0db83affe877d44f9c Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 4 Aug 2021 14:22:52 -0500 Subject: [PATCH 21/23] use the new version of actions-utils --- dist/index.js | 258 ++++++++++++++++++++++++-------------------------- eslint.js | 3 - package.json | 2 +- types.js | 2 - yarn.lock | 10 +- 5 files changed, 131 insertions(+), 144 deletions(-) diff --git a/dist/index.js b/dist/index.js index 38a0533..0e8d1f5 100755 --- a/dist/index.js +++ b/dist/index.js @@ -2577,94 +2577,94 @@ function _loadMjsDefault() { * TODO(jared): Consider using the github pull-request API (if we're online) * to determine the base branch. */ -const { execSync, spawnSync } = __webpack_require__(3129); +const {execSync, spawnSync} = __webpack_require__(3129); -const checkRef = (ref) => spawnSync("git", ["rev-parse", ref]).status === 0; +const checkRef = ref => spawnSync('git', ['rev-parse', ref]).status === 0; -const validateBaseRef = (baseRef /*:string*/) => { - // It's locally accessible! - if (checkRef(baseRef)) { - return baseRef; - } - // If it's not locally accessible, then it's probably a remote branch - const remote = `refs/remotes/origin/${baseRef}`; - if (checkRef(remote)) { - return remote; - } +const validateBaseRef = (baseRef /*:string*/) /*: string | null */ => { + // It's locally accessible! + if (checkRef(baseRef)) { + return baseRef; + } + // If it's not locally accessible, then it's probably a remote branch + const remote = `refs/remotes/origin/${baseRef}`; + if (checkRef(remote)) { + return remote; + } - // Otherwise return null - no valid ref provided - return null; + // Otherwise return null - no valid ref provided + return null; }; -const getBaseRef = (head /*:string*/ = "HEAD") => { - const { GITHUB_BASE_REF } = process.env; - if (GITHUB_BASE_REF) { - return validateBaseRef(GITHUB_BASE_REF); - } else { - let upstream = execSync(`git rev-parse --abbrev-ref '${head}@{upstream}'`, { - encoding: "utf8", - }); - upstream = upstream.trim(); +const getBaseRef = (head /*:string*/ = 'HEAD') /*: string | null */ => { + const {GITHUB_BASE_REF} = process.env; + if (GITHUB_BASE_REF) { + return validateBaseRef(GITHUB_BASE_REF); + } else { + let upstream = execSync(`git rev-parse --abbrev-ref '${head}@{upstream}'`, { + encoding: 'utf8', + }); + upstream = upstream.trim(); - // if upstream is local and not empty, use that. - if (upstream && !upstream.trim().startsWith("origin/")) { - return `refs/heads/${upstream}`; - } - let headRef = execSync(`git rev-parse --abbrev-ref ${head}`, { - encoding: "utf8", - }); - headRef = headRef.trim(); - for (let i = 1; i < 100; i++) { - try { - const stdout = execSync( - `git branch --contains ${head}~${i} --format='%(refname)'`, - { encoding: "utf8" } - ); - let lines = stdout.split("\n").filter(Boolean); - lines = lines.filter((line) => line !== `refs/heads/${headRef}`); - - // Note (Lilli): When running our actions locally, we want to be a little more - // aggressive in choosing a baseRef, going back to a shared commit on only `develop`, - // `master`, feature or release branches, so that we can cover more commits. In case, - // say, I create a bunch of experimental, first-attempt, throw-away branches that - // share commits higher in my stack... - for (const line of lines) { - if ( - line === "refs/heads/develop" || - line === "refs/heads/master" || - line.startsWith("refs/heads/feature/") || - line.startsWith("refs/heads/release/") - ) { - return line; - } + // if upstream is local and not empty, use that. + if (upstream && !upstream.trim().startsWith('origin/')) { + return `refs/heads/${upstream}`; } - } catch { - // Ran out of history, probably + let headRef = execSync(`git rev-parse --abbrev-ref ${head}`, { + encoding: 'utf8', + }); + headRef = headRef.trim(); + for (let i = 1; i < 100; i++) { + try { + const stdout = execSync( + `git branch --contains ${head}~${i} --format='%(refname)'`, + {encoding: 'utf8'}, + ); + let lines = stdout.split('\n').filter(Boolean); + lines = lines.filter(line => line !== `refs/heads/${headRef}`); + + // Note (Lilli): When running our actions locally, we want to be a little more + // aggressive in choosing a baseRef, going back to a shared commit on only `develop`, + // `master`, feature or release branches, so that we can cover more commits. In case, + // say, I create a bunch of experimental, first-attempt, throw-away branches that + // share commits higher in my stack... + for (const line of lines) { + if ( + line === 'refs/heads/develop' || + line === 'refs/heads/master' || + line.startsWith('refs/heads/feature/') || + line.startsWith('refs/heads/release/') + ) { + return line; + } + } + } catch { + // Ran out of history, probably + return null; + } + } + // We couldn't find it return null; - } } - // We couldn't find it - return null; - } }; // Multiple action microservices might encounter this, so give them a canned message to print. // Logging from inside this lib didn't seem to make it to the GitHub Actions console, so I'll // just pass the string back for them to log. const cannedGithubErrorMessage = () /*:string*/ => { - const { GITHUB_BASE_REF } = process.env; + const {GITHUB_BASE_REF} = process.env; - return GITHUB_BASE_REF - ? `No valid base ref given. Found \`${GITHUB_BASE_REF}\`, but \`${GITHUB_BASE_REF}\` does not ` + - `appear to be a valid branch. Perhaps this is coming from a GitHub pull-request that ` + - `you reparented, and the old parent no longer exists. This is a bug on GitHub; unless ` + - `you push a new commit, the old base ref won't update. You can try solving this by: \n` + - `\t1. Merging the new base branch into your pull-request and re-running your checks.\n` + - `\t2. Rebasing your pull-request branch onto the new base branch and re-running your checks.\n` + - `\t3. Creating and pushing an empty commit (e.g., \`$ git commit --allow-empty -m ` + - `'Trigger checks' && git push\`).` - : `No valid base ref given. The envar \`GITHUB_BASE_REF\` was null and no other base ref could ` + - `be determined.`; + return GITHUB_BASE_REF + ? `No valid base ref given. Found \`${GITHUB_BASE_REF}\`, but \`${GITHUB_BASE_REF}\` does not ` + + `appear to be a valid branch. Perhaps this is coming from a GitHub pull-request that ` + + `you reparented, and the old parent no longer exists. This is a bug on GitHub; unless ` + + `you push a new commit, the old base ref won't update. You can try solving this by: \n` + + `\t1. Merging the new base branch into your pull-request and re-running your checks.\n` + + `\t2. Rebasing your pull-request branch onto the new base branch and re-running your checks.\n` + + `\t3. Creating and pushing an empty commit (e.g., \`$ git commit --allow-empty -m ` + + `'Trigger checks' && git push\`).` + : `No valid base ref given. The envar \`GITHUB_BASE_REF\` was null and no other base ref could ` + + `be determined.`; }; module.exports = getBaseRef; @@ -36290,7 +36290,7 @@ module.exports = keys; * the GITHUB_TOKEN env variable. */ -const { GITHUB_TOKEN, GITHUB_WORKSPACE } = process.env; +const {GITHUB_TOKEN, GITHUB_WORKSPACE} = process.env; const fs = __webpack_require__(5747); const path = __webpack_require__(5622); const chalk = __webpack_require__(4946); @@ -36318,7 +36318,7 @@ const localReport = async (title /*:string*/, messages /*:Array*/) => { console.log(chalk.yellow(`[[ ${title} ]]`)); console.log(); const fileCache /*: {[key: string]: Array}*/ = {}; - const getFile = (filePath) => { + const getFile = filePath => { if (!fileCache[filePath]) { const ext = path.extname(filePath).slice(1); fileCache[filePath] = highlight(fs.readFileSync(filePath, 'utf8'), { @@ -36329,7 +36329,7 @@ const localReport = async (title /*:string*/, messages /*:Array*/) => { return fileCache[filePath]; }; const byFile /*:{[key: string]: number}*/ = {}; - messages.forEach((message) => { + messages.forEach(message => { const lines = getFile(message.path); const lineStart = Math.max(message.start.line - 3, 0); const indexStart = lineStart + 1; @@ -36341,9 +36341,7 @@ const localReport = async (title /*:string*/, messages /*:Array*/) => { } console.error( ':error:', - chalk.cyan( - `${message.path}:${message.start.line}:${message.start.column}`, - ), + chalk.cyan(`${message.path}:${message.start.line}:${message.start.column}`), ); console.error(message.message); console.error( @@ -36395,8 +36393,8 @@ const githubReport = async ( messages /*: Array*/, ) => { /* flow-uncovered-block */ - const { GitHub, context } = __webpack_require__(1469); - const { owner, repo } /*: {owner: string, repo: string}*/ = context.repo; + const {GitHub, context} = __webpack_require__(1469); + const {owner, repo} /*: {owner: string, repo: string}*/ = context.repo; const client = new GitHub(token, {}); const headSha = context.payload.pull_request.head.sha; const check = await client.checks.create({ @@ -36423,7 +36421,7 @@ const githubReport = async ( } /* end flow-uncovered-block */ - const annotations = messages.map((message) => ({ + const annotations = messages.map(message => ({ path: removeWorkspace(message.path), start_line: message.start.line, end_line: message.end.line, @@ -36432,7 +36430,7 @@ const githubReport = async ( })); let errorCount = 0; let warningCount = 0; - messages.forEach((message) => { + messages.forEach(message => { if (message.annotationLevel === 'failure') { errorCount += 1; } else { @@ -36463,7 +36461,7 @@ const githubReport = async ( } }; -const makeReport = (title /*: string*/, messages /*: Array*/) => { +const makeReport = (title /*: string*/, messages /*: Array*/) /*: Promise */ => { if (GITHUB_TOKEN) { return githubReport(title, GITHUB_TOKEN, messages); } else { @@ -86535,12 +86533,13 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; const execProm = __webpack_require__(5822); const path = __webpack_require__(5622); const fs = __webpack_require__(5747); -const minimatch = __webpack_require__(7093); +const minimatch = __webpack_require__(7093); // flow-uncovered-line -const getIgnoredPatterns = (fileContents) => { +// ok +const getIgnoredPatterns = (fileContents /*: string*/) => { return fileContents .split('\n') - .map((line) => { + .map(line => { if (line.startsWith('#')) { return null; } @@ -86551,10 +86550,7 @@ const getIgnoredPatterns = (fileContents) => { return null; } const [pattern, ...attributes] = line.trim().split(' '); - if ( - attributes.includes('binary') || - attributes.includes('linguist-generated=true') - ) { + if (attributes.includes('binary') || attributes.includes('linguist-generated=true')) { return pattern; } return null; @@ -86562,8 +86558,8 @@ const getIgnoredPatterns = (fileContents) => { .filter(Boolean); }; -const ignoredPatternsByDirectory = {}; -const isFileIgnored = (workingDirectory, file) => { +const ignoredPatternsByDirectory /*: {[key: string]: Array}*/ = {}; +const isFileIgnored = (workingDirectory /*: string*/, file /*: string*/) => { // If it's outside of the "working directory", we ignore it if (!file.startsWith(workingDirectory)) { return true; @@ -86582,6 +86578,7 @@ const isFileIgnored = (workingDirectory, file) => { } } for (const pattern of ignoredPatternsByDirectory[dir]) { + // flow-next-uncovered-line if (minimatch(name, pattern)) { return true; } @@ -86598,10 +86595,7 @@ const isFileIgnored = (workingDirectory, file) => { * It also respects '.gitattributes', filtering out files that have been marked * as "binary" or "linguist-generated=true". */ -const gitChangedFiles = async ( - base /*:string*/, - cwd /*:string*/, -) /*: Promise>*/ => { +const gitChangedFiles = async (base /*:string*/, cwd /*:string*/) /*: Promise>*/ => { cwd = path.resolve(cwd); // Github actions jobs can run the following steps to get a fully accurate @@ -86621,22 +86615,23 @@ const gitChangedFiles = async ( // ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' // if (process.env.ALL_CHANGED_FILES) { - const files = JSON.parse(process.env.ALL_CHANGED_FILES) - return files.filter(path => !isFileIgnored(cwd, path)) + const files /*: Array */ = JSON.parse(process.env.ALL_CHANGED_FILES); // flow-uncovered-line + return files.filter(path => !isFileIgnored(cwd, path)); } - const { stdout } = await execProm( - `git diff --name-only ${base} --relative`, - { cwd, encoding: 'utf8', rejectOnError: true }, - ); + const {stdout} = await execProm(`git diff --name-only ${base} --relative`, { + cwd, + encoding: 'utf8', + rejectOnError: true, + }); return ( stdout .split('\n') .filter(Boolean) - .map((name) => path.join(cwd, name)) + .map(name => path.join(cwd, name)) // Filter out paths that were deleted - .filter((path) => fs.existsSync(path)) - .filter((path) => !isFileIgnored(cwd, path)) + .filter((path /*: string*/) => fs.existsSync(path)) + .filter((path /*: string*/) => !isFileIgnored(cwd, path)) ); }; @@ -96950,36 +96945,36 @@ exports.quickSort = function (ary, comparator) { /** * A simple promisified version of child_process.exec, so we can `await` it */ -const { spawn } = __webpack_require__(3129); +const {spawn} = __webpack_require__(3129); const execProm = ( - command /*: string*/, - { rejectOnError, ...options } /*: {rejectOnError: boolean} & mixed */ = {} + command /*: string*/, + {rejectOnError, ...options} /*: {rejectOnError: boolean} & mixed */ = {}, ) /*: Promise<{err: ?number, stdout: string, stderr: string}>*/ => - new Promise((res, rej) => { - const proc = spawn( - command, - // $FlowFixMe - { ...options, shell: true } - ); - let stdout = ""; - let stderr = ""; - proc.stdout.setEncoding("utf8"); - proc.stderr.setEncoding("utf8"); - proc.stdout.on("data", (data /*: string*/) => (stdout += data)); - proc.stderr.on("data", (data /*: string*/) => (stderr += data)); - proc.on("close", (code /*: number*/) => { - if (code !== 0 && rejectOnError) { - rej(new Error(`Exited with non-zero error code: ${code}`)); - } else { - res({ - err: code === 0 ? null : code, - stdout, - stderr, + new Promise((res, rej) => { + const proc = spawn( + command, + // $FlowFixMe + {...options, shell: true}, + ); + let stdout = ''; + let stderr = ''; + proc.stdout.setEncoding('utf8'); + proc.stderr.setEncoding('utf8'); + proc.stdout.on('data', (data /*: string*/) => (stdout += data)); + proc.stderr.on('data', (data /*: string*/) => (stderr += data)); + proc.on('close', (code /*: number*/) => { + if (code !== 0 && rejectOnError) { + rej(new Error(`Exited with non-zero error code: ${code}`)); + } else { + res({ + err: code === 0 ? null : code, + stdout, + stderr, + }); + } }); - } }); - }); module.exports = execProm; @@ -106471,9 +106466,6 @@ module.exports = function(hljs) { // $FlowFixMe: shhhhh __webpack_require__(4285); // flow-uncovered-line -// A change to trigger things -// Bump - const sendReport = __webpack_require__(1876); const gitChangedFiles = __webpack_require__(5042); const getBaseRef = __webpack_require__(254); diff --git a/eslint.js b/eslint.js index fe9bce4..1c8fad6 100644 --- a/eslint.js +++ b/eslint.js @@ -13,9 +13,6 @@ // $FlowFixMe: shhhhh require('@babel/register'); // flow-uncovered-line -// A change to trigger things -// Bump - const sendReport = require('actions-utils/send-report'); const gitChangedFiles = require('actions-utils/git-changed-files'); const getBaseRef = require('actions-utils/get-base-ref'); diff --git a/package.json b/package.json index 1b72abe..de78f77 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@babel/core": "^7.9.6", "@babel/register": "^7.9.0", "@zeit/ncc": "^0.22.1", - "actions-utils": "git+https://git@github.com/Khan/actions-utils#changed-better", + "actions-utils": "git+https://git@github.com/Khan/actions-utils#v1.3.0", "actions-workflow-tools": "git+https://git@github.com/Khan/actions-workflow-tools#v1.2.5", "babel-eslint": "^10.1.0", "chalk": "^2.4.2", diff --git a/types.js b/types.js index f86c001..e488284 100644 --- a/types.js +++ b/types.js @@ -13,8 +13,6 @@ type LintSuggestion = { type Severity = 0 | 1 | 2; -// Change this file, and see if the child PR thinks it's changed as well - type LintMessage = { column: number, line: number, diff --git a/yarn.lock b/yarn.lock index d4d5195..92cfac7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1168,18 +1168,18 @@ acorn@^7.1.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.2.0.tgz#17ea7e40d7c8640ff54a694c889c26f31704effe" integrity sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ== -"actions-utils@git+https://git@github.com/Khan/actions-utils#changed-better": +"actions-utils@git+https://git@github.com/Khan/actions-utils#v1.2.5": version "1.2.4" - resolved "git+https://git@github.com/Khan/actions-utils#4d660a61d586f1581182c282a68c67385e695c36" + resolved "git+https://git@github.com/Khan/actions-utils#2fb7c74158e8f96f7f891c0d58f5c5feb08e8615" dependencies: "@actions/github" "^2.1.1" chalk "^2.4.2" cli-highlight "^2.1.4" minimatch "^3.0.4" -"actions-utils@git+https://git@github.com/Khan/actions-utils#v1.2.5": - version "1.2.4" - resolved "git+https://git@github.com/Khan/actions-utils#2fb7c74158e8f96f7f891c0d58f5c5feb08e8615" +"actions-utils@git+https://git@github.com/Khan/actions-utils#v1.3.0": + version "1.3.0" + resolved "git+https://git@github.com/Khan/actions-utils#6692c8f36918713728936a957c7ac9660aca374e" dependencies: "@actions/github" "^2.1.1" chalk "^2.4.2" From b9e0dacdb198b1509446fbf6aaab335506f271a4 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 4 Aug 2021 14:27:17 -0500 Subject: [PATCH 22/23] notes --- .github/workflow-templates/_setup.yml | 18 +++++++++--------- .github/workflows/pr-actions.yml | 14 +++----------- .github/workflows/pr-autofix.yml | 10 +--------- 3 files changed, 13 insertions(+), 29 deletions(-) diff --git a/.github/workflow-templates/_setup.yml b/.github/workflow-templates/_setup.yml index decefc2..6ef0e8d 100644 --- a/.github/workflow-templates/_setup.yml +++ b/.github/workflow-templates/_setup.yml @@ -2,24 +2,24 @@ setup: checkout: - uses: actions/checkout@v2 - name: get the repo - - uses: actions/checkout@v2 - name: get the base ref - with: - ref: '${{ github.base_ref }}' yarn: setup: checkout steps: - run: yarn + + # This gets the list of files that changed in the current pull-request + # and puts then onto the ALL_CHANGED_FILES env variable, which several + # of our actions will use. changed-files: steps: - name: Get All Changed Files - uses: jaredly/get-changed-files@89d3dca932c398add78c3a16b639ee42f9cae4d2 + uses: jaredly/get-changed-files@v1.0.1 id: changed with: - format: 'json' - absolute: true + format: 'json' # robust to filenames with spaces + absolute: true # our tooling expects absolute paths + # Now we put it on the environment so that it can be - uses: allenevans/set-env@v2.0.0 with: - ALL_CHANGED_FILES_DISABLED: '${{ steps.changed.outputs.added_modified }}' + ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' diff --git a/.github/workflows/pr-actions.yml b/.github/workflows/pr-actions.yml index 96e76ff..73f9124 100644 --- a/.github/workflows/pr-actions.yml +++ b/.github/workflows/pr-actions.yml @@ -7,27 +7,19 @@ jobs: lint_and_unit: runs-on: ubuntu-latest steps: - - name: "\U0001F53D Start setup [checkout]" - run: echo "Setting something up" - - uses: actions/checkout@v2 - name: get the repo - uses: actions/checkout@v2 - name: get the base ref - with: - ref: '${{ github.base_ref }}' - - name: "\U0001F53C Finished setup [checkout]" - run: echo "Finished setting it up" + name: '▶️ Setup checkout: ' - name: "\U0001F53D Start setup [changed-files]" run: echo "Setting something up" - name: Get All Changed Files - uses: jaredly/get-changed-files@89d3dca932c398add78c3a16b639ee42f9cae4d2 + uses: jaredly/get-changed-files@v1.0.1 id: changed with: format: json absolute: true - uses: allenevans/set-env@v2.0.0 with: - ALL_CHANGED_FILES_DISABLED: '${{ steps.changed.outputs.added_modified }}' + ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' - name: "\U0001F53C Finished setup [changed-files]" run: echo "Finished setting it up" - run: yarn diff --git a/.github/workflows/pr-autofix.yml b/.github/workflows/pr-autofix.yml index ad61bb7..9dadae8 100644 --- a/.github/workflows/pr-autofix.yml +++ b/.github/workflows/pr-autofix.yml @@ -8,16 +8,8 @@ jobs: runs-on: ubuntu-latest if: github.actor != 'khan-actions-bot' steps: - - name: "\U0001F53D Start setup [checkout]" - run: echo "Setting something up" - uses: actions/checkout@v2 - name: get the repo - - uses: actions/checkout@v2 - name: get the base ref - with: - ref: '${{ github.base_ref }}' - - name: "\U0001F53C Finished setup [checkout]" - run: echo "Finished setting it up" + name: '▶️ Setup checkout: ' - id: paths__github_workflow_templates_ name: 'Check paths: .github/workflow-templates/**' run: >- From cddbcd02834dc520c540715bbe24cd525708c75e Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 4 Aug 2021 14:46:02 -0500 Subject: [PATCH 23/23] feedbacks --- .github/workflow-templates/_setup.yml | 3 ++- .github/workflow-templates/pr-actions.yml | 2 +- .github/workflows/pr-actions.yml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflow-templates/_setup.yml b/.github/workflow-templates/_setup.yml index 6ef0e8d..40f250a 100644 --- a/.github/workflow-templates/_setup.yml +++ b/.github/workflow-templates/_setup.yml @@ -19,7 +19,8 @@ setup: format: 'json' # robust to filenames with spaces absolute: true # our tooling expects absolute paths - # Now we put it on the environment so that it can be + # Now we put it on the environment so that it can be picked up by + # anything that uses actions-utils (e.g. eslint-action, jest-action, etc.) - uses: allenevans/set-env@v2.0.0 with: ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}' diff --git a/.github/workflow-templates/pr-actions.yml b/.github/workflow-templates/pr-actions.yml index 24cf5d6..34273f7 100644 --- a/.github/workflow-templates/pr-actions.yml +++ b/.github/workflow-templates/pr-actions.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Run eslint - uses: Khan/eslint-action@da16c43dd352e1e606c838008e7f25e3bf3fbf97 + uses: Khan/eslint-action@main setup: [yarn, changed-files] with: eslint-lib: ./node_modules/eslint diff --git a/.github/workflows/pr-actions.yml b/.github/workflows/pr-actions.yml index 73f9124..e2920b6 100644 --- a/.github/workflows/pr-actions.yml +++ b/.github/workflows/pr-actions.yml @@ -25,7 +25,7 @@ jobs: - run: yarn name: '▶️ Setup yarn: ' - name: Run eslint - uses: Khan/eslint-action@da16c43dd352e1e606c838008e7f25e3bf3fbf97 + uses: Khan/eslint-action@main with: eslint-lib: ./node_modules/eslint env: