Lara dsl deprecation #18
Workflow file for this run
This file contains hidden or 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: "Copilot Setup Steps" | |
| # Automatically run the setup steps when they are changed | |
| # Allows for streamlined validation, | |
| # and allow manual testing through the repository's "Actions" tab | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths: | |
| - .github/workflows/copilot-setup-steps.yml | |
| pull_request: | |
| paths: | |
| - .github/workflows/copilot-setup-steps.yml | |
| env: | |
| CLAVA_BRANCH: ${{ github.head_ref || github.ref_name }} | |
| jobs: | |
| # The job MUST be called `copilot-setup-steps` | |
| # otherwise it will not be picked up by Copilot. | |
| copilot-setup-steps: | |
| runs-on: ubuntu-latest | |
| # Permissions set just for the setup steps | |
| # Copilot has permissions to its branch | |
| permissions: | |
| # To allow us to clone the repo for setup | |
| contents: read | |
| # The setup steps - install our dependencies | |
| steps: | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| with: | |
| gradle-version: current | |
| dependency-graph: generate-and-submit | |
| - name: Checkout clava | |
| uses: actions/checkout@v4 | |
| with: | |
| path: clava | |
| - name: Determine repository refs | |
| id: repo-refs | |
| shell: bash | |
| env: | |
| BRANCH_NAME: ${{ env.CLAVA_BRANCH }} | |
| run: | | |
| set -euo pipefail | |
| determine_ref() { | |
| local prefix=$1 | |
| local repo=$2 | |
| local url="https://github.com/${repo}.git" | |
| local default_branch | |
| default_branch=$(git ls-remote --symref "$url" HEAD | awk '/^ref:/ {print $2}' | sed 's@refs/heads/@@') | |
| echo "${prefix}_default=${default_branch}" >> "$GITHUB_OUTPUT" | |
| echo "Default branch for ${repo} is '${default_branch}'" | |
| if git ls-remote --heads "$url" "refs/heads/${BRANCH_NAME}" >/dev/null; then | |
| echo "${prefix}_match=true" >> "$GITHUB_OUTPUT" | |
| echo "${prefix}_ref=${BRANCH_NAME}" >> "$GITHUB_OUTPUT" | |
| echo "Branch '${BRANCH_NAME}' exists in ${repo}" | |
| else | |
| echo "${prefix}_match=false" >> "$GITHUB_OUTPUT" | |
| echo "${prefix}_ref=${default_branch}" >> "$GITHUB_OUTPUT" | |
| echo "Branch '${BRANCH_NAME}' not found in ${repo}. Falling back to '${default_branch}'." | |
| fi | |
| } | |
| determine_ref "lara" "specs-feup/lara-framework" | |
| determine_ref "specs" "specs-feup/specs-java-libs" | |
| - name: Echo checks | |
| run: | | |
| echo "Clava branch: ${{ env.CLAVA_BRANCH }}" | |
| echo "Matching branch found (lara-framework): ${{ steps.repo-refs.outputs.lara_match }}" | |
| echo "Matching branch found (specs-java-libs): ${{ steps.repo-refs.outputs.specs_match }}" | |
| echo "Lara framework ref: ${{ steps.repo-refs.outputs.lara_ref }}" | |
| echo "Specs-java-libs ref: ${{ steps.repo-refs.outputs.specs_ref }}" | |
| echo "Lara framework default fallback: ${{ steps.repo-refs.outputs.lara_default }}" | |
| echo "Specs-java-libs default fallback: ${{ steps.repo-refs.outputs.specs_default }}" | |
| echo "Pull request base_ref (if any): ${{ github.base_ref }}" | |
| - name: Checkout lara-framework | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: specs-feup/lara-framework | |
| path: lara-framework | |
| ref: ${{ steps.repo-refs.outputs.lara_ref }} | |
| - name: Checkout specs-java-libs | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: specs-feup/specs-java-libs | |
| path: specs-java-libs | |
| ref: ${{ steps.repo-refs.outputs.specs_ref }} |