Skip to content

Commit

Permalink
chore: screw the project and go right to issue
Browse files Browse the repository at this point in the history
  • Loading branch information
reinamora137 committed Sep 10, 2024
1 parent 2839c7c commit 3e2d88a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 50 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/create_issue_from_discussion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Create issue from discussion

on:
discussion:
types: [labeled]

jobs:
create-issue:
if: contains(fromJson('["explorer", "indexer"]'), github.event.label.name)
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Create issue
uses: actions/github-script@v6
with:
github-token: ${{ steps.generate_token.outputs.token }}
script: |
const label = context.payload.label.name;
const discussion = context.payload.discussion;
const repoMap = {
'explorer': 'stampchain-io/BTCStampsExplorer',
'indexer': 'stampchain-io/btc_stamps',
};
if (repoMap[label]) {
const [owner, repo] = repoMap[label].split('/');
await github.rest.issues.create({
owner: owner,
repo: repo,
title: `Discussion: ${discussion.title}`,
body: `Created from discussion: ${discussion.html_url}\n\n${discussion.body}`,
labels: ['from-discussion']
});
}
50 changes: 0 additions & 50 deletions .github/workflows/new_discussion_to_project.yml

This file was deleted.

0 comments on commit 3e2d88a

Please sign in to comment.