Skip to content

Update plugin com.android.library to v8.8.1 #1236

Update plugin com.android.library to v8.8.1

Update plugin com.android.library to v8.8.1 #1236

name: Check Snippet kttest Snippets
on:
pull_request:
types: [ opened, synchronize ]
# Allow the workflow to read the contents of the repository and pull request to be
# able to retrieve list of changed files.
permissions:
contents: read
pull-requests: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
get-github-context:
name: Get Branches And Changed Files
runs-on: ubuntu-latest
# Allow the workflow to read the contents of the repository and pull request to be
# able to retrieve list of changed files when PR is opened from forked repository.
permissions:
contents: read
pull-requests: read
steps:
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v8
- name: List Branches
run: |
echo current branch: ${{ steps.branch-name.outputs.current_branch }}
echo base ref branch branch: ${{ steps.branch-name.outputs.base_ref_branch }}
echo default branch: ${{ steps.branch-name.outputs.default_branch }}
- name: Get Changed Files
id: changed-files
uses: tj-actions/[email protected]
- name: Echo List Changed Files
run: |
echo Changed files:
echo ${{ steps.changed-files.outputs.all_changed_files }} | tr ' ' '\n'
- name: Echo Run Condition (any true to run)
run: |
echo Current branch starts with "release/": ${{ startsWith(steps.branch-name.outputs.current_branch, 'release/') }}
echo Base ref branch is "main": ${{ steps.branch-name.outputs.base_ref_branch == 'main' }}
echo Changed .kttest files: ${{ contains(steps.changed-files.outputs.all_changed_files, '.kttest') }}
outputs:
current_branch: ${{ steps.branch-name.outputs.current_branch }}
base_ref_branch: ${{ steps.branch-name.outputs.base_ref_branch }}
all_changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
check-kttest-snippets:
name: Check kttest Snippets
needs: get-github-context
runs-on: ubuntu-latest
if: |
needs.get-github-context.outputs.base_ref_branch == 'main' ||
startsWith(needs.get-github-context.outputs.current_branch, 'release/') ||
contains(needs.get-github-context.outputs.all_changed_files, '.kttest')
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'corretto'
- name: Run Python Script for All Files
if: needs.get-github-context.outputs.base_ref_branch == 'main' || startsWith(needs.get-github-context.outputs.current_branch, 'release/')
run: python3 scripts/check_kttest_snippets.py -all
- name: Filter Changed .kttest Files
if: contains(needs.get-github-context.outputs.all_changed_files, '.kttest')
run: |
kttest_files=$(echo '${{ needs.get-github-context.outputs.all_changed_files }}' | tr ' ' '\n' | grep '\.kttest$')
if [ -n "$kttest_files" ]; then
temp_file=$(mktemp)
echo "$kttest_files" > "$temp_file"
echo "TEMP_FILE=$temp_file" >> $GITHUB_ENV
fi
- name: Run Python Script With Changed .kttest Files
if: contains(needs.get-github-context.outputs.all_changed_files, '.kttest')
run: python3 scripts/check_kttest_snippets.py "$TEMP_FILE"
env:
TEMP_FILE: ${{ env.TEMP_FILE }}