Skip to content

Commit

Permalink
Merge pull request #35 from vaisakhkannan/OpenLiberty#998-Allow-input…
Browse files Browse the repository at this point in the history
…-LSP4IJ-PR-number

OpenLiberty#998 allow input lsp4 ij pr number
  • Loading branch information
vaisakhkannan authored Nov 15, 2024
2 parents 3e3c97c + cb5aad8 commit 0298b5d
Showing 1 changed file with 50 additions and 4 deletions.
54 changes: 50 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ on:
required: true
type: boolean
default: false
lsp4ijPrNumber:
description: 'If you checked this, please make sure to enter only the LSP4IJ PR number below'
required: true
type: boolean
default: false
refLsp4ij:
description: 'Reference/branch for Lsp4ij checkout'
type: string
Expand All @@ -45,7 +50,48 @@ on:
branches: [ main ]

jobs:
fetch_merge_commit_sha_from_lsp4ij_PR:
runs-on: ubuntu-latest
outputs:
pr_details: ${{ steps.extract.outputs.pr_details }}
checkout_name: ${{ steps.extract.outputs.checkout_name }}
env:
API_URL: https://api.github.com/repos/redhat-developer/lsp4ij/pulls
REF_LSP4IJ: ${{ inputs.refLsp4ij }}
LSP4IJ_BRANCH: ${{ inputs.lsp4ijBranch }}
name: Fetch Commit ${{ inputs.refLsp4ij || '' }}
steps:
- name: Extract Merge Commit SHA
shell: bash
id: extract
run: |
pr_details="${{ env.REF_LSP4IJ }}"
checkout_name="${{ env.LSP4IJ_BRANCH }}"
if [ "${{ inputs.lsp4ijPrNumber }}" == "true" ]; then
url="${{ env.API_URL }}/${{ env.REF_LSP4IJ }}"
pr_detail=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$url")
pr_details=$(jq -r '.merge_commit_sha' <<< "$pr_detail" | xargs)
echo "Merge commit SHA of PR ${{ env.REF_LSP4IJ }}: $pr_details"
checkout_name="${{ env.REF_LSP4IJ }}"
if [[ "$pr_details" == "null" ]]; then
echo "::warning file=::The merge commit SHA of the entered PR is null. Please try again later or use a different PR number."
fi
elif [ -z "$pr_details" ]; then
echo "No LSP4IJ checkout found. Using default case."
elif [ -z "$checkout_name" ]; then
echo "Merge Commit SHA/Branch Name/Tag : $pr_details"
checkout_name="${{ env.REF_LSP4IJ }}"
else
echo "Merge Commit SHA/Branch Name/Tag : $pr_details"
fi
# Set output for further steps
echo "pr_details=$pr_details" >> $GITHUB_OUTPUT
echo "checkout_name=$checkout_name" >> $GITHUB_OUTPUT
build:
needs: fetch_merge_commit_sha_from_lsp4ij_PR
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -63,8 +109,8 @@ jobs:
reportName: windows-test-report
env:
USE_LOCAL_PLUGIN: ${{ inputs.useLocalPlugin || false }}
REF_LSP4IJ: ${{ inputs.refLsp4ij }}
LSP4IJ_BRANCH: ${{ inputs.lsp4ijBranch || 'default' }}
REF_LSP4IJ: ${{ needs.fetch_merge_commit_sha_from_lsp4ij_PR.outputs.pr_details }}
LSP4IJ_BRANCH: ${{ needs.fetch_merge_commit_sha_from_lsp4ij_PR.outputs.checkout_name }}
REF_LTI_TAG: ${{ inputs.refLTITag }}
steps:
- name: Configure pagefile
Expand Down Expand Up @@ -108,7 +154,7 @@ jobs:
if: ${{ runner.os == 'Linux' && !failure() }}
uses: actions/[email protected]
with:
name: liberty-tools-intellij-LTI-${{ env.REF_LTI_TAG || 'default' }}-LSP4IJ-${{ env.LSP4IJ_BRANCH }}
name: liberty-tools-intellij-LTI-${{ env.REF_LTI_TAG || 'default' }}-LSP4IJ-${{ env.LSP4IJ_BRANCH || 'default' }}
path: |
./**/*liberty-tools-intellij*.zip
./**/libs/*liberty-tools-intellij*.jar
Expand All @@ -122,6 +168,6 @@ jobs:
if: ${{ failure() && steps.run_tests.conclusion == 'failure' }}
uses: actions/[email protected]
with:
name: ${{ matrix.reportName }}-LTI-${{ env.REF_LTI_TAG || 'default' }}-LSP4IJ-${{ env.LSP4IJ_BRANCH }}
name: ${{ matrix.reportName }}-LTI-${{ env.REF_LTI_TAG || 'default' }}-LSP4IJ-${{ env.LSP4IJ_BRANCH || 'default' }}
path: |
liberty-tools-intellij/build/reports/

0 comments on commit 0298b5d

Please sign in to comment.