Update licenses #86
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Workflow to update licenses for x86 Linux and MacOS | |
name: Update licenses | |
on: | |
workflow_dispatch: | |
inputs: | |
linux: | |
description: "Update licenses for Ubuntu" | |
type: boolean | |
required: false | |
default: true | |
mac_silicon: | |
description: "Update licenses for macOS (silicon)" | |
type: boolean | |
required: false | |
default: true | |
mac_intel: | |
description: "Update licenses for macOS (intel)" | |
type: boolean | |
required: false | |
default: true | |
concurrency: | |
group: "${{ github.ref }}-${{ github.event_name }}-${{ github.workflow }}" | |
cancel-in-progress: true | |
jobs: | |
# Update licenses for all supported OS | |
update_licenses: | |
strategy: | |
matrix: | |
config: | |
- os_name: linux | |
if: ${{ inputs.linux }} | |
- os_name: mac_silicon | |
if: ${{ inputs.mac_silicon }} | |
- os_name: mac_intel | |
if: ${{ inputs.mac_intel }} | |
- os: ubuntu-latest | |
if: ${{ inputs.linux }} | |
- os: macos-latest-xlarge | |
if: ${{ inputs.mac_silicon }} | |
- os: macos-latest-large | |
if: ${{ inputs.mac_intel }} | |
runs-on: ${{ matrix.config.os }} | |
defaults: | |
run: | |
shell: bash | |
env: | |
PIP_INDEX_URL: ${{ secrets.PIP_INDEX_URL }} | |
PIP_EXTRA_INDEX_URL: ${{ secrets.PIP_EXTRA_INDEX_URL }} | |
steps: | |
# Mask internal URLs if logged | |
- name: Add masks | |
id: masks | |
run: | | |
echo "::add-mask::${{ secrets.INTERNAL_PYPI_URL_FOR_MASK }}" | |
echo "::add-mask::${{ secrets.INTERNAL_REPO_URL_FOR_MASK }}" | |
- name: Checkout Code | |
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 | |
with: | |
token: ${{ secrets.BOT_TOKEN }} | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d | |
with: | |
python-version: '3.8' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install poetry==1.7.1 | |
make setup_env | |
- name: Update licenses | |
run: | | |
make licenses | |
# Upload the updated license files as artifacts, if they exist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: licenses-${{ matrix.config.os_name }} | |
if-no-files-found: ignore | |
path: | | |
deps_licenses/licenses_${{ matrix.config.os_name }}_user.txt | |
deps_licenses/licenses_${{ matrix.config.os_name }}_user.txt.md5 | |
# Push the updates license files, as a PR or directly to the branch | |
push_licenses: | |
runs-on: ubuntu-latest | |
needs: [update_licenses] | |
steps: | |
# Mask internal URLs if logged | |
- name: Add masks | |
id: masks | |
run: | | |
echo "::add-mask::${{ secrets.INTERNAL_PYPI_URL_FOR_MASK }}" | |
echo "::add-mask::${{ secrets.INTERNAL_REPO_URL_FOR_MASK }}" | |
- name: Checkout Code | |
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 | |
with: | |
token: ${{ secrets.BOT_TOKEN }} | |
# Retrieve all updated license files | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
# If the target branch is main or a release branch, a pull request is opened for everyone to | |
# review | |
- name: Open PR | |
if: ${{ github.ref_name == 'main' || startsWith(github.ref_name , 'release/') }} | |
uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e | |
with: | |
token: ${{ secrets.BOT_TOKEN }} | |
commit-message: "chore: update licenses" | |
branch: "chore/update_licenses" | |
base: "${{ github.ref_name }}" | |
title: "Update licenses in ${{ github.ref_name }}" | |
body: "Update licenses in ${{ github.ref_name }}" | |
# If the target branch is another branch, the current branch is automatically merged into it | |
- name: Push changes into the current branch | |
if: ${{ github.ref_name != 'main' && !(startsWith(github.ref_name , 'release/')) }} | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: "chore: update licenses" | |
add_options: '-u' |