From 6bc08229eb9a7eaa4aef58f853649052cb34869f Mon Sep 17 00:00:00 2001 From: Filip Pospisil Date: Wed, 7 Feb 2024 16:07:40 +0100 Subject: [PATCH] prefix in different step? --- .github/workflows/main.yaml | 38 ++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 78fd727bc..24621d355 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -12,13 +12,35 @@ concurrency: cancel-in-progress: true jobs: - somerandomjob: + init: if: always() runs-on: ubuntu-latest name: utils fork check + env: + USER: "${{ github.repository_owner }}" + BRANCH: "${{ github.ref_name }}" + TOKEN: "${{ secrets.GITHUB_TOKEN }}" + outputs: + branchExists: ${{ steps.checkBranch.outputs.exists }} + steps: - - name: something - run: echo "somethingggg" + - name: Check for branch in vscode-uitests-tooling (macos, ubuntu) + id: checkBranch + run: | + REPO_URL="https://api.github.com/repos/$USER/vscode-uitests-tooling/branches" + RESPONSE=$(curl -s -H "Authorization: Bearer $TOKEN" "$REPO_URL") + + if ([ $? -ne 0 ]); then + echo "exists=false" >> $GITHUB_OUTPUT + fi + + BRANCH_EXISTS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="'"$BRANCH"'") | .name') + + if [ "$BRANCH_EXISTS" == "$BRANCH" ]; then + echo "exists=true" >> $GITHUB_OUTPUT + else + echo "exists=false" >> $GITHUB_OUTPUT + fi main: strategy: @@ -31,14 +53,20 @@ jobs: env: CODE_VERSION: ${{ matrix.version }} CODE_TYPE: ${{ matrix.type }} - TEST_RESO URCES: test-resources + TEST_RESOURCES: test-resources USER: "${{ github.repository_owner }}" BRANCH: "${{ github.ref_name }}" TOKEN: "${{ secrets.GITHUB_TOKEN }}" runs-on: ${{ matrix.os }} - needs: [ somerandomjob ] + needs: [ init ] steps: + - name: kill pipeline + run: | + echo ${{needs.init.outputs.branchExists}} + KILLER = "${{github.event.pull_request.user.login}}? + echo $KILLER + - name: Checkout Repository uses: actions/checkout@v4 with: