From 2755cd9cbf7ec6f347b86d7370488f5aa11f50cd Mon Sep 17 00:00:00 2001 From: matttrach Date: Tue, 19 Aug 2025 11:17:25 -0500 Subject: [PATCH] fix: create issue when a pull request hits main Signed-off-by: matttrach --- .github/workflows/backport.yml | 2 +- .github/workflows/issue-comment-triage.yml | 21 --------------- .github/workflows/main-issue.yml | 30 ++++++++++++++++++++++ 3 files changed, 31 insertions(+), 22 deletions(-) delete mode 100644 .github/workflows/issue-comment-triage.yml create mode 100644 .github/workflows/main-issue.yml diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 22d3603..35085c3 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -1,5 +1,5 @@ name: Backports - +# This workflow generates "backport" issues when a release branch label is added to an issue on: issues: types: [labeled] # triggered when any label is added to an issue diff --git a/.github/workflows/issue-comment-triage.yml b/.github/workflows/issue-comment-triage.yml deleted file mode 100644 index 00017cd..0000000 --- a/.github/workflows/issue-comment-triage.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/main-issue.yml b/.github/workflows/main-issue.yml new file mode 100644 index 0000000..aa12788 --- /dev/null +++ b/.github/workflows/main-issue.yml @@ -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'] + });