chore(ghaction): make auto-generated issues only from members
Signed-off-by: David Ko <dko@suse.com> Signed-off-by: davidko <dko@suse.com>
This commit is contained in:
parent
852cf2c3f0
commit
d87927ed85
185
.github/workflows/create-issue.yml
vendored
185
.github/workflows/create-issue.yml
vendored
@ -1,97 +1,114 @@
|
|||||||
name: Create-Issue
|
name: Create-Issue
|
||||||
on:
|
on:
|
||||||
issues:
|
issues:
|
||||||
types: [labeled]
|
types: [ labeled ]
|
||||||
jobs:
|
jobs:
|
||||||
backport:
|
backport:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: contains(github.event.label.name, 'backport/')
|
if: contains(github.event.label.name, 'backport/')
|
||||||
steps:
|
steps:
|
||||||
- name: Get Backport Version
|
- name: Is Longhorn Member
|
||||||
uses: xom9ikk/split@v1
|
uses: tspascoal/get-user-teams-membership@v1.0.4
|
||||||
id: split
|
id: is-longhorn-member
|
||||||
with:
|
with:
|
||||||
string: ${{ github.event.label.name }}
|
username: ${{ github.event.issue.user.login }}
|
||||||
separator: /
|
organization: longhorn
|
||||||
- name: Check if Backport Issue Exists
|
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||||
uses: actions-cool/issues-helper@v3
|
- name: Get Backport Version
|
||||||
id: if-backport-issue-exists
|
if: steps.is-longhorn-member.outputs.isTeamMember == 'true'
|
||||||
with:
|
uses: xom9ikk/split@v1
|
||||||
actions: 'find-issues'
|
id: split
|
||||||
token: ${{ github.token }}
|
with:
|
||||||
issue-state: 'all'
|
string: ${{ github.event.label.name }}
|
||||||
title-includes: |
|
separator: /
|
||||||
[BACKPORT][v${{ steps.split.outputs._1 }}]${{ github.event.issue.title }}
|
- name: Check if Backport Issue Exists
|
||||||
- name: Get Milestone Object
|
if: steps.is-longhorn-member.outputs.isTeamMember == 'true'
|
||||||
if: fromJSON(steps.if-backport-issue-exists.outputs.issues)[0] == null
|
uses: actions-cool/issues-helper@v3
|
||||||
uses: longhorn/bot/milestone-action@master
|
id: if-backport-issue-exists
|
||||||
id: milestone
|
with:
|
||||||
with:
|
actions: 'find-issues'
|
||||||
token: ${{ github.token }}
|
token: ${{ github.token }}
|
||||||
repository: ${{ github.repository }}
|
issue-state: 'all'
|
||||||
milestone_name: v${{ steps.split.outputs._1 }}
|
title-includes: |
|
||||||
- name: Get Labels
|
[BACKPORT][v${{ steps.split.outputs._1 }}]${{ github.event.issue.title }}
|
||||||
if: fromJSON(steps.if-backport-issue-exists.outputs.issues)[0] == null
|
- name: Get Milestone Object
|
||||||
id: labels
|
if: steps.is-longhorn-member.outputs.isTeamMember == 'true' && fromJSON(steps.if-backport-issue-exists.outputs.issues)[0] == null
|
||||||
run: |
|
uses: longhorn/bot/milestone-action@master
|
||||||
RAW_LABELS="${{ join(github.event.issue.labels.*.name, ' ') }}"
|
id: milestone
|
||||||
RAW_LABELS="${RAW_LABELS} kind/backport"
|
with:
|
||||||
echo "RAW LABELS: $RAW_LABELS"
|
token: ${{ github.token }}
|
||||||
LABELS=$(echo "$RAW_LABELS" | sed -r 's/\s*backport\S+//g' | sed -r 's/\s*require\/auto-e2e-test//g' | xargs | sed 's/ /, /g')
|
repository: ${{ github.repository }}
|
||||||
echo "LABELS: $LABELS"
|
milestone_name: v${{ steps.split.outputs._1 }}
|
||||||
echo "::set-output name=labels::$LABELS"
|
- name: Get Labels
|
||||||
- name: Create Backport Issue
|
if: steps.is-longhorn-member.outputs.isTeamMember == 'true' && fromJSON(steps.if-backport-issue-exists.outputs.issues)[0] == null
|
||||||
if: fromJSON(steps.if-backport-issue-exists.outputs.issues)[0] == null
|
id: labels
|
||||||
uses: dacbd/create-issue-action@v1
|
run: |
|
||||||
id: new-issue
|
RAW_LABELS="${{ join(github.event.issue.labels.*.name, ' ') }}"
|
||||||
with:
|
RAW_LABELS="${RAW_LABELS} kind/backport"
|
||||||
token: ${{ github.token }}
|
echo "RAW LABELS: $RAW_LABELS"
|
||||||
title: |
|
LABELS=$(echo "$RAW_LABELS" | sed -r 's/\s*backport\S+//g' | sed -r 's/\s*require\/auto-e2e-test//g' | xargs | sed 's/ /, /g')
|
||||||
[BACKPORT][v${{ steps.split.outputs._1 }}]${{ github.event.issue.title }}
|
echo "LABELS: $LABELS"
|
||||||
body: |
|
echo "::set-output name=labels::$LABELS"
|
||||||
backport ${{ github.event.issue.html_url }}
|
- name: Create Backport Issue
|
||||||
labels: ${{ steps.labels.outputs.labels }}
|
if: steps.is-longhorn-member.outputs.isTeamMember == 'true' && fromJSON(steps.if-backport-issue-exists.outputs.issues)[0] == null
|
||||||
milestone: ${{ fromJSON(steps.milestone.outputs.data).number }}
|
uses: dacbd/create-issue-action@v1
|
||||||
assignees: ${{ join(github.event.issue.assignees.*.login, ', ') }}
|
id: new-issue
|
||||||
- name: Get Repo Id
|
with:
|
||||||
if: fromJSON(steps.if-backport-issue-exists.outputs.issues)[0] == null
|
token: ${{ github.token }}
|
||||||
uses: octokit/request-action@v2.x
|
title: |
|
||||||
id: repo
|
[BACKPORT][v${{ steps.split.outputs._1 }}]${{ github.event.issue.title }}
|
||||||
with:
|
body: |
|
||||||
route: GET /repos/${{ github.repository }}
|
backport ${{ github.event.issue.html_url }}
|
||||||
env:
|
labels: ${{ steps.labels.outputs.labels }}
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
milestone: ${{ fromJSON(steps.milestone.outputs.data).number }}
|
||||||
- name: Add Backport Issue To Release
|
assignees: ${{ join(github.event.issue.assignees.*.login, ', ') }}
|
||||||
if: fromJSON(steps.if-backport-issue-exists.outputs.issues)[0] == null
|
- name: Get Repo Id
|
||||||
uses: longhorn/bot/add-zenhub-release-action@master
|
if: steps.is-longhorn-member.outputs.isTeamMember == 'true' && fromJSON(steps.if-backport-issue-exists.outputs.issues)[0] == null
|
||||||
with:
|
uses: octokit/request-action@v2.x
|
||||||
zenhub_token: ${{ secrets.ZENHUB_TOKEN }}
|
id: repo
|
||||||
repo_id: ${{ fromJSON(steps.repo.outputs.data).id }}
|
with:
|
||||||
issue_number: ${{ steps.new-issue.outputs.number }}
|
route: GET /repos/${{ github.repository }}
|
||||||
release_name: ${{ steps.split.outputs._1 }}
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
- name: Add Backport Issue To Release
|
||||||
|
if: steps.is-longhorn-member.outputs.isTeamMember == 'true' && fromJSON(steps.if-backport-issue-exists.outputs.issues)[0] == null
|
||||||
|
uses: longhorn/bot/add-zenhub-release-action@master
|
||||||
|
with:
|
||||||
|
zenhub_token: ${{ secrets.ZENHUB_TOKEN }}
|
||||||
|
repo_id: ${{ fromJSON(steps.repo.outputs.data).id }}
|
||||||
|
issue_number: ${{ steps.new-issue.outputs.number }}
|
||||||
|
release_name: ${{ steps.split.outputs._1 }}
|
||||||
|
|
||||||
automation:
|
automation:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: contains(github.event.label.name, 'require/auto-e2e-test')
|
if: contains(github.event.label.name, 'require/auto-e2e-test')
|
||||||
steps:
|
steps:
|
||||||
- name: Check if Automation Issue Exists
|
- name: Is Longhorn Member
|
||||||
uses: actions-cool/issues-helper@v3
|
uses: tspascoal/get-user-teams-membership@v1.0.4
|
||||||
id: if-automation-issue-exists
|
id: is-longhorn-member
|
||||||
with:
|
with:
|
||||||
actions: 'find-issues'
|
username: ${{ github.event.issue.user.login }}
|
||||||
token: ${{ github.token }}
|
organization: longhorn
|
||||||
issue-state: 'all'
|
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||||
title-includes: |
|
- name: Check if Automation Issue Exists
|
||||||
[TEST]${{ github.event.issue.title }}
|
if: steps.is-longhorn-member.outputs.isTeamMember == 'true'
|
||||||
- name: Create Automation Test Issue
|
uses: actions-cool/issues-helper@v3
|
||||||
if: fromJSON(steps.if-automation-issue-exists.outputs.issues)[0] == null
|
id: if-automation-issue-exists
|
||||||
uses: dacbd/create-issue-action@v1
|
with:
|
||||||
with:
|
actions: 'find-issues'
|
||||||
token: ${{ github.token }}
|
token: ${{ github.token }}
|
||||||
title: |
|
issue-state: 'all'
|
||||||
[TEST]${{ github.event.issue.title }}
|
title-includes: |
|
||||||
body: |
|
[TEST]${{ github.event.issue.title }}
|
||||||
adding/updating auto e2e test cases for ${{ github.event.issue.html_url }} if they can be automated
|
- name: Create Automation Test Issue
|
||||||
|
if: steps.is-longhorn-member.outputs.isTeamMember == 'true' && fromJSON(steps.if-automation-issue-exists.outputs.issues)[0] == null
|
||||||
cc @longhorn/qa
|
uses: dacbd/create-issue-action@v1
|
||||||
labels: kind/test
|
with:
|
||||||
|
token: ${{ github.token }}
|
||||||
|
title: |
|
||||||
|
[TEST]${{ github.event.issue.title }}
|
||||||
|
body: |
|
||||||
|
adding/updating auto e2e test cases for ${{ github.event.issue.html_url }} if they can be automated
|
||||||
|
|
||||||
|
cc @longhorn/qa
|
||||||
|
labels: kind/test
|
||||||
|
Loading…
Reference in New Issue
Block a user