This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new f668fa7  Generate constraints in PRs when upgrading dependencies 
(#20624)
f668fa7 is described below

commit f668fa7aebaf90da4f5da20276e547cf6486fa7c
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Sun Jan 2 15:31:26 2022 +0100

    Generate constraints in PRs when upgrading dependencies (#20624)
    
    The constraints generation was only happening in push/scheduled
    runs, but sometimes it is useful to check what constraints would
    be generated even in the PRs that change setup.py/setup.cfg
    
    The change causes constraint generation also in the PRs and only
    pushing the updated constraints is not executed in PRs.
---
 .github/workflows/ci.yml | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index daada88..ba0c295 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1267,8 +1267,7 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
       RUNS_ON: ${{ fromJson(needs.build-info.outputs.runsOn) }}
       PYTHON_MAJOR_MINOR_VERSION: ${{ matrix.python-version }}
       CURRENT_PYTHON_MAJOR_MINOR_VERSIONS_AS_STRING: 
${{needs.build-info.outputs.pythonVersionsListAsString}}
-    # Only run it for direct pushes and scheduled builds
-    if: github.event_name == 'push' || github.event_name == 'schedule'
+    if: needs.build-info.outputs.upgradeToNewerDependencies != 'false'
     steps:
       - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
         uses: actions/checkout@v2
@@ -1305,20 +1304,26 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
       - name: "Set constraints branch name"
         id: constraints-branch
         run: ./scripts/ci/constraints/ci_branch_constraints.sh
-      # only actually push it when we are in apache/airflow repository
+      # only actually checkout and push it when we are in apache/airflow 
repository
       - name: Checkout ${{ steps.constraints-branch.outputs.branch }}
         uses: actions/checkout@v2
-        if: github.repository == 'apache/airflow'
+        if: >
+          github.repository == 'apache/airflow' &&
+          (github.event_name == 'push' || github.event_name == 'schedule')
         with:
           path: "repo"
           ref: ${{ steps.constraints-branch.outputs.branch }}
           persist-credentials: false
       - name: "Commit changed constraint files for 
${{needs.build-info.outputs.pythonVersions}}"
         run: ./scripts/ci/constraints/ci_commit_constraints.sh
-        if: github.repository == 'apache/airflow'
+        if: >
+          github.repository == 'apache/airflow' &&
+          (github.event_name == 'push' || github.event_name == 'schedule')
       - name: "Push changes"
         uses: ./.github/actions/github-push-action
-        if: github.repository == 'apache/airflow'
+        if: >
+          github.repository == 'apache/airflow' &&
+          (github.event_name == 'push' || github.event_name == 'schedule')
         with:
           github_token: ${{ secrets.GITHUB_TOKEN }}
           branch: ${{ steps.constraints-branch.outputs.branch }}

Reply via email to