Unverified Commit be413309 authored by daz's avatar daz
Browse files

First cut at actions for dependency-graph

- Dependency graph init-script references published version of plugin jar.
- `dependency-graph-generate` action will:
     - Provision Gradle if required
     - Execute Gradle with dependency-graph plugin to generate graph JSON
     - Upload dependency-graph JSON file as workflow artifact
- `dependency-graph-submit` action will:
    - Download dependency-graph JSON artifact
    - Submit the graph via the GitHub dependency submission API
parent 1b2daf58
Loading
Loading
Loading
Loading
+19
Changes for actions/dependency-graph-generate/action.yml: 19 added lines, 0 removed lines.
Original line number Diff line number Diff line
name: "Dependency Graph Generate"
description: Calculates the complete dependency graph for the repository, saving it as a JSON artifact.

inputs:
  gradle-version:
    description: Gradle version to use. If specified, this Gradle version will be downloaded, added to the PATH and used for invoking Gradle.
    required: false

  gradle-executable:
    description: Path to the Gradle executable. If specified, this executable will be added to the PATH and used for invoking Gradle.
    required: false

  build-root-directory:
    description: Path to the root directory of the build. Default is the root of the GitHub workspace.
    required: false

runs:
  using: 'node16'
  main: '../../dist/dependency-graph-generate/index.js'
+12
Changes for actions/dependency-graph-submit/action.yml: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
name: "Dependency Graph Submit"
description: Retrieves a previously created dependency graph JSON and submits via the GitHub Dependency Submission API.

inputs:
  github-token:
    description: The GitHub token used to authenticate when submitting via the Dependency Submission API.
    default: ${{ github.token }}
    required: false

runs:
  using: 'node16'
  main: '../../dist/dependency-graph-submit/index.js'
+360 −17

File changed.

Preview size limit exceeded, changes collapsed.

+9 −1
Changes for package.json: 9 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -8,7 +8,13 @@
    "format": "prettier --write **/*.ts",
    "format-check": "prettier --check **/*.ts",
    "lint": "eslint src/**/*.ts",
    "compile": "ncc build src/main.ts --out dist/main --source-map --no-source-map-register && ncc build src/post.ts --out dist/post --source-map --no-source-map-register",

    "compile-main": "ncc build src/main.ts --out dist/main --source-map --no-source-map-register",
    "compile-post": "ncc build src/post.ts --out dist/post --source-map --no-source-map-register",
    "compile-dependency-graph-generate": "ncc build src/dependency-graph-generate.ts --out dist/dependency-graph-generate --source-map --no-source-map-register",
    "compile-dependency-graph-submit": "ncc build src/dependency-graph-submit.ts --out dist/dependency-graph-submit --source-map --no-source-map-register",
    "compile": "npm run compile-main && npm run compile-post && npm run compile-dependency-graph-generate && npm run compile-dependency-graph-submit",

    "test": "jest",
    "check": "npm run format && npm run lint",
    "build": "npm run check && npm run compile",
@@ -26,6 +32,7 @@
  ],
  "license": "MIT",
  "dependencies": {
    "@actions/artifact": "1.1.1",
    "@actions/cache": "3.2.1",
    "@actions/core": "1.10.0",
    "@actions/exec": "1.1.1",
@@ -33,6 +40,7 @@
    "@actions/glob": "0.4.0",
    "@actions/http-client": "2.1.0",
    "@actions/tool-cache": "2.0.1",
    "@octokit/rest": "19.0.11",
    "string-argv": "0.3.2"
  },
  "devDependencies": {
+24
Changes for src/dependency-graph-generate.ts: 24 added lines, 0 removed lines.
Original line number Diff line number Diff line
import * as core from '@actions/core'

import * as provisioner from './provision'
import * as dependencyGraph from './dependency-graph'

/**
 * The main entry point for the action, called by Github Actions for the step.
 */
export async function run(): Promise<void> {
    try {
        // Download and install Gradle if required
        const executable = await provisioner.provisionGradle()

        // Generate and upload dependency graph artifact
        await dependencyGraph.generateDependencyGraph(executable)
    } catch (error) {
        core.setFailed(String(error))
        if (error instanceof Error && error.stack) {
            core.info(error.stack)
        }
    }
}

run()
Loading