Skip to content

Commit

Permalink
chore: prepare for v0.0.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
js-timbirkett committed Mar 30, 2022
1 parent c97d724 commit e4e9767
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 3 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/example_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Example Deployment
on:
pull_request:
branches:
- main
- master

jobs:
deploy:
runs-on: ubuntu-latest
if:
steps:
- uses: actions/checkout@v3
- uses: devopsmakers/pr-name-generator-action@v0.0.1
id: generator
- run: echo "Deploying ${{ steps.generator.outputs.name }}"
- name: Comment with link
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' }}
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.issue.number }}
body: |
Congratualations! You can access your PR environment at:
https://${{ steps.generator.outputs.name }}.example.com/
reactions: 'tada'
24 changes: 24 additions & 0 deletions .github/workflows/example_destroy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Example Destroy
on:
pull_request:
types:
- closed
branches:
- main
- master

jobs:
deploy:
runs-on: ubuntu-latest
if:
steps:
- uses: actions/checkout@v3
- uses: devopsmakers/pr-name-generator-action@v0.0.1
id: generator
- run: echo "Destroying ${{ steps.generator.outputs.name }}"
- name: Create comment
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.issue.number }}
body: |
Ephemeral environment: `${{ steps.generator.outputs.name }}` has been destroyed.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
# pr-name-generator-action
A Github action to create consistent names for PR based environments.
A Github action to create consistent, unique names for PR based environments.

Uses: [unique-names-generator](https://github.com/andreasonny83/unique-names-generator)
and a "seed" based on the repo owner, name and issue (PR) number to generate a
unique and consistent name. This makes it easy to deploy and clean up ephemaral
environments on PR open, close or merge without needing to keep track of a
non-deterministic unique name.

## Inputs
None.

## Outputs
### `name`
The generated unique and consistent name

## Example Usage
See:
- [example_deploy.yml](https://github.com/devopsmakers/pr-name-generator-action/blob/main/.github/workflows/example_deploy.yml)
- [example_destroy.yml](https://github.com/devopsmakers/pr-name-generator-action/blob/main/.github/workflows/example_destroy.yml)
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'PR Name Generator'
description: 'Generate a consistent, unique name based on PR'
outputs:
name:
description: 'The generated name'
description: 'The generated unique and consistent name'
runs:
using: 'node16'
main: 'dist/index.js'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pr-name-generator-action",
"version": "0.0.1",
"version": "v0.0.1",
"description": "A Github action to create consistent names for PR based environments",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit e4e9767

Please sign in to comment.