Skip to content

Commit

Permalink
Log event obj
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashdoughty committed Nov 13, 2019
1 parent 2bd2b34 commit ef1fc09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions .github/actions/output-event/output-event.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const core = require('@actions/core');
const { GitHub } = require('@actions/github');
const { release: { upload_url } } = require(process.env.GITHUB_EVENT_PATH);
const event = require(process.env.GITHUB_EVENT_PATH);
const fs = require('fs');

module.exports = async () => {
try {
console.log(event);
// Get authenticated GitHub client (Ocktokit): https://github.com/actions/toolkit/tree/master/packages/github#usage
const github = new GitHub(process.env.GITHUB_TOKEN);
const assetPath = core.getInput('asset_path', { required: true });
Expand All @@ -21,7 +22,7 @@ module.exports = async () => {
// API Documentation: https://developer.github.com/v3/repos/releases/#upload-a-release-asset
// Octokit Documentation: https://octokit.github.io/rest.js/#octokit-routes-repos-upload-release-asset
await github.repos.uploadReleaseAsset({
url: upload_url,
url: event.release.upload_url,
headers,
name: assetName,
file: fs.readFileSync(assetPath)
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v1
uses: actions/checkout@master

- name: Install deps
run: npm install
Expand All @@ -28,6 +28,10 @@ jobs:

- name: Publish to NPM
uses: pascalgn/npm-publish-action@51fdb4531e99aac1873764ef7271af448dc42ab4
with:
tag_name: "v%s"
tag_message: "v%s"
commit_pattern: "^Release (\\S+)"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_API_KEY }}
Expand Down

0 comments on commit ef1fc09

Please sign in to comment.