From 1e32da6389fa01c2ae23f16865e6859b8ac23e21 Mon Sep 17 00:00:00 2001 From: ryannikolaidis <1208590+ryannikolaidis@users.noreply.github.com> Date: Thu, 5 Oct 2023 14:58:39 -0700 Subject: [PATCH] build: fix merge queue issues (#1654) Closes #1482 There are two known issues when attempting to merge PRs via merge queue: - CodeQL fails with: ``` Error: ref 'refs/heads/gh-readonly-queue/main/pr-968-499f37f64b27c66d4fc68446dbea519860d06cf7' not found in this repository ``` - CI.changelog fails with: ``` Get current git ref Error: The process '/usr/bin/git' failed with exit code [1](https://github.com/Unstructured-IO/unstructured/actions/runs/5735977683/job/15544656682#step:2:1)28 ``` The error with CodeQL is a known and still [open issue](https://github.com/github/codeql-action/issues/1572). We don't current enforce branch protection for CodeQL, so probably our best compromise is to simply not run this on the merge queue event. There could be a narrow margin where some issue is introduced via merge, but we'll still see issues on individual branches and on pushes to main, so this is probably acceptable. The changelog job now has a checkout step prior to paths-filter which guarantees the git ref exists before attempting to execute the filter action. ## Testing Prior to this change, I was able to validate both the [CodeQL](https://github.com/ryan-nikolaidis/unstructured/actions/runs/6414128010) and [changelog](https://github.com/ryan-nikolaidis/unstructured/actions/runs/6414128007/job/17414065768) test errors With these changes, validated that the merge queue was able to [successfully run](https://github.com/ryan-nikolaidis/unstructured/actions/runs/6414511843/job/17415024319) the changelog CI job. --- .github/workflows/ci.yml | 2 ++ .github/workflows/codeql-analysis.yml | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba2e408d9..cf80e4aa3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -381,6 +381,8 @@ jobs: changelog: runs-on: ubuntu-latest steps: + # need to checkout otherwise paths-filter will fail on merge-queue trigger + - uses: actions/checkout@v3 - if: github.ref != 'refs/heads/main' uses: dorny/paths-filter@v2 id: changes diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index c73a855f3..917c194ce 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -17,8 +17,8 @@ on: pull_request: # The branches below must be a subset of the branches above branches: [ main ] - merge_group: - branches: [ main ] + # known issue that codeql doesn't support merge_queue event, recommendation is to skip it on merge_queue + # https://github.com/github/codeql-action/issues/1572 and https://github.com/github/codeql-action/issues/1537 schedule: - cron: '21 21 * * 5'