-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Automatically add labels for all e2e-tests stages to PRs #3048
Changes from all commits
bcb5f34
a46423e
bb52a9c
1aa94ec
fe060ff
cc28bd1
d3df360
34e9e87
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: new-pr-opened | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
|
||
env: | ||
DEFAULT_LABEL: e2e-tests/not-run | ||
|
||
jobs: | ||
prepare_pr: | ||
name: Prepare new PR | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Add '${{ env.DEFAULT_LABEL}}' label | ||
id: add-label | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh pr edit ${{ github.event.number }} --add-label '${{ env.DEFAULT_LABEL}}' --repo $GITHUB_REPOSITORY |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,10 @@ on: | |
types: [created] | ||
|
||
env: | ||
E2E_LABEL: ok-to-merge | ||
E2E_LABELS_NOTRUN: e2e-tests/not-run | ||
E2E_LABELS_PASSED: e2e-tests/ok-to-merge | ||
E2E_LABELS_FAILED: e2e-tests/failed | ||
E2E_LABELS_RUNNING: e2e-tests/running | ||
|
||
jobs: | ||
triage: | ||
|
@@ -48,13 +51,13 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Remove '${{ env.E2E_LABEL}}' label | ||
- name: Remove '${{ env.E2E_LABELS_PASSED }}' label | ||
id: remove-label | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
gh pr edit ${{ needs.triage.outputs.pr_num }} --remove-label '${{ env.E2E_LABEL}}' | ||
gh pr edit ${{ needs.triage.outputs.pr_num }} --remove-label '${{ env.E2E_LABELS_PASSED}}' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add here other labels like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea, but will see if we want this based on the main conversation |
||
|
||
- name: Checkout Pull Request | ||
env: | ||
|
@@ -89,13 +92,37 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Remove '${{ env.E2E_LABEL}}' label | ||
id: remove-label | ||
- name: Remove '${{ env.E2E_LABELS_NOTRUN}}' label | ||
id: remove-not-run-label | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
gh pr edit ${{ needs.triage.outputs.pr_num }} --remove-label '${{ env.E2E_LABELS_NOTRUN}}' | ||
|
||
- name: Remove '${{ env.E2E_LABELS_PASSED}}' label | ||
id: remove-pass-label | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
gh pr edit ${{ needs.triage.outputs.pr_num }} --remove-label '${{ env.E2E_LABELS_PASSED}}' | ||
|
||
- name: Remove '${{ env.E2E_LABELS_FAILED }}' label | ||
id: remove-failed-label | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
gh pr edit ${{ needs.triage.outputs.pr_num }} --remove-label '${{ env.E2E_LABEL}}' | ||
gh pr edit ${{ needs.triage.outputs.pr_num }} --remove-label '${{ env.E2E_LABELS_FAILED }}' | ||
|
||
- name: Add '${{ env.E2E_LABELS_RUNNING }}' label | ||
id: add-running-label | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
gh pr edit ${{ needs.triage.outputs.pr_num }} --add-label '${{ env.E2E_LABELS_RUNNING }}' | ||
Comment on lines
+95
to
+125
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we merge these 3 steps into a single one? We can reduce a lot of lines just appending the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea, but will see if we want this based on the main conversation |
||
|
||
- name: Checkout Pull Request | ||
env: | ||
|
@@ -168,6 +195,14 @@ jobs: | |
AZURE_SUBSCRIPTION: ${{ secrets.AZURE_SUBSCRIPTION }} | ||
TEST_CLUSTER_NAME: keda-pr-run | ||
|
||
- name: Remove '${{ env.E2E_LABELS_RUNNING }}' label | ||
id: remove-running-label | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
gh pr edit ${{ needs.triage.outputs.pr_num }} --remove-label '${{ env.E2E_LABELS_RUNNING }}' | ||
|
||
- name: React to comment with success | ||
uses: dkershner6/reaction-action@v1 | ||
if: steps.test.outcome == 'success' | ||
|
@@ -176,14 +211,14 @@ jobs: | |
commentId: ${{ github.event.comment.id }} | ||
reaction: "+1" | ||
|
||
- name: Add '${{ env.E2E_LABEL}}' label | ||
id: add-label | ||
- name: Add '${{ env.E2E_LABELS_PASSED }}' label | ||
id: add-pass-label | ||
if: steps.test.outcome == 'success' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
gh pr edit ${{ needs.triage.outputs.pr_num }} --add-label '${{ env.E2E_LABEL}}' | ||
gh pr edit ${{ needs.triage.outputs.pr_num }} --add-label '${{ env.E2E_LABELS_PASSED }}' | ||
|
||
- name: React to comment with failure | ||
uses: dkershner6/reaction-action@v1 | ||
|
@@ -192,3 +227,12 @@ jobs: | |
token: ${{ secrets.GITHUB_TOKEN }} | ||
commentId: ${{ github.event.comment.id }} | ||
reaction: "-1" | ||
|
||
- name: Add '${{ env.E2E_LABELS_FAILED }}' label | ||
id: add-failure-label | ||
if: steps.test.outcome != 'success' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
gh pr edit ${{ needs.triage.outputs.pr_num }} --add-label '${{ env.E2E_LABELS_FAILED }}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we do this also in reopen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd keep the current label state as the test might have already ran successfully, no?