prevent panic when RootSpan not collected yet #5736
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: needs/changelog | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- labeled | |
- unlabeled | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
check-for-changelog: | |
if: contains(github.event.pull_request.labels.*.name, 'needs/changelog') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch refs | |
run: | | |
git fetch origin $GITHUB_BASE_REF:$GITHUB_BASE_REF | |
git fetch origin $GITHUB_REF:$GITHUB_REF | |
- name: Check if PR needs a changelog | |
id: check | |
run: | | |
set -x | |
shopt -s globstar | |
diff=$(git diff --name-only $GITHUB_BASE_REF...$GITHUB_REF -- **/.changes/unreleased) | |
diffReturn=$? | |
if [ $diffReturn -ne 0 ]; then | |
exit $diffReturn | |
fi | |
if [[ -z "$diff" ]]; then | |
echo "Changelog is required, but was not created." | |
exit 1 | |
else | |
echo "Changelog exists." | |
fi | |
- name: Add comment | |
uses: thollander/actions-comment-pull-request@v2 | |
if: always() && github.event.action == 'labeled' && steps.check.outcome != 'success' | |
with: | |
message: | | |
This PR has been marked with `needs/changelog`, but no changelog has been created. | |
Run `changie new` to generate one (see [CONTRIBUTING.md](https://github.com/dagger/dagger/blob/main/CONTRIBUTING.md) for details). |