This is an automated email from the ASF dual-hosted git repository.
ocket8888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new 14328dc License coverage GHA: Re-tidy pkgsite's go modules before
vendoring them (#6316)
14328dc is described below
commit 14328dc1d4cea65e99ea6de2ea516cf172239473
Author: Zach Hoffman <[email protected]>
AuthorDate: Wed Oct 27 19:40:45 2021 +0000
License coverage GHA: Re-tidy pkgsite's go modules before vendoring them
(#6316)
* Reorder YAML keys
* Set id to `go-version`
* License coverage GHA: Re-tidy pkgsite's go modules before vendoring them
* Bust non-tidy cache
---
.github/workflows/cache-config-tests.yml | 2 +-
.github/workflows/license-file-coverage.yml | 14 +++++++++++---
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/cache-config-tests.yml
b/.github/workflows/cache-config-tests.yml
index 63a1036..aad7660 100644
--- a/.github/workflows/cache-config-tests.yml
+++ b/.github/workflows/cache-config-tests.yml
@@ -22,8 +22,8 @@ env:
ATS_VERSION: 8.1.x
on:
- push:
workflow_dispatch:
+ push:
paths:
- .github/workflows/cache-config-tests.yml
- go.mod
diff --git a/.github/workflows/license-file-coverage.yml
b/.github/workflows/license-file-coverage.yml
index bb0f832..64ead4d 100644
--- a/.github/workflows/license-file-coverage.yml
+++ b/.github/workflows/license-file-coverage.yml
@@ -44,7 +44,8 @@ jobs:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- - name: go-version
+ - name: Go version
+ id: go-version
run: |
go_version="$(curl -L "${BLOB_URL}/GO_VERSION")" &&
echo "::set-output name=value::${go_version}"
@@ -68,15 +69,22 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ env.PKGSITE_DIR }}/vendor
- key: ${{ runner.os }}-go-${{ steps.go-version.outputs.value }}-${{
hashFiles('**/go.sum') }}-${{ hashFiles(format('{0}/{1}/{2}', env.PKGSITE_DIR,
env.COVERAGE_TEST_NAME, format('{0}.go', env.COVERAGE_TEST_NAME))) }}
+ key: ${{ runner.os }}-go-${{ steps.go-version.outputs.value
}}-tidy-${{ hashFiles('**/go.sum') }}-${{ hashFiles(format('{0}/{1}/{2}',
env.PKGSITE_DIR, env.COVERAGE_TEST_NAME, format('{0}.go',
env.COVERAGE_TEST_NAME))) }}
- name: Download Go modules for ${{ env.PKGSITE_REPO }}
run: |
- set -o errexit -o nounset -o xtrace
+ set -o errexit -o nounset -o xtrace -o pipefail
cd "$PKGSITE_DIR"
+ go_major_version_escaped="$(<<<"${{ steps.go-version.outputs.value
}}" grep -Eo '^[0-9]+\.[0-9]+' | sed 's/\./\\\./g')"
if [[ ! -e vendor/modules.txt ]]; then
+ if ! grep -q "go ${go_major_version_escaped}" go.mod; then
+ echo 'Go version in go.mod does not match, tidying modules...'
+ sed -Ei "s/^(go )[0-9].*/\1${go_major_version_escaped}/" go.mod
+ fi
go mod vendor
+ cp go.mod go.sum vendor/
else
echo "Modules are already downloaded."
+ mv vendor/{go.mod,go.sum} .
fi
- name: Run the License file coverage check
run: |