-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3717d59
commit e6675fd
Showing
2 changed files
with
17 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
title: Someone just pushed | ||
labels: bug | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,23 @@ | ||
name: Create Issue if Not Exists | ||
|
||
on: | ||
# .github/workflows/issue-on-push.yml | ||
on: | ||
push: | ||
branches: | ||
- development_issue_creation | ||
|
||
permissions: | ||
contents: read | ||
issues: write | ||
jobs: | ||
create_issue: | ||
stuff: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set issue title and body | ||
id: set_issue | ||
run: | | ||
ISSUE_TITLE="New Issue Title" | ||
ISSUE_BODY="This is the body of the new issue." | ||
echo "::set-output name=issue_title::$ISSUE_TITLE" | ||
echo "::set-output name=issue_body::$ISSUE_BODY" | ||
- name: Check for existing issues | ||
id: check_issue | ||
uses: actions/github-script@v6 | ||
- uses: actions/checkout@v3 | ||
- uses: JasonEtco/create-an-issue@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
script: | | ||
const title = process.env.ISSUE_TITLE; | ||
const { data: issues } = await github.rest.issues.listForRepo({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
state: 'open' | ||
}); | ||
const issueExists = issues.some(issue => issue.title === title); | ||
return { issueExists: issueExists }; | ||
- name: Create a new issue if not exists | ||
if: steps.check_issue.outputs.issueExists == 'false' | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const title = process.env.ISSUE_TITLE; | ||
const body = process.env.ISSUE_BODY; | ||
await github.rest.issues.create({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
title: title, | ||
body: body | ||
}); | ||
- name: Issue already exists | ||
if: steps.check_issue.outputs.issueExists == 'true' | ||
run: echo "Issue with title '${{ steps.set_issue.outputs.issue_title }}' already exists." | ||
search_existing: all | ||
filename: .github/issue_template.md | ||
|