Skip to content

Commit 91d3aaa

Browse files
authored
fix(auto-merge): handle conditions when a PR event is dispatched, but no (#87)
PR URL is available fix(fuzz): upload failed fuzz testcase per test from matrix Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
1 parent ea0dfc9 commit 91d3aaa

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

.github/workflows/auto-merge.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,20 @@ jobs:
3434
contents: write
3535
pull-requests: write
3636
runs-on: ubuntu-latest
37-
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
37+
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' && github.event.pull_request.html_url != '' }}
3838
env:
3939
PR_URL: ${{ github.event.pull_request.html_url }}
4040
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4141
steps:
42-
- name: Dependabot metadata
42+
-
43+
name: Dependabot metadata
4344
id: metadata
4445
uses: dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a # v2.5.0
45-
- name: Auto-approve all dependabot PRs
46+
-
47+
name: Auto-approve all dependabot PRs
4648
run: gh pr review --approve "$PR_URL"
47-
- name: Auto-merge dependabot PRs for development dependencies
49+
-
50+
name: Auto-merge dependabot PRs for development dependencies
4851
if: ${{ contains(steps.metadata.outputs.dependency-group, 'development-dependencies') }}
4952
run: |
5053
set +e # Don't exit on error
@@ -65,7 +68,8 @@ jobs:
6568
echo "::error title=auto-merge::Failed to enable auto-merge"
6669
echo "$OUTPUT"
6770
exit $EXIT_CODE
68-
- name: Auto-merge dependabot PRs for go-openapi patches
71+
-
72+
name: Auto-merge dependabot PRs for go-openapi patches
6973
if: ${{ contains(steps.metadata.outputs.dependency-group, 'go-openapi-dependencies') && (steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch') }}
7074
run: |
7175
set +e # Don't exit on error
@@ -84,7 +88,8 @@ jobs:
8488
echo "::error title=auto-merge::Failed to enable auto-merge"
8589
echo "$OUTPUT"
8690
exit $EXIT_CODE
87-
- name: Auto-merge dependabot PRs for golang.org updates
91+
-
92+
name: Auto-merge dependabot PRs for golang.org updates
8893
if: ${{ contains(steps.metadata.outputs.dependency-group, 'golang-org-dependencies') }}
8994
run: |
9095
set +e # Don't exit on error
@@ -115,21 +120,25 @@ jobs:
115120
contents: write
116121
pull-requests: write
117122
runs-on: ubuntu-latest
118-
if: ${{ inputs.enable-organization-bot == 'true' && github.event.pull_request.user.login == inputs.organization-bot }}
123+
if: ${{ inputs.enable-organization-bot == 'true' && github.event.pull_request.user.login == inputs.organization-bot && github.event.pull_request.html_url != '' }}
119124
env:
120125
PR_URL: ${{ github.event.pull_request.html_url }}
121126
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122127
steps:
123-
- name: Checkout repository
128+
-
129+
name: Checkout repository
124130
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
125-
- name: Auto-approve all bot-go-openapi PRs
131+
-
132+
name: Auto-approve all bot-go-openapi PRs
126133
run: gh pr review --approve "$PR_URL"
127-
- name: Wait for all workflow runs to complete
134+
-
135+
name: Wait for all workflow runs to complete
128136
uses: go-openapi/gh-actions/ci-jobs/wait-pending-jobs@f7ed44020a2682556ac42fa9c210142495270354 # v1.4.5
129137
with:
130138
pr-url: ${{ env.PR_URL }}
131139
github-token: ${{ secrets.GITHUB_TOKEN }}
132-
- name: Auto-merge bot-go-openapi PRs
140+
-
141+
name: Auto-merge bot-go-openapi PRs
133142
run: |
134143
set +e # Don't exit on error
135144
OUTPUT=$(gh pr merge --auto --rebase "$PR_URL" 2>&1)

.github/workflows/fuzz-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,15 @@ jobs:
145145
name: Archive failed cases
146146
if: ${{ failure() }}
147147
run: |
148-
tar czf fuzzcase.tgz $(find "${{ matrix.package }}/testdata/fuzz" -type f)
148+
tar czf "fuzzcase-${{ matrix.test }}.tgz" $(find "${{ matrix.package }}/testdata/fuzz" -type f)
149149
-
150150
name: Upload failed cases
151151
if: ${{ failure() }}
152152
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
153153
# TODO(fredbi): ideally, after uploading, we should fire a pull request to add
154154
# this corpus to testdata.
155155
with:
156-
path: fuzzcase.tgz
156+
path: fuzzcase-${{ matrix.test }}.tgz
157157
name: '${{ runner.os }}-fuzz-corpus-failure'
158158
retention-days: 60
159159
-

0 commit comments

Comments
 (0)