Skip to content

Commit

Permalink
Generate constraints in PRs when upgrading dependencies (#20624)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
potiuk committed Jan 2, 2022
1 parent e877e7a commit f668fa7
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down

0 comments on commit f668fa7

Please sign in to comment.