From 93df164f9a53d214773a246b5338a3a6125478c9 Mon Sep 17 00:00:00 2001 From: Hussein Awala Date: Sun, 23 Jul 2023 00:24:47 +0200 Subject: [PATCH] https://github.com/actions/setup-python/issues/401 --- .github/actions/breeze/action.yml | 2 + .github/workflows/build-images.yml | 2 + .github/workflows/ci.yml | 6 +++ .github/workflows/sync_authors.yml | 67 ++++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 .github/workflows/sync_authors.yml diff --git a/.github/actions/breeze/action.yml b/.github/actions/breeze/action.yml index 77de5f2d295b4..99b18b3b230a6 100644 --- a/.github/actions/breeze/action.yml +++ b/.github/actions/breeze/action.yml @@ -31,6 +31,8 @@ runs: python-version: 3.8 cache: 'pip' cache-dependency-path: ./dev/breeze/setup* + env: + AGENT_TOOLSDIRECTORY: /opt/hostedtoolache - name: Cache breeze uses: actions/cache@v3 with: diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 4f1d06e86ff36..abc8c8c706790 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -111,6 +111,8 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 + env: + AGENT_TOOLSDIRECTORY: /opt/hostedtoolache - name: "Retrieve defaults from branch_defaults.py" # We cannot "execute" the branch_defaults.py python code here because that would be # a security problem (we cannot run any code that comes from the sources coming from the PR. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02939daf4f187..4fb7c67d2b2f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -387,6 +387,8 @@ jobs: python-version: "${{needs.build-info.outputs.default-python-version}}" cache: 'pip' cache-dependency-path: ./dev/breeze/setup* + env: + AGENT_TOOLSDIRECTORY: /opt/hostedtoolache - run: python -m pip install --editable ./dev/breeze/ - run: > breeze setup version || @@ -461,6 +463,8 @@ jobs: python-version: "${{needs.build-info.outputs.default-python-version}}" cache: 'pip' cache-dependency-path: ./dev/requirements.txt + env: + AGENT_TOOLSDIRECTORY: /opt/hostedtoolache - name: "Test examples of PROD image building" run: > cd ./docker_tests && @@ -576,6 +580,8 @@ jobs: python-version: "${{needs.build-info.outputs.default-python-version}}" cache: 'pip' cache-dependency-path: ./dev/breeze/setup* + env: + AGENT_TOOLSDIRECTORY: /opt/hostedtoolache - name: "Install Breeze" uses: ./.github/actions/breeze id: breeze diff --git a/.github/workflows/sync_authors.yml b/.github/workflows/sync_authors.yml new file mode 100644 index 0000000000000..61ccc28d6ba06 --- /dev/null +++ b/.github/workflows/sync_authors.yml @@ -0,0 +1,67 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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: Sync authors list + +on: # yamllint disable-line rule:truthy + schedule: + # min hr dom mon dow + - cron: '11 01 * * *' # daily at 1.11am + workflow_dispatch: + # only users with write access to apache/airflow can run manually + # https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow + +permissions: + contents: write + pull-requests: write + +jobs: + sync: + name: Sync + runs-on: [self-hosted, small] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + env: + AGENT_TOOLSDIRECTORY: /opt/hostedtoolache + + - name: Requests + run: | + pip install requests toml + + - name: Sync the authors list + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + python scripts/ci/runners/sync_authors.py + git config user.name "GitHub Actions" + git config user.email "actions@users.noreply.github.com" + if [ -n "$(git status --porcelain)" ]; then + branch=update-$(date +%s) + git add -A + git checkout -b $branch + git commit --message "Authors list automatic update" + git push origin $branch + gh pr create --title "Authors list automatic update" --body '' + fi