0
1
Fork 0
mirror of https://github.com/actions/checkout synced 2024-06-28 16:18:20 +02:00
Commit graph

31 commits

Author SHA1 Message Date
brian m. carlson 02ade5d400
Don't overwrite annotated tags with commit object
When checking out a repository with full history, a full clone is done
and then the ref is finally updated to point to the commit that caused
the workflow to be run.  Normally, this is a good protection against
someone pushing to the repository twice in short succession, but it
causes problems with annotated tags.

Specifically, because the entry in refs/tags is set to the commit hash,
if an annotated tag was used, the tag is turned merely into a
lightweight one, which breaks `git describe`.  Every other tag in the
repository will continue to remain a valid annotated tag except the one
for which the workflow was invoked, which is not what the user expected.

Let's work around this by not performing a fetch if what we're fetching
is a tag.  Technically, annotated tags can be anywhere in the hierarchy
at any ref, but this should work as a suitable heuristic for now.

Note that the proper solution would be to expose the revision of the
actual object and check against that instead of the commit, but it
doesn't presently appear that that information is exposed.  Also, we
explicitly do not case-fold since Git refs are case sensitive.
2022-02-14 23:18:53 +00:00
eric sciple ec3a7ce113
set insteadOf url for org-id (#621) 2021-11-01 11:43:18 -05:00
eric sciple 3d677ac575
script to generate license info (#614) 2021-10-19 14:30:04 -05:00
eric sciple eb8a193c1d
update dev dependencies and react to new linting rules (#611) 2021-10-19 09:52:57 -05:00
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
Thomas Boop a81bbbf829
Remove unneeded commit information from build logs (#345)
* Remove unneeded commit information from stdout
2020-09-23 09:41:47 -04:00
eric sciple 1433f62caa
update default branch (#305) 2020-07-14 09:23:30 -04:00
eric sciple fb6f360df2
fix default branch for .wiki and when using ssh (#284) 2020-06-18 10:20:33 -04:00
eric sciple 00a3be8934
determine default branch (#278) 2020-06-16 13:41:01 -04:00
eric sciple e52d022eb5
Fetch all history for all tags and branches when fetch-depth=0 (#258) 2020-05-27 09:54:28 -04:00
eric sciple 2ff2fbdea4
telemetry for incorrect merge commit (#253) 2020-05-21 11:09:16 -04:00
eric sciple 7523e23789
switch GITHUB_URL to GITHUB_SERVER_URL (#248) 2020-05-18 13:05:15 -04:00
eric sciple ac455590d1
consume new @actions/github for GHES support (#236) 2020-05-07 12:11:11 -04:00
eric sciple 01aecccf73
group output (#191) 2020-03-27 13:12:15 -04:00
eric sciple 85b1f35505
changes to support ghes alpha release (#199) 2020-03-25 15:12:22 -04:00
eric sciple 9a3a9ade82
persist core.sshCommand for submodules (#184)
* persist core.sshCommand for submodules

* update verbiage; add comments

* fail when submodules or ssh-key and fallback to REST API
2020-03-12 11:42:38 -04:00
eric sciple b2e6b7ed13
add ssh support (#163) 2020-03-11 15:55:17 -04:00
eric sciple 80602fafba
convert SSH URL to HTTPS (#179) 2020-03-10 10:45:50 -04:00
eric sciple 422dc45671
add support for submodules (#173) 2020-03-05 14:21:59 -05:00
eric sciple f219062370
more unit tests and corresponding refactoring (#174) 2020-03-02 11:33:30 -05:00
eric sciple f90c7b395d
follow proxy settings (#144) 2020-01-27 10:21:50 -05:00
eric sciple 090d9c9dfd
fix ref for pr closed event when a pr is merged (#141) 2020-01-21 14:17:04 -05:00
eric sciple bc50a995b8
Add link to doc for creating and using encyrpted secrets (#123) 2020-01-03 12:32:17 -05:00
eric sciple ae525b2262
fix issue checking detached when git less than 2.22 (#128) 2020-01-03 10:13:01 -05:00
eric sciple 722adc63f1
update examples to reference v2 tag (#110) 2019-12-13 00:00:48 -05:00
eric sciple a6747255bd
do not pass cred on command line (#108) 2019-12-12 14:04:04 -05:00
eric sciple c170eefc26
add input persist-credentials (#107) 2019-12-12 13:49:26 -05:00
eric sciple a572f640b0
fallback to REST API to download repo (#104) 2019-12-12 13:16:16 -05:00
eric sciple 689bf84be4
Do not delete cwd (#86) 2019-12-03 13:43:37 -05:00
eric sciple 8461dbfed3
update readme (#82) 2019-12-03 11:26:12 -05:00
eric sciple e347bba93b
Convert checkout to a regular action (#70) 2019-12-03 10:28:59 -05:00