Check GitHub Issues #2
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
name: "Check GitHub Issues" | |
on: | |
issues: | |
types: [opened] | |
workflow_dispatch: | |
inputs: | |
title: | |
description: "Issue title" | |
required: true | |
type: string | |
jobs: | |
scan-issue: | |
name: "Scan Issue: ${{ inputs.title }}" | |
if: github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Parse title" | |
id: parse_title | |
shell: bash | |
run: | | |
title="${{ inputs.title }}" | |
org_name=$(echo "$title" | sed -n 's/.* - \([^\/]*\)\/.*/\1/p') | |
repo_name=$(echo "$title" | sed -n 's/.* - [^\/]*\/\([^ ]*\).*/\1/p') | |
project_name="$org_name/$repo_name" | |
echo "::set-output name=org_name::$org_name" | |
echo "::set-output name=repo_name::$repo_name" | |
echo "::set-output name=project_name::$project_name" | |
- name: "Find vcpkg.json" | |
id: find_vcpkg_json | |
shell: bash | |
run: | | |
project_name="${{ steps.parse_title.outputs.project_name }}" | |
repo_name="${{ steps.parse_title.outputs.repo_name }}" | |
# Find all vcpkg.json files in the ports/* directories | |
# Use jq to filter files based on the project_name or repo_name | |
vcpkg_json_path=$(find ports/*/vcpkg.json -exec jq -r --arg project_name "$project_name" --arg repo_name "$repo_name" \ | |
'select(.name == $project_name or .name == $repo_name) | input_filename' {} +) | |
if [ -z "$vcpkg_json_path" ]; then | |
echo "No matching vcpkg.json file found." | |
exit 1 | |
else | |
echo "Found vcpkg.json file: $vcpkg_json_path" | |
echo "::set-output name=vcpkg_json_path::$vcpkg_json_path" | |
fi |