Skip to content

Commit

Permalink
Revert "Add token, repo and sha input (#23)"
Browse files Browse the repository at this point in the history
This reverts commit ea75e8f.
  • Loading branch information
WebFreak001 committed Oct 27, 2023
1 parent ea75e8f commit 8edd321
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 23 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,4 @@ jobs:
asset_name: myapp_windows-nightly-$$.zip # name to upload the release as, use $$ to insert date (YYYYMMDD) and 6 letter commit hash
asset_content_type: application/zip # required by GitHub API
max_releases: 7 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
token: *** # optional, a github token. defaults to GITHUB_TOKEN
sha: 547fdf5 # optional, a commit SHA. Defaults to GITHUB_SHA
repo: Pure-D/serve-d # optional, the repository where the release is located
```
12 changes: 0 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,6 @@ inputs:
description: 'Maximum number of historical releases with the given asset_name to keep'
required: false
default: 7
token:
description: 'The Github token.'
required: false
default: ${{ github.token }}
repo:
description: "Optionally specify the repo where the release is located. Defaults to current repo"
required: false
default: ${{ github.repository }}
sha:
description: "Optionally specify the commit SHA. Defaults to SHA that triggered the workflow"
required: false
default: ${{ github.sha }}

output:
uploaded:
Expand Down
18 changes: 10 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,23 @@ async function uploadAsset(octokit, name) {

async function run() {
try {
const token = core.getInput("token", { required: false });
const sha = core.getInput("sha", { required: false });
let repo = core.getInput("repo", { required: false });
const maxReleases = parseInt(core.getInput("max_releases", { required: false }));
const releaseId = core.getInput("release_id", { required: true });
let name = core.getInput("asset_name", { required: true });
const placeholderStart = name.indexOf("$$");
const nameStart = name.substring(0, placeholderStart);
const nameEnd = name.substring(placeholderStart + 2);

const octokit = getOctokit(token);
const hash = sha.substring(0, 6);
const repository = repo.split('/');

if (!process.env.GITHUB_TOKEN
|| !process.env.GITHUB_SHA
|| !process.env.GITHUB_REPOSITORY)
throw new Error("Missing required GitHub environment variables!");

const octokit = getOctokit(process.env.GITHUB_TOKEN);
const hash = process.env.GITHUB_SHA.substring(0, 6);
const repository = process.env.GITHUB_REPOSITORY.split('/');
const owner = repository[0];
repo = repository[1];
const repo = repository[1];

core.info("Checking previous assets");
let assets = await octokit.rest.repos.listReleaseAssets({
Expand Down

0 comments on commit 8edd321

Please sign in to comment.