fix: create issue when a pull request hits main (#20)
Signed-off-by: matttrach <matt.trachier@suse.com>
This commit is contained in:
parent
3d6c9eb5bb
commit
241b72e742
|
|
@ -1,5 +1,5 @@
|
||||||
name: Backports
|
name: Backports
|
||||||
|
# This workflow generates "backport" issues when a release branch label is added to an issue
|
||||||
on:
|
on:
|
||||||
issues:
|
issues:
|
||||||
types: [labeled] # triggered when any label is added to an issue
|
types: [labeled] # triggered when any label is added to an issue
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
# DO NOT EDIT - This GitHub Workflow is managed by automation
|
|
||||||
# https://github.com/hashicorp/terraform-devex-repos
|
|
||||||
name: Issue Comment Triage
|
|
||||||
|
|
||||||
on:
|
|
||||||
issue_comment:
|
|
||||||
types: [created]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
issue_comment_triage:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
# issue_comment events are triggered by comments on issues and pull requests. Checking the
|
|
||||||
# value of github.event.issue.pull_request tells us whether the issue is an issue or is
|
|
||||||
# actually a pull request, allowing us to dynamically set the gh subcommand:
|
|
||||||
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issue_comment-on-issues-only-or-pull-requests-only
|
|
||||||
COMMAND: ${{ github.event.issue.pull_request && 'pr' || 'issue' }}
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
steps:
|
|
||||||
- name: 'Remove waiting-response on comment'
|
|
||||||
run: gh ${{ env.COMMAND }} edit ${{ github.event.issue.html_url }} --remove-label waiting-response
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
name: MainIssue
|
||||||
|
# This workflow generates a "main" issue when a PR is created targeting main.
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
generate-issue:
|
||||||
|
name: 'Create Main Issue'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const repo = context.repo.repo;
|
||||||
|
const owner = context.repo.owner;
|
||||||
|
const pr = context.payload.pull_request;
|
||||||
|
|
||||||
|
// Create the main issue
|
||||||
|
const newIssue = await github.rest.issues.create({
|
||||||
|
owner: owner,
|
||||||
|
repo: repo,
|
||||||
|
title: pr.title,
|
||||||
|
body: "This is the main issue tracking #" + pr.number + "\n\n" +
|
||||||
|
"Please add labels indicating the release versions eg. 'version/v0'\n" +
|
||||||
|
"Please add comments for user issues which this issue addresses. \n" +
|
||||||
|
"Description copied from PR: \n" + pr.body,
|
||||||
|
labels: ['internal/main']
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue