ci: add github action for backport and automation issues
Signed-off-by: Yang Chiu <yang.chiu@suse.com>
This commit is contained in:
parent
3375a5b613
commit
3e972418a9
50
.github/workflows/close-issue.yml
vendored
Normal file
50
.github/workflows/close-issue.yml
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
name: Close-Issue
|
||||
on:
|
||||
issues:
|
||||
types: [unlabeled]
|
||||
jobs:
|
||||
backport:
|
||||
runs-on: ubuntu-latest
|
||||
if: contains(github.event.label.name, 'backport-needed')
|
||||
steps:
|
||||
- name: Get Backport Version
|
||||
uses: xom9ikk/split@v1
|
||||
id: split
|
||||
with:
|
||||
string: ${{ github.event.label.name }}
|
||||
separator: /
|
||||
- name: Check if Backport Issue Exists
|
||||
uses: actions-cool/issues-helper@v3
|
||||
id: if-backport-issue-exists
|
||||
with:
|
||||
actions: 'find-issues'
|
||||
token: ${{ github.token }}
|
||||
title-includes: |
|
||||
[BACKPORT][v${{ steps.split.outputs._1 }}]${{ github.event.issue.title }}
|
||||
- name: Close Backport Issue
|
||||
if: fromJSON(steps.if-backport-issue-exists.outputs.issues)[0] != null
|
||||
uses: actions-cool/issues-helper@v3
|
||||
with:
|
||||
actions: 'close-issue'
|
||||
token: ${{ github.token }}
|
||||
issue-number: ${{ fromJSON(steps.if-backport-issue-exists.outputs.issues)[0].number }}
|
||||
|
||||
automation:
|
||||
runs-on: ubuntu-latest
|
||||
if: contains(github.event.label.name, 'require/automation-e2e')
|
||||
steps:
|
||||
- name: Check if Automation Issue Exists
|
||||
uses: actions-cool/issues-helper@v3
|
||||
id: if-automation-issue-exists
|
||||
with:
|
||||
actions: 'find-issues'
|
||||
token: ${{ github.token }}
|
||||
title-includes: |
|
||||
[TEST]${{ github.event.issue.title }}
|
||||
- name: Close Automation Test Issue
|
||||
if: fromJSON(steps.if-automation-issue-exists.outputs.issues)[0] != null
|
||||
uses: actions-cool/issues-helper@v3
|
||||
with:
|
||||
actions: 'close-issue'
|
||||
token: ${{ github.token }}
|
||||
issue-number: ${{ fromJSON(steps.if-automation-issue-exists.outputs.issues)[0].number }}
|
94
.github/workflows/create-issue.yml
vendored
Normal file
94
.github/workflows/create-issue.yml
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
name: Create-Issue
|
||||
on:
|
||||
issues:
|
||||
types: [labeled]
|
||||
jobs:
|
||||
backport:
|
||||
runs-on: ubuntu-latest
|
||||
if: contains(github.event.label.name, 'backport-needed')
|
||||
steps:
|
||||
- name: Get Backport Version
|
||||
uses: xom9ikk/split@v1
|
||||
id: split
|
||||
with:
|
||||
string: ${{ github.event.label.name }}
|
||||
separator: /
|
||||
- name: Check if Backport Issue Exists
|
||||
uses: actions-cool/issues-helper@v3
|
||||
id: if-backport-issue-exists
|
||||
with:
|
||||
actions: 'find-issues'
|
||||
token: ${{ github.token }}
|
||||
issue-state: 'all'
|
||||
title-includes: |
|
||||
[BACKPORT][v${{ steps.split.outputs._1 }}]${{ github.event.issue.title }}
|
||||
- name: Get Milestone Object
|
||||
if: fromJSON(steps.if-backport-issue-exists.outputs.issues)[0] == null
|
||||
uses: longhorn/bot/milestone-action@master
|
||||
id: milestone
|
||||
with:
|
||||
token: ${{ github.token }}
|
||||
repository: ${{ github.repository }}
|
||||
milestone_name: v${{ steps.split.outputs._1 }}
|
||||
- name: Get Labels
|
||||
if: fromJSON(steps.if-backport-issue-exists.outputs.issues)[0] == null
|
||||
id: labels
|
||||
run: |
|
||||
RAW_LABELS="${{ join(github.event.issue.labels.*.name, ' ') }}"
|
||||
echo "RAW LABELS: $RAW_LABELS"
|
||||
LABELS=$(echo "$RAW_LABELS" | sed -r 's/\s*backport-needed\S+//g' | sed -r 's/\s*require\/automation-e2e//g' | xargs | sed 's/ /, /g')
|
||||
echo "LABELS: $LABELS"
|
||||
echo "::set-output name=labels::$LABELS"
|
||||
- name: Create Backport Issue
|
||||
if: fromJSON(steps.if-backport-issue-exists.outputs.issues)[0] == null
|
||||
uses: dacbd/create-issue-action@v1
|
||||
id: new-issue
|
||||
with:
|
||||
token: ${{ github.token }}
|
||||
title: |
|
||||
[BACKPORT][v${{ steps.split.outputs._1 }}]${{ github.event.issue.title }}
|
||||
body: |
|
||||
backport ${{ github.event.issue.html_url }}
|
||||
labels: ${{ steps.labels.outputs.labels }}
|
||||
milestone: ${{ fromJSON(steps.milestone.outputs.data).number }}
|
||||
assignees: ${{ join(github.event.issue.assignees.*.login, ', ') }}
|
||||
- name: Get Repo Id
|
||||
if: fromJSON(steps.if-backport-issue-exists.outputs.issues)[0] == null
|
||||
uses: octokit/request-action@v2.x
|
||||
id: repo
|
||||
with:
|
||||
route: GET /repos/${{ github.repository }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
- name: Add Backport Issue To Release
|
||||
if: 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:
|
||||
runs-on: ubuntu-latest
|
||||
if: contains(github.event.label.name, 'require/automation-e2e')
|
||||
steps:
|
||||
- name: Check if Automation Issue Exists
|
||||
uses: actions-cool/issues-helper@v3
|
||||
id: if-automation-issue-exists
|
||||
with:
|
||||
actions: 'find-issues'
|
||||
token: ${{ github.token }}
|
||||
issue-state: 'all'
|
||||
title-includes: |
|
||||
[TEST]${{ github.event.issue.title }}
|
||||
- name: Create Automation Test Issue
|
||||
if: fromJSON(steps.if-automation-issue-exists.outputs.issues)[0] == null
|
||||
uses: dacbd/create-issue-action@v1
|
||||
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
|
||||
assignees: ${{ join(github.event.issue.assignees.*.login, ', ') }}
|
Loading…
Reference in New Issue
Block a user