From 53598eeef0f5900bbaa8962cfafea5719a1cfe7a Mon Sep 17 00:00:00 2001 From: Gwynne Raskind Date: Fri, 13 Oct 2023 21:14:48 -0500 Subject: [PATCH] serktjgh --- .../actions/generate-swift-dependencies/action.yml | 3 --- .../convert-dependency-graph.swift | 11 +++++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/actions/generate-swift-dependencies/action.yml b/.github/actions/generate-swift-dependencies/action.yml index def2e47..6240309 100644 --- a/.github/actions/generate-swift-dependencies/action.yml +++ b/.github/actions/generate-swift-dependencies/action.yml @@ -50,15 +50,12 @@ runs: id: graph env: PROJ: ${{ inputs.path || github.workspace }} - REPO_SPEC: ${{ inputs.repository || github.repository }} BRANCH: ${{ inputs.branch || github.ref }} COMMIT: ${{ inputs.commit || github.sha }} - TOKEN: ${{ inputs.token || github.token }} CORRELATOR: ${{ format('{0}-{1}-{2}-{3}', github.workflow_ref, github.job, github.action, runner.os) }} RUN_ID: ${{ github.run_id }} shell: bash run: | - export OWNER="${REPO_SPEC%%/*}" REPO="${REPO_SPEC#*/}" json1="$(swift package --package-path "${PROJ}" --skip-update --force-resolved-versions show-dependencies --format json)" echo "${json1}" json2="$(echo "${json1}" | "${GITHUB_ACTION_PATH}/convert-dependency-graph.swift")" diff --git a/.github/actions/generate-swift-dependencies/convert-dependency-graph.swift b/.github/actions/generate-swift-dependencies/convert-dependency-graph.swift index f4e45fb..155248f 100755 --- a/.github/actions/generate-swift-dependencies/convert-dependency-graph.swift +++ b/.github/actions/generate-swift-dependencies/convert-dependency-graph.swift @@ -40,8 +40,8 @@ struct GithubDependencyGraph: Codable { } let name: String, file: File, resolved: [String: Package] } - let owner: String, repo: String, version: Int, sha: String, ref: String, - job: Job, detector: Detector, scanned: Date, manifests: [String: Manifest] + let version: Int, sha: String, ref: String, job: Job, detector: Detector, + scanned: Date, manifests: [String: Manifest] } func env(_ name: String) -> String { @@ -58,9 +58,8 @@ func main() { encoder.dateEncodingStrategy = .iso8601 encoder.outputFormatting = [.withoutEscapingSlashes, .sortedKeys] - let owner = env("OWNER"), repo = env("REPO"), branch = env("BRANCH"), - commit = env("COMMIT"), correlator = env("CORRELATOR"), runId = env("RUN_ID"), - detector = env("GITHUB_ACTION"), detectorVer = env("GITHUB_ACTION_REF"), + let branch = env("BRANCH"), commit = env("COMMIT"), correlator = env("CORRELATOR"), + runId = env("RUN_ID"), detector = env("GITHUB_ACTION"), detectorVer = env("GITHUB_ACTION_REF"), detectorRepo = env("GITHUB_ACTION_REPOSITORY"), serverUrl = env("GITHUB_SERVER_URL") let dependencies = try! decoder.decode( @@ -89,7 +88,7 @@ func main() { handleDeps(dependencies) let graph = GithubDependencyGraph( - owner: owner, repo: repo, version: 0, sha: commit, ref: branch, + version: 0, sha: commit, ref: branch, job: .init(correlator: correlator, id: runId), detector: .init( name: .init(detector.drop(while: { $0 == "_" }).prefix(while: { $0 != "_" })),