Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Commit

Permalink
update v2
Browse files Browse the repository at this point in the history
  • Loading branch information
ame-yu committed Mar 27, 2020
1 parent 30d17ef commit 725c31f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
17 changes: 12 additions & 5 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
### Delete latest before release
# Delete latest before release
## Usage
### Example Workflow file
In this case i want keep my repository just 1 release.
```yml
name: Main
Expand All @@ -13,14 +15,19 @@ jobs:
uses: actions/checkout@v2

- name: Delete
uses: ame-yu/action-delete-latest-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: $ {{ github.repository }}
uses: ame-yu/action-delete-latest-release@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Release
uses: softprops/action-gh-release@v1
with:
name: type-your-release-name
tag_name: tag-here
```
### Inputs
| name | value | default | description |
| ---- | ----- | ------- | ----------- |
| github_token | string | | Token for the repo. Can be passed in using `${{ secrets.GITHUB_TOKEN }}`. |
| repository | string | '' | Repository name. Default or empty repository name represents current github repository.|
11 changes: 8 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
name: 'Delete latest release'
description: 'Delete latest release'
author: "ame-yu"
env:
"GITHUB_TOKEN": "As provided by Github Actions"
"GITHUB_REPOSITORY": "As provided by Github Actions"
inputs:
github_token:
description: 'Token for the repo. Can be passed in using $\{{ secrets.GITHUB_TOKEN }}'
required: true
repository:
description: 'Repository name. Default or empty value represents current github repository (${GITHUB_REPOSITORY})'
default: ''
required: false
runs:
using: "node12"
main: "dist/index.js"
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const { Octokit } = require("@octokit/rest");
const {env} = require ("process");
const token = env.GITHUB_TOKEN
const [owner, repo] = env.GITHUB_REPOSITORY.split("/")
const token = env.INPUT_GITHUB_TOKEN
const repository = env.INPUT_REPOSITORY || env.GITHUB_REPOSITORY
const [owner, repo] = repository.split("/")

const octokit = new Octokit({
auth: token
Expand Down

0 comments on commit 725c31f

Please sign in to comment.