Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add resolve-environment action #1684

Merged
merged 33 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
dce63d8
Add initial stub for `resolve-environment` action
mbg May 18, 2023
4322324
Add `resolveBuildEnvironment` to `CodeQL` type
mbg May 18, 2023
360d2b7
Update OS representation
mbg May 23, 2023
cc95e67
Add `resolve-environment` to `ActionName`
mbg May 26, 2023
4356c16
Add `runResolveBuildEnvironment`
mbg May 26, 2023
ee80b30
Add initial workflow code dependent on `init`
mbg May 26, 2023
0930314
Add token and matrix inputs
mbg May 26, 2023
4518431
Fix: rename output
mbg May 26, 2023
527ea94
Add `working-directory` input
mbg May 26, 2023
59a9e3a
Fix formatting for `runResolveBuildEnvironment`
mbg May 26, 2023
8216c3a
Install CodeQL as part of the action
mbg May 26, 2023
aef016d
Apply suggestions from code review
mbg May 30, 2023
ddb13a1
Rename `actionName` to `ACTION_NAME`
mbg Jun 2, 2023
fce65da
Remove `BuildEnvironmentOS`
mbg Jun 2, 2023
6f07b50
Propagate `--working-dir` argument
mbg Jun 2, 2023
e08f131
Include CLI output in JSON error
mbg Jun 6, 2023
829bba8
Do not download CLI
mbg Jun 12, 2023
64fa96a
Report success
mbg Jun 13, 2023
0b8c812
Add integration test for `resolve-environment`
mbg Jun 13, 2023
ef4bf4a
Use `nightly-latest` for test for now
mbg Jun 13, 2023
8e75e1a
Apply suggestions from code review
mbg Jun 13, 2023
16f3f1a
Remove `validateWorkflow` call
mbg Jun 13, 2023
6419f99
Handle case where `workingDir` is `undefined`
mbg Jun 13, 2023
efe0e21
Update action description
mbg Jun 13, 2023
1c73235
Update `working-directory` description
mbg Jun 13, 2023
ba64fee
Add CHANGELOG entry
mbg Jun 2, 2023
c878505
Improve changelog wording
mbg Jun 13, 2023
f239f49
Rebuild integration test workflow
mbg Jun 13, 2023
899b5a2
Continue after CLI errors
mbg Jun 14, 2023
7a9f099
Don't invoke CLI when command not supported
mbg Jun 15, 2023
eb9703e
Reformat
mbg Jun 15, 2023
7e5bafc
Use `stable-v2.13.4` for integration test
mbg Jun 15, 2023
d4006d9
Improve step name in integration test
mbg Jun 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/__resolve-environment-action.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## [UNRELEASED]

No user facing changes.
- Experimental: add a new `resolve-environment` action which attempts to infer a configuration for the build environment that is required to build a given project. Do not use this in production as it is part of an internal experiment and subject to change at any time.

## 2.20.0 - 13 Jun 2023

Expand Down
2 changes: 1 addition & 1 deletion lib/actions-util.js.map

Large diffs are not rendered by default.

25 changes: 24 additions & 1 deletion lib/codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/codeql.js.map

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions lib/resolve-environment-action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/resolve-environment-action.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions lib/resolve-environment.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/resolve-environment.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions pr-checks/checks/resolve-environment-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Resolve environment"
description: "Tests that the resolve-environment action works for Go"
versions: ["stable-v2.13.4"]
steps:
- uses: ./../action/init
with:
languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }}

- uses: ./../action/resolve-environment
id: resolve-environment
with:
language: go

- name: "Fail if no Go configuration was returned"
if: (!fromJSON(steps.resolve-environment.outputs.environment).configuration.go)
run: exit 1
23 changes: 23 additions & 0 deletions resolve-environment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'CodeQL: Resolve Build Environment'
description: '[Experimental] Attempt to infer a build environment suitable for automatic builds'
author: 'GitHub'
inputs:
token:
default: ${{ github.token }}
matrix:
default: ${{ toJson(matrix) }}
language:
description: The language to infer the build environment configuration for.
required: true
working-directory:
description: >-
Resolve the build environment based on the files located at the specified
path (relative to $GITHUB_WORKSPACE). If this input is not set, then the
build environment is resolved based on the files in $GITHUB_WORKSPACE.
required: false
outputs:
environment:
description: The inferred build environment configuration.
runs:
using: 'node16'
main: '../lib/resolve-environment-action.js'
3 changes: 2 additions & 1 deletion src/actions-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ type ActionName =
| "autobuild"
| "finish"
| "upload-sarif"
| "init-post";
| "init-post"
| "resolve-environment";
export type ActionStatus =
| "starting"
| "aborted"
Expand Down
Loading