Update docs action perms #29
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2024 Intel Corporation | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
--- | |
name: Integration Tests | |
on: | |
merge_group: null | |
pull_request: null | |
permissions: read-all | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
group-diff: | |
runs-on: ubuntu-latest | |
outputs: | |
groups: ${{ steps.group-list.outputs.FOLDERS }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Output Modified Group Directories | |
id: group-list | |
run: | | |
# Get diff array filtered by specific filetypes | |
DIFF=$(git diff --diff-filter=d \ | |
--name-only ${{ github.event.merge_group.base_sha || github.event.pull_request.base.sha }}...${{ github.event.merge_group.head_sha || github.event.pull_request.head.sha }} \ | |
-- '*/*Dockerfile' '*.py' '*.yaml' '*.yml' '*.sh' '*/*requirements.txt' '*.json' | \ | |
jq -R '.' | jq -sc '.' \ | |
) | |
# Search for compose files in each file to determine the container groups | |
DOCKER_COMPOSE_PATHS=() | |
for path in $(echo $DIFF | jq -r '.[]'); do | |
while [[ "$path" != "." ]]; do | |
DIR_PATH=$(dirname "$path") | |
if [ -n "$(find "$DIR_PATH" -name 'docker-compose.yaml' -print -quit)" ] && [ "$DIR_PATH" != "." ]; then | |
DOCKER_COMPOSE_PATHS+=("$DIR_PATH") | |
path="." | |
else | |
path="$DIR_PATH" | |
fi | |
done | |
done | |
# Convert the array to a JSON array | |
DOCKER_COMPOSE_PATHS_JSON=$(printf '%s\n' "${DOCKER_COMPOSE_PATHS[@]}" | jq -R '.' | jq -sc 'unique_by(.)') | |
echo "FOLDERS=$DOCKER_COMPOSE_PATHS_JSON" >> $GITHUB_OUTPUT | |
pipeline-ci: | |
needs: group-diff | |
if: needs.group-diff.outputs.groups != '[""]' | |
strategy: | |
matrix: | |
group: ${{ fromJson(needs.group-diff.outputs.groups) }} | |
experimental: [true] | |
fail-fast: false | |
uses: ./.github/workflows/container-ci.yaml | |
with: | |
group_dir: ${{ matrix.group }} | |
secrets: inherit | |
status-check: | |
needs: [ group-diff, pipeline-ci ] | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- run: exit 1 | |
if: >- | |
${{ | |
contains(needs.*.result, 'failure') | |
|| contains(needs.*.result, 'cancelled') | |
|| contains(needs.*.result, 'skipped') | |
&& needs.group-diff.outputs.groups != '[""]' | |
}} |