After checkout, the action currently logs the SHA-1 of the top most
commit. There are cases when this information is not very telling,
though. Consider the case of some automation that applies one or more
commits on top of what the repository already contained. If something
like this happens, the SHA-1 may be meaningless to the user. Given that
this information is unlikely to be programmatically evaluated, we may as
well include a bit more than only the commit SHA-1, in the hopes that it
provides some more useful information to the user.
To that end, this change proposes logging not just the SHA-1, but also
the commit summary. At the very least that gives a user a straw what to
look for if the commit is indeed not available locally, in the best case
we end up with a message about a merge commit, that helps users glean
information about the base commit as well:
> e0dcaaee9063ab55ffe2e0c8dcffb4a9611208f9 Merge e3aafdc7d10cf5002e39c5d4fe867d1b27d0ff7b into b77ffb30cfc5f58e957571d8541c6a7e3da19221
* 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>