Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add changed-files output to find "Force CI run" label #249

Open
wants to merge 2 commits into
base: branch-24.12
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions .github/workflows/changed-files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
files_yaml:
type: string
required: true
transform_expr:
changed_files_transform_expr:
type: string
required: false
default: |
Expand All @@ -17,9 +17,15 @@ on:
}
) |
from_entries
force_ci_run_label:
type: string
required: false
default: ""
outputs:
changed_file_groups:
value: ${{ jobs.changed-files.outputs.transformed_output }}
value: ${{ jobs.changed-files.outputs.changed_file_groups }}
force_ci_run:
value: ${{ jobs.changed-files.outputs.force_ci_run }}

defaults:
run:
Expand All @@ -45,7 +51,8 @@ jobs:
runs-on: ubuntu-latest
name: "Check changed files"
outputs:
transformed_output: ${{ steps.transform-changed-files.outputs.transformed-output }}
changed_file_groups: ${{ steps.transform-output.outputs.changed-file-groups }}
force_ci_run: ${{ steps.transform-output.outputs.force-ci-run }}
steps:
- name: Get PR info
id: get-pr-info
Expand Down Expand Up @@ -73,6 +80,9 @@ jobs:
id: transform-changed-files
env:
CHANGED_FILES: ${{ toJSON(steps.changed-files.outputs) }}
TRANSFORM_EXPR: ${{ inputs.transform_expr }}
CHANGED_FILES_TRANSFORM_EXPR: ${{ inputs.changed_files_transform_expr }}
FORCE_CI_RUN_LABEL: ${{ inputs.force_ci_run_label }}
PR_INFO_LABELS: ${{ toJSON(fromJSON(steps.get-pr-info.outputs.pr-info).labels) }}
run: |
(echo -n "transformed-output="; jq -c -n "env.CHANGED_FILES | fromjson | $TRANSFORM_EXPR") | tee --append "$GITHUB_OUTPUT"
(echo -n "changed-file-groups="; jq -c -n "env.CHANGED_FILES | fromjson | $CHANGED_FILES_TRANSFORM_EXPR") | tee --append "$GITHUB_OUTPUT"
(echo -n "force-ci-run="; jq -c -n 'env.FORCE_CI_RUN_LABEL != "" and (env.PR_INFO_LABELS | fromjson | any(.name == env.FORCE_CI_RUN_LABEL))') | tee --append "$GITHUB_OUTPUT"