Skip to content

docker workflow: add javascript mode for cache #385

docker workflow: add javascript mode for cache

docker workflow: add javascript mode for cache #385

Workflow file for this run

# Copyright 2024 Zaphiro Technologies
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: License Management
concurrency:
group: ${{github.repository}}-${{ github.ref_name }}-license
cancel-in-progress: true
on:
pull_request:
branches: [ main ]
types: [opened, reopened, ready_for_review, synchronize]
workflow_call:
inputs:
skip-dependecy:
required: false
default: false
type: boolean
description: True to skip license dependency check
skip-fix:
required: false
default: true
type: boolean
description: True to skip license fix
license-config-path:
required: false
default: '.github/config/.licenserc.yaml'
type: string
jobs:
license:
name: Check licenses
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
env:
GOPRIVATE: github.com/zaphiro-technologies/*
GH_ACCESS_TOKEN: ${{ secrets.REPO_PRIVATE_READ_PAT }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.REPO_PAT }}
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Fix License Header
if: ${{ ! inputs.skip-fix || inputs.skip-fix == '' }}
uses: apache/skywalking-eyes/[email protected]
with:
config: ${{ inputs.license-config-path || '.github/config/.licenserc.yaml' }}
mode: fix
# log: debug # optional: set the log level. The default value is `info`.
- name: Apply Changes
if: ${{ ! inputs.skip-fix || inputs.skip-fix == '' }}
uses: EndBug/add-and-commit@v9
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
author_name: License Bot
author_email: [email protected]
message: 'Automatic application of license header'
- run: git config --global url.https://[email protected]/.insteadOf https://github.com/
- if: ${{ (! inputs.skip-dependecy || inputs.skip-dependecy == '') && hashFiles('go.mod') != '' }}
name: Set up Go (Go project)
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- if: ${{ (! inputs.skip-dependecy || inputs.skip-dependecy == '') && hashFiles('go.mod') == '' }}
name: Set up Go (non-Go project)
uses: actions/setup-go@v5
with:
go-version: '>=1.20.0'
- if: ${{ ! inputs.skip-dependecy || inputs.skip-dependecy == '' }}
name: Check Dependencies' License
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
go install github.com/apache/skywalking-eyes/cmd/license-eye@latest
license-eye -c ${{ inputs.license-config-path || '.github/config/.licenserc.yaml' }} dep check
# NOTE: we are not using the action
# apache/skywalking-eyes/[email protected]
# since it uses a old version of golang.
# The file `.github/config/.licenserc.yaml` is required, or it will fail.