-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from creative-commoners/pulls/1.0/initial
NEW Create action
- Loading branch information
Showing
3 changed files
with
79 additions
and
2 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,12 @@ | ||
name: Auto-tag | ||
on: | ||
push: | ||
tags: | ||
- '*.*.*' | ||
jobs: | ||
auto-tag: | ||
name: Auto-tag | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Auto-tag | ||
uses: silverstripe/gha-auto-tag@v1 |
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,2 +1,21 @@ | ||
# gha-issue | ||
GitHub Action - Creates a new issue with github-actions user as the author | ||
# GitHub Actions - Issue | ||
|
||
Create a new issue using a github-actions user as the author. These will be created on the account/repo that called the action. | ||
|
||
## Usage | ||
|
||
**workflow.yml** | ||
```yml | ||
steps: | ||
- name: Create issue | ||
uses: silverstripe/gha-issue@v1 | ||
with: | ||
title: My issue title | ||
description: | | ||
This text will appear in the body of the GitHub issue\n | ||
\n | ||
You can add line breaks\n | ||
\n | ||
## My heading\n | ||
- Markdown is supported\n | ||
``` |
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,46 @@ | ||
name: Create issue | ||
description: GitHub Action to create an issue as the github-actions user | ||
|
||
inputs: | ||
title: | ||
type: string | ||
required: true | ||
description: | ||
type: string | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
|
||
- name: Create issue | ||
shell: bash | ||
env: | ||
TITLE: ${{ inputs.title }} | ||
DESCRIPTION: ${{ inputs.description }} | ||
GITHUB_REPOSITORY: ${{ github.repository }} | ||
run: | | ||
# Escape double quotes '"' => '\"' | ||
TITLE=${TITLE//\"/\\\"} | ||
DESCRIPTION=${DESCRIPTION//\"/\\\"} | ||
# Create new pull-request via GitHub API | ||
# https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#create-an-issue | ||
RESP_CODE=$(curl -w %{http_code} -s -o /dev/null \ | ||
-X POST https://api.github.com/repos/$GITHUB_REPOSITORY/issues \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-H "Authorization: token ${{ github.token }}" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
-d @- << EOF | ||
{ | ||
"title": "$TITLE", | ||
"body": "$DESCRIPTION" | ||
} | ||
EOF | ||
) | ||
if [[ $RESP_CODE == "201" ]]; then | ||
echo "New issue created" | ||
else | ||
echo "Fail to create issue - HTTP response code was $RESP_CODE" | ||
exit 1 | ||
fi |