1
0
Fork 0
mirror of https://github.com/actions/checkout.git synced 2024-11-23 00:49:40 +00:00
checkout/src
Johannes Schindelin 5a4ac9002d
Add missing awaits (#379)
* auth-helper: properly await replacement of the token value in the config

After writing the `.extraheader` config, we manually replace the token
with the actual value. This is done in an `async` function, but we were
not `await`ing the result.

In our tests, this commit fixes a flakiness we observed where
`remote.origin.url` sometimes (very rarely, actually) is not set for
submodules. Our interpretation is that the configs are in the process of
being rewritten with the correct token value _while_ another `git
config` that wants to set the `insteadOf` value is reading the config,
which is currently empty.

A more idiomatic way to fix this in Typescript would use
`Promise.all()`, like this:

      await Promise.all(
        configPaths.map(async configPath => {
          core.debug(`Replacing token placeholder in '${configPath}'`)
          await this.replaceTokenPlaceholder(configPath)
        })
      )

However, during review of https://github.com/actions/checkout/pull/379
it was decided to keep the `for` loop in the interest of simplicity.

Reported by Ian Lynagh.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

* downloadRepository(): await the result of recursive deletions

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

* Ask ESLint to report floating Promises

This rule is quite helpful in avoiding hard-to-debug missing `await`s.

Note: there are two locations in `src/main.ts` that trigger warnings:
the `run()` and the `cleanup()` function are called without `await` and
without any `.catch()` clause.

In the initial version of https://github.com/actions/checkout/pull/379,
this was addressed by adding `.catch()` clauses. However, it was
determined that this is boilerplate code that will need to be fixed in a
broader way.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

* Rebuild

This trick was brought to you by `npm ci && npm run build`. Needed to
get the PR build to pass.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2020-11-03 09:44:09 -05:00
..
misc add ssh support (#163) 2020-03-11 15:55:17 -04:00
fs-helper.ts Convert checkout to a regular action (#70) 2019-12-03 10:28:59 -05:00
git-auth-helper.ts Add missing awaits (#379) 2020-11-03 09:44:09 -05:00
git-command-manager.ts Remove unneeded commit information from build logs (#345) 2020-09-23 09:41:47 -04:00
git-directory-helper.ts Fetch all history for all tags and branches when fetch-depth=0 (#258) 2020-05-27 09:54:28 -04:00
git-source-provider.ts Remove unneeded commit information from build logs (#345) 2020-09-23 09:41:47 -04:00
git-source-settings.ts group output (#191) 2020-03-27 13:12:15 -04:00
git-version.ts Convert checkout to a regular action (#70) 2019-12-03 10:28:59 -05:00
github-api-helper.ts Add missing awaits (#379) 2020-11-03 09:44:09 -05:00
input-helper.ts update default branch (#305) 2020-07-14 09:23:30 -04:00
main.ts fallback to REST API to download repo (#104) 2019-12-12 13:16:16 -05:00
ref-helper.ts Fetch all history for all tags and branches when fetch-depth=0 (#258) 2020-05-27 09:54:28 -04:00
regexp-helper.ts add support for submodules (#173) 2020-03-05 14:21:59 -05:00
retry-helper.ts fallback to REST API to download repo (#104) 2019-12-12 13:16:16 -05:00
state-helper.ts add ssh support (#163) 2020-03-11 15:55:17 -04:00
url-helper.ts switch GITHUB_URL to GITHUB_SERVER_URL (#248) 2020-05-18 13:05:15 -04:00