Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create release script #617

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Create release script #617

wants to merge 6 commits into from

Conversation

sagarpreet-chadha
Copy link
Contributor

@sagarpreet-chadha sagarpreet-chadha commented Sep 16, 2020

@gitpod-io
Copy link

gitpod-io bot commented Sep 16, 2020

const inquirer = require('inquirer');

const octokit = new Octokit({
auth: '<GENERATE FROM HERE: https://github.com/settings/tokens>',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, so token goes here! Is there a security risk to putting a token here? Sorry, just to be sure!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah @Sagarpreet - check it out - here it says to put the token in the "secrets" --- where it can be referenced from:

https://riggaroo.dev/using-github-actions-to-automate-our-release-process/

also here: https://github.com/actions/create-release#example-workflow---create-a-release

Let me see about that...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@jywarren jywarren Nov 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this work then?

Suggested change
auth: '<GENERATE FROM HERE: https://github.com/settings/tokens>',
auth: ${{ secrets.GITHUBTOKEN }},

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, adding these privileges:
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, strangely I couldn't make a secret called GITHUB_TOKEN as it said it was an invalid name. I instead made GITHUBTOKEN. I wonder... is there an organization secret  with a colliding name? Not sure, but let's try GITHUBTOKEN

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting that we have no org secrets so it wasn't a name collision...

oh! Aha - it's a reserved name -- it already exists with some permissions. Maybe best try it out? https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#about-the-github_token-secret

i wasn't sure it had release creation permissions. but if it does, might as well use it instead of the one I created.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think anyone can create a release in open source projects, right?
Similar to issues maybe, not sure.
So only read permissions for projects should be enough

@jywarren
Copy link
Member

This is cool! So this would be installed in each of our repositories? Amazing work, Sagarpreet!

create-release.js Outdated Show resolved Hide resolved
const result = await octokit.repos.compareCommits({
owner: 'publiclab',
repo: 'plots2',
base: latestTag,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh is this a problem as we're currently in the Editor repo?

@jywarren
Copy link
Member

This could wait to a future revision - but I'm wondering - is there a way to link from PRs that are joining this release, so people know where they are being included? Somehow, the links from https://github.com/publiclab/plots2/releases/tag/v4.0 don't seem to show up as links on those PRs, like for example publiclab/plots2#7954

I could imagine automatically leaving a comment (which would create a lot of notifications, though) or using a tag... not sure! Just an idea. Probably for later!

@sagarpreet-chadha
Copy link
Contributor Author

So if we add automerge probot app, that will make sure that when we do squash and merge, it will take PR title as commit message (instead of all commit messages that are shown in the current release)
Jeff, we have to generate token which has only create release and read permission only so that it is not misused.

Co-authored-by: Jeffrey Warren <[email protected]>
@sagarpreet-chadha
Copy link
Contributor Author

@jywarren so this script is not related to github actions, we will run this script on our local host. So we need to add personal access token with read only permissions.
Maybe new github account for publiclab.org which will work as a bot?

@sagarpreet-chadha
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make releases in plots2 to acknowledge contributors
2 participants