From 7c9f9f5d388f79fbaa1f46463277ab1ac8d22930 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Fri, 29 Mar 2024 22:22:33 +0100 Subject: [PATCH] Update branch verification in GitHub workflows This commit modifies the branch verification procedure in the GitHub workflows file. The code now includes a condition that checks if the event is a release that has been published before proceeding with fetching from the main branch. For other cases, the procedure remains the same, with fetching taking place from the referenced branch. --- .github/workflows/packages.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index d6226e7af0..774ca7c502 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -42,8 +42,14 @@ jobs: uses: actions/checkout@v3 - name: Verify commit exists in branch run: | - git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* - git branch --remote --contains | grep origin/${BRANCH_NAME} + if [[ "${{ github.ref }}" == refs/tags/* && "${{ github.event_name }}" == "release" && "${{ github.event.action }}" == "published" ]]; then + git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* + git branch --remote --contains | grep origin/main + else + git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* + git branch --remote --contains | grep origin/${BRANCH_NAME} + fi + - name: Set VERSION variable run: | if [[ "${{ github.ref }}" == refs/tags/* && "${{ github.event_name }}" == "release" && "${{ github.event.action }}" == "published" ]]; then