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.
This commit is contained in:
ryannikolaidis 2023-10-05 14:58:39 -07:00 committed by GitHub
parent e0201e9a11
commit 1e32da6389
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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'