diff --git a/.github/workflows/_local_ci_check_pyproject_dependencies.yml b/.github/workflows/_local_ci_check_pyproject_dependencies.yml index f4d5815a..59444421 100644 --- a/.github/workflows/_local_ci_check_pyproject_dependencies.yml +++ b/.github/workflows/_local_ci_check_pyproject_dependencies.yml @@ -14,7 +14,7 @@ jobs: with: git_username: "TEAM 4.0[bot]" git_email: "TEAM4.0@SINTEF.no" - permanent_dependencies_branch: "ci/dependency-updates" + target_branch: "ci/dependency-updates" install_extras: "[dev,docs]" pr_labels: "CI/CD" secrets: diff --git a/.github/workflows/ci_cd_updated_default_branch.yml b/.github/workflows/ci_cd_updated_default_branch.yml index 68798a2d..26e6d0e1 100644 --- a/.github/workflows/ci_cd_updated_default_branch.yml +++ b/.github/workflows/ci_cd_updated_default_branch.yml @@ -26,6 +26,11 @@ on: default: false # Update permanent dependencies branch + update_dependencies_branch: + description: "Whether or not to update the permanent dependencies branch." + required: false + type: boolean + default: true permanent_dependencies_branch: description: "The branch name for the permanent dependency updates branch." required: false @@ -438,7 +443,7 @@ jobs: name: Update permanent dependencies branch runs-on: ubuntu-latest needs: deploy_docs - if: always() + if: always() && inputs.update_dependencies_branch steps: - name: Checkout ${{ github.repository }} diff --git a/.github/workflows/ci_check_pyproject_dependencies.yml b/.github/workflows/ci_check_pyproject_dependencies.yml index e4783d77..27399dfd 100644 --- a/.github/workflows/ci_check_pyproject_dependencies.yml +++ b/.github/workflows/ci_check_pyproject_dependencies.yml @@ -11,11 +11,16 @@ on: description: "A git user's email address (used to set the 'user.email' config option)." required: true type: string - permanent_dependencies_branch: - description: "The branch name for the permanent dependency updates branch." + target_branch: + description: "The branch name for the target of the opened PR." required: false type: string - default: "ci/dependency-updates" + default: "" + permanent_dependencies_branch: # DEPRECATED - v2.6.0 REMOVAL + description: "DEPRECATED - use `target_branch` instead. Will be removed in v2.6.0. The branch name for the permanent dependency updates branch." + required: false + type: string + default: "" python_version: description: "The Python version to use for the workflow." required: false @@ -63,7 +68,7 @@ on: default: false secrets: PAT: - description: "A personal access token (PAT) with rights to update the `permanent_dependencies_branch`. This will fallback on `GITHUB_TOKEN`." + description: "A personal access token (PAT) with rights to create PRs. This will fallback on `GITHUB_TOKEN`." required: false jobs: @@ -80,10 +85,38 @@ jobs: exit 1 fi - - name: Checkout permanent dependencies branch in ${{ github.repository }} + # Check the deprecated 'permanent_dependencies_branch' input. + if [ -z "${{ inputs.target_branch }}" && -z "${{ inputs.permanent_dependencies_branch }}" ]; then + # Scenario expected to be: One has not explicitly set 'permanent_dependencies_branch' previously, using the (old) default value. + # While not knowing that it is now deprecated, and one should instead use 'target_branch' with an explicitly set value. + # Cause of action: Set 'target_branch' to the (old) default value, and emit a deprecation warning. + + echo "::warning file=${{ github.workflow_ref }},title=Deprecation Warning::'permanent_dependencies_branch' is deprecated and will be removed in v2.6.0. Use 'target_branch' instead with explicit value. The old default value for 'permanent_dependencies_branch' was: 'ci/dependency-updates'." + echo "target_branch=ci/dependency-updates" >> $GITHUB_ENV + elif [ -z "${{ inputs.target_branch }}" && -n "${{ inputs.permanent_dependencies_branch }}" ]; then + # Scenario expected to be: One has set an explicit value for 'permanent_dependencies_branch' previously. + # While not knowing that it is now deprecated, and one should instead use 'target_branch' with an explicitly set value. + # Cause of action: Set 'target_branch' to the value of 'permanent_dependencies_branch', and emit a deprecation warning. + + echo "::warning file=${{ github.workflow_ref }},title=Deprecation Warning::'permanent_dependencies_branch' is deprecated and will be removed in v2.6.0. Use 'target_branch' instead." + echo "target_branch=${{ inputs.permanent_dependencies_branch }}" >> $GITHUB_ENV + elif [ -n "${{ inputs.target_branch }}" && -n "${{ inputs.permanent_dependencies_branch }}" ]; then + # Scenario expected to be: One has set an explicit value for both 'target_branch' and forgotten to remove the explicit value set for 'permanent_dependencies_branch'. + # Cause of action: Emit a warning and use value for 'target_branch'. + + echo "::warning file=${{ github.workflow_ref }},title=Deprecation Warning::'permanent_dependencies_branch' is deprecated and will be removed in v2.6.0. Use only 'target_branch' instead." + echo "target_branch=${{ inputs.target_branch }}" >> $GITHUB_ENV + elif [ -n "${{ inputs.target_branch }}" && -z "${{ inputs.permanent_dependencies_branch }}" ]; then + # Scenario expected to be: One has set an explicit value for 'target_branch' and is currently not using 'permanent_dependencies_branch'. + # Cause of action: Use value for 'target_branch'. + + echo "target_branch=${{ inputs.target_branch }}" >> $GITHUB_ENV + fi + + - name: Checkout ${{ env.target_branch }} in ${{ github.repository }} uses: actions/checkout@v4 with: - ref: ${{ inputs.permanent_dependencies_branch }} + ref: ${{ env.target_branch }} fetch-depth: 0 - name: Set up Python ${{ inputs.python_version }} diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 34453f53..0bc4a893 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -477,7 +477,7 @@ jobs: else STRICT= - echo "::warning file=ci_tests.yml,line=446,col=11,endColumn=18::Beware that the documentation may succeed building, but will not be rendered or built as intended. To ensure this is the case, set 'warnings_as_errors' to 'true' (using '--strict' (MkDocs) or '-W' (Sphinx))." + echo "::warning file=ci_tests.yml,line=467,col=11,endColumn=18::Beware that the documentation may succeed building, but will not be rendered or built as intended. To ensure this is the case, set 'warnings_as_errors' to 'true' (using '--strict' (MkDocs) or '-W' (Sphinx))." fi # Run build command diff --git a/docs/workflows/ci_cd_updated_default_branch.md b/docs/workflows/ci_cd_updated_default_branch.md index 1099f3fd..78c6e0e5 100644 --- a/docs/workflows/ci_cd_updated_default_branch.md +++ b/docs/workflows/ci_cd_updated_default_branch.md @@ -46,6 +46,7 @@ Inputs related to updating the permanent dependencies branch. | **Name** | **Description** | **Required** | **Default** | **Type** | |:--- |:--- |:---:|:---:|:---:| +| `update_dependencies_branch` | Whether or not to update the permanent dependencies branch. | No | `true` | _boolean_ | | `permanent_dependencies_branch` | The branch name for the permanent dependency updates branch. | No | ci/dependency-updates | _string_ | | `update_dependencies_pr_body_file` | Relative path to a PR body file from the root of the repository, which is used in the 'CI - Update dependencies PR' workflow, if used.

Example: `'.github/utils/pr_body_update_deps.txt'`. | No | _Empty string_ | _string_ | diff --git a/docs/workflows/ci_check_pyproject_dependencies.md b/docs/workflows/ci_check_pyproject_dependencies.md index 17eaf7ec..8d9190ac 100644 --- a/docs/workflows/ci_check_pyproject_dependencies.md +++ b/docs/workflows/ci_check_pyproject_dependencies.md @@ -62,7 +62,8 @@ The repository contains the following: |:--- |:--- |:---:|:---:|:---:| | `git_username` | A git username (used to set the 'user.name' config option). | **_Yes_** | | _string_ | | `git_email` | A git user's email address (used to set the 'user.email' config option). | **_Yes_** | | _string_ | -| `permanent_dependencies_branch` | The branch name for the permanent dependency updates branch. | No | ci/dependency-updates | _string_ | +| `target_branch` | The branch name for the target of the opened PR.

**Note**: If a value is not given for this nor `permanent_dependencies_branch`, the default value for `permanent_dependencies_branch` will be used until v2.6.0, whereafter providing an explicit value for `target_branch` is **required**. | No | _Empty string_ | _string_ | +| `permanent_dependencies_branch` | **DEPRECATED** - Will be removed in v2.6.0. Use `target_branch` instead.

The branch name for the permanent dependency updates branch. | No | ci/dependency-updates | _string_ | | `python_version` | The Python version to use for the workflow. | No | 3.9 | _string_ | | `install_extras` | Any extras to install from the local repository through 'pip'. Must be encapsulated in square parentheses (`[]`) and be separated by commas (`,`) without any spaces.

Example: `'[dev,release]'`. | No | _Empty string_ | _string_ | | `pr_body_file` | Relative path to PR body file from the root of the repository.

Example: `'.github/utils/pr_body_deps_check.txt'`. | No | _Empty string_ | _string_ | @@ -100,7 +101,7 @@ jobs: with: git_username: "Casper Welzel Andersen" git_email: "CasperWA@github.com" - permanent_dependencies_branch: "ci/dependency-updates" + target_branch: "ci/dependency-updates" python_version: "3.9" install_extras: "[dev]" pr_labels: "CI/CD"