This repository has been archived by the owner on Aug 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- consuming this action successfully - turns out I have to use node? rewriting all the things
- Loading branch information
Showing
9 changed files
with
152 additions
and
62 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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,2 @@ | ||
dist | ||
node_modules |
This file was deleted.
Oops, something went wrong.
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,30 +1,16 @@ | ||
name: Release-Notes-Preview | ||
author: 'Amir Moualem' | ||
description: 'Presents a preview of expected release notes should the PR get merged, based on Semantic Release.' | ||
|
||
on: | ||
pull_request: | ||
branches: [ master ] | ||
inputs: | ||
releaseBranch: | ||
description: 'Branch where the Semantic Release will occur.' | ||
required: false | ||
default: 'master' | ||
githubPosterId: | ||
description: 'ID of the user associated with the GITHUB_TOKEN. Used to delete previous release notes previews so we dont spam pull requests.' | ||
required: true | ||
|
||
jobs: | ||
preview: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.8] | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
- run: | | ||
git fetch --prune --unshallow --tags | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install requests | ||
- name: Post release notes | ||
run: python $GITHUB_WORKSPACE/py/main.py | ||
env: | ||
GITHUB_USERNAME: ${{ github.actor }} | ||
GITHUB_TOKEN: ${{ secrets.RELEASE_NOTES_PREVIEW_GITHUB_TOKEN }} | ||
runs: | ||
using: node12 | ||
main: dist/index.js |
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,36 @@ | ||
const fs = require('fs'); | ||
const needle = require('needle'); | ||
|
||
const GITHUB_TOKEN = process.env.GITHUB_TOKEN; | ||
|
||
const eventName = process.env.GITHUB_EVENT_NAME; | ||
if (eventName !== 'pull_request') { | ||
process.exit(1); | ||
} | ||
|
||
const eventPath = process.env.GITHUB_EVENT_PATH; | ||
const eventData = fs.readFileSync(eventPath); | ||
const event = JSON.parse(eventData); | ||
console.log(event); | ||
|
||
const issueUrl = event.pull_request.issue_url; | ||
|
||
const url = `${issueUrl}/comments`; | ||
const payload = { | ||
body: 'There\'s butter on my face!', | ||
}; | ||
const options = { | ||
json: true, | ||
compressed: true, | ||
headers: { | ||
Authorization: 'token ' + GITHUB_TOKEN, | ||
}, | ||
}; | ||
|
||
|
||
needle('post', url, payload, options) | ||
.then((response) => { | ||
console.log('huzzah!'); | ||
}).catch((err) => { | ||
console.log('I have no idea what I\'m doing'); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,36 @@ | ||
{ | ||
"name": "release-notes-preview", | ||
"description": "Presents a preview of expected release notes should the PR get merged, based on Semantic Release.", | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/snyk/release-notes-preview.git" | ||
}, | ||
"author": "Amir Moualem", | ||
"bugs": { | ||
"url": "https://github.com/snyk/release-notes-preview/issues" | ||
}, | ||
"homepage": "https://github.com/snyk/release-notes-preview#readme", | ||
"dependencies": { | ||
"needle": "^2.3.3" | ||
}, | ||
"release": { | ||
"branches": "master", | ||
"verifyConditions": [ | ||
"@semantic-release/github" | ||
], | ||
"publish": [ | ||
"@semantic-release/github" | ||
], | ||
"success": [ | ||
"@semantic-release/github" | ||
], | ||
"fail": [ | ||
"@semantic-release/github" | ||
] | ||
} | ||
} |
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