73 Commits

Author SHA1 Message Date
Michael B. Gale
1b76c0b9c1 Use withMockedEnv 2025-08-06 12:39:35 +01:00
Michael B. Gale
72770345eb Fix legacy SARIF categories for CQ in default setup 2025-08-06 10:14:36 +01:00
Chuan-kai Lin
ec836d6b8a build: refresh js files 2025-07-07 08:15:20 -07:00
Chuan-kai Lin
300d251cd6 build: refresh js files 2024-12-10 08:44:11 -08:00
github-actions[bot]
44e03577b2 Rebuild 2024-12-03 18:39:38 +00:00
Chuan-kai Lin
94b5d396bc build: refresh js files 2024-10-29 07:01:44 -07:00
Chuan-kai Lin
d64cca4b60 Rename determineMergeBaseCommitOid()
The name suggests that the function computes the merge base, which for
Git means specifically the best common ancestors between multiple
commits or branches (see `git merge-base`).

But what the function actually does is to calculate the HEAD commit of
the PR base branch, as derived from the PR merge commit that the action
analyzes. So even though the function has to do with "merge" and "base",
using the term "merge base" is still misleading at best.

This commit renames the function to determineBaseBranchHeadCommitOid(),
which more clearly indicates what the function does.
2024-10-03 08:43:36 -07:00
Chuan-kai Lin
955d00143d Extract runGitCommand() 2024-10-03 08:29:52 -07:00
nickfyson
978bdd643f fix test that runs flakily locally 2024-04-03 20:43:26 +01:00
Andrew Eisenberg
469786860d Address more comments from PR 2023-08-29 13:20:55 -07:00
Andrew Eisenberg
e603106d1a Add change note 2023-08-29 13:11:48 -07:00
Andrew Eisenberg
d721f69753 Add better error messages when determining merge-base
Avoid printing scary error messages to console when the current
directory is not a git repo. Instead provide a better reason for the git
failure and continue on.
2023-08-28 15:50:30 -07:00
Henry Mercer
c6d284324b Pull out a dedicated status report file 2023-08-07 16:13:59 +01:00
Henry Mercer
2637069a45 Resolve dependency cycles between actions-util and workflow 2023-07-19 17:21:33 +01:00
Henry Mercer
3a960869ac Simplify definitions of environment variables 2023-07-06 17:28:37 +01:00
Angela P Wen
4385ad5563 Send job_run_uuid to status report telemetry (#1685) 2023-06-20 23:45:51 -07:00
Henry Mercer
bf419682de Remove unused CODESCANNING_EVENT_NAME environment variable 2023-05-31 15:37:11 +01:00
Charis Kyriakou
94cc1dea00 Add override for code scanning analysis of default branch 2023-03-23 13:31:00 +00:00
Henry Mercer
5f644f971e Upgrade TypeScript to 9.2.0 2023-01-18 20:59:57 +00:00
Orhan Toy
b7028afcb4 Make sure env is reset between tests 2022-12-13 12:18:40 +00:00
Orhan Toy
ccee4c68ff Add tests for CODE_SCANNING_REF 2022-12-13 11:51:16 +00:00
Henry Mercer
79f8286c68 Refactoring: Separate out workflow related functionality
No semantic changes.
2022-11-23 19:27:01 +00:00
Henry Mercer
b498c79130 Remove concept of Actions / runner mode 2022-11-14 16:37:48 +00:00
David Verdeguer
a03f3bd585 Build js 2022-09-07 09:45:19 +02:00
Chris Gavin
5960bffd3f When running on a schedule, make a better guess about whether we're analyzing the default branch. 2022-08-25 10:58:16 +01:00
Angela P Wen
eeee462f05 Move debug artifact methods into separate file 2022-08-02 12:27:52 +02:00
Angela P Wen
5229df1eef Add unit test descriptions 2022-08-01 13:17:40 +02:00
Andrew Eisenberg
d068f5372a Fix failing tests 2022-03-25 10:00:47 -07:00
Alex Croteau
1eaaf07b91 Adds check on inputs and compiled files 2022-01-31 20:06:17 -05:00
Edoardo Pirovano
f360da772a Sanitize artifact name before using 2021-11-05 08:40:16 +00:00
Andrew Eisenberg
40568daca8 Fix compile errors introduced by typescript 4.4.2
4.4.2 introduces a breaking change that the variable in a catch clause
is now `unknown` type. So, we need to cast the `e`, `err`, or `error`
variables to type `Error`.
2021-09-10 14:06:27 -07:00
Henry Mercer
93c9da2c2e Reference exported names via import *.
Rather than via properties on default exports — see
https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md
2021-08-11 13:17:04 +01:00
Edoardo Pirovano
05fc5a885c Replace safeLoad with load 2021-07-27 22:12:26 +01:00
Edoardo Pirovano
d9849b8ca1 Rebuild after TypeScript version bump 2021-07-27 17:59:59 +01:00
Robert
146c897909 Upload CodeQL databases 2021-06-22 13:05:12 +01:00
Andrew Eisenberg
2c2ebdc5c5 Remove local environment running
This is a functionality that never worked perfectly and hasn't been
used for a while.

This allows developers to run the action on their local machine, but
the run was always flaky and never 100% mirrored what was happening on
the actions runner.
2021-06-02 11:26:11 -07:00
Andrew Eisenberg
3708898bf2 Add environment variables to signal feature and version to the CLI
This PR ensures environment variables are set before any invocation of
the CLI.  Here is a list of vars that are set:

https://github.com/github/codeql-coreql-team/issues/1124#issuecomment-852463521

This ensures the CLI knows the features and versions of the containing
actions/runner.

Additionally:

- Fix the user agent so that it more closely aligns with user agent
  spec
- Refactor environment variable initialization so that it all happens in
  one place and call.
- Move Mode, getRequiredEnvParam, setMode, getMode out of actions-util
  and into util. actions-util is meant for utils only called by the
  action, not the runner.

The `prepareLocalRunEnvironment()` method is most likely deprecated and
should be removed. I originally added it because I had a way of working
where I would run the action from my local machine to test out changes,
but this was always a little flaky. So, I no longer use this way of
working. I will probably remove it soon.
2021-06-02 11:06:02 -07:00
Andrew Eisenberg
47588796b4 Send the version and mode with the user agent
This commit changes the way the action determines if running in action
or runner mode. There is now an environment variable that is set at the
beginning of the process and elsewhere in the process, we can check to
see if the variable is set.
2021-05-31 09:03:29 -07:00
David Verdeguer
cd7eedd4a5 Address comments 2021-05-05 12:30:20 +02:00
David Verdeguer
3b741b35ad Use actionsUtil.computeAutomationID on upload-lib 2021-05-03 19:56:04 +02:00
David Verdeguer
519d0771c7 Add actions-util.getAutomationID() 2021-05-03 19:36:32 +02:00
Simon Engledew
ba14abbca7 Rewrite the ref to correctly point to refs/remotes
Fixes the rev-parse issues caused by https://github.com/github/codeql-action/pull/428
2021-03-25 13:08:55 +00:00
Simon Engledew
ef92c5ac5f Count the number of parents of the current commit to check it is still a merge
Work around a race condition in actions where sometimes GITHUB_SHA != git rev-parse head
2021-03-22 12:05:00 +00:00
Simon Engledew
1f07e287da Do not report warning: undefined 2021-02-01 16:32:13 +00:00
Simon Engledew
44ed1c6ce1 Remove pull request warnings 2021-01-29 10:42:37 +00:00
Simon Engledew
795b1923ec Swap method naming to account for new functionality 2021-01-22 13:52:03 +00:00
Simon Engledew
1a6f6a27b3 Implement PR feedback 2021-01-15 08:28:21 +00:00
Simon Engledew
0853901c0d Fix overzealous warning when PR scanning is not required 2021-01-13 12:28:24 +00:00
Simon Engledew
456cd431ff Improve test coverage 2021-01-04 12:05:37 +00:00
Simon Engledew
1511db33b3 Only check the steps of the job currently being run 2021-01-04 12:00:15 +00:00