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

The example on the README doesn't work #33

Closed
s3i7h opened this issue Apr 14, 2023 · 8 comments
Closed

The example on the README doesn't work #33

s3i7h opened this issue Apr 14, 2023 · 8 comments

Comments

@s3i7h
Copy link

s3i7h commented Apr 14, 2023

Taking GITHUB_TOKEN as a input is a feature available from v1.0, but the example is suggesting v0.2.1 and that expects the token given as an env var.

@thadguidry
Copy link
Collaborator

thadguidry commented Apr 15, 2023

@wardellbagby Any thoughts on this? Referencing this https://docs.github.com/en/actions/security-guides/automatic-token-authentication and specifically secrets context documented here: https://docs.github.com/en/actions/learn-github-actions/contexts#secrets-context

Do we simply update the README to use the old style var since it references v0.2.1 and that is our current release?

Then also maybe in the README we give a 2nd example for non-production testing of v1.0 pre-release?

BTW, you did well in documenting this in the code:

if (tokenFromEnv != null) {
log(
"⚠️",
'Providing the GitHub token from the environment variable is deprecated. Provide it as an input with the name "github_token" instead.',
"warn"
);
return tokenFromEnv;
}

@wardellbagby
Copy link
Contributor

First, let's do some investigation. There's one question I'd like to know the answer to.

  • On the "Use This Action" page where you chose the version of this action to use, does it display the latest README or the README from that selected tag?

If it displays the README from the selected tag (and so changes as you use the version switcher), then we need to update the README to point to 1.0 and mention that it's a pre-release as well. If it doesn't, then we need to update the README like you suggested to have both versions of usage.

@thadguidry
Copy link
Collaborator

thadguidry commented Apr 15, 2023

on the marketplace... the default shows the v1.0 pre-release and it's longer README
https://github.com/marketplace/actions/delete-tag-and-release

and using the version switcher with green button dropdown... get's this URL
https://github.com/marketplace/actions/delete-tag-and-release?version=v0.2.1

GitHub Action: Delete tag and release

Add following step to your workflow:

- uses: dev-drprasad/delete-tag-and-release@v0.2.0
  with:
    tag_name: v0.1.0 #(required) tag name to delete 
    delete_release: true #(optional) default: true 
    repo: <owner>/<repoName> #(optional) target repository. default: repo running this action
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

using the version switcher with green button dropdown... and switching to v1.0 get's this URL
https://github.com/marketplace/actions/delete-tag-and-release?version=v1.0

and the new README from v1.0 which is much longer

GitHub Action: Delete tag and release

Usage
Add following step to your workflow:

- uses: dev-drprasad/delete-tag-and-release@v0.2.1
  with:
    tag_name: v0.1.0 #(required) tag name to delete 
    github_token: ${{ secrets.GITHUB_TOKEN }} # (required) a GitHub token with write access to the repo that needs to be modified
    delete_release: true #(optional) default: true 
    repo: <owner>/<repoName> #(optional) target repository. default: repo running this action
Developing
You can follow these instructions to get this project cloned to your local machine and ready for development. Note that development requires at least [Node 16](https://nodejs.org/en/download) to be installed on your computer.

git clone https://github.com/dev-drprasad/delete-tag-and-release.git
cd delete-tag-and-release
npm install
Tests can be run via:

npm test
Since this is a repo for a [GitHub Action](https://docs.github.com/en/actions), every new commit that changes code must include a new bundle. You can generate a new bundle via running:

npm run package
and committing the resulting changes that will be in the dist/ folder.

Formatting and linting
This project uses [ESLint](https://eslint.org/) for linting and [Prettier](https://prettier.io/) for source code formatting. You can run the lint checks by running:

npm run lint
If you have lint errors that are automatically fixable, you can fix those by running:

npm run lint:fix
Releasing
Releases are done by creating a new tag and pushing that tag to the repo. A new release can be made via the following:

git checkout master
git fetch
git pull
# choose either patch, minor, or major. See https://docs.npmjs.com/cli/v8/commands/npm-version#description for more info
npm version <patch/minor/major>
git push --follow-tags
This will update the version in the package.json, create a new commit based off of the master branch, and create a new Git tag with that version that points to the new commit. Remember to use the --follow-tags flag when running git push! Without it, the new tag won't be pushed.

@wardellbagby
Copy link
Contributor

Oh okay, that's perfect. Then we can just update the README to exclusive reference the 1.0 usage; that is to say, the usage where we pass the token as an input instead of an ENV var.

Which means the only change needed is to change the version listed on the README to point to 1.0!

I can do that but I likely won't get to it until tomorrow or Sunday, so feel free to do the update yourself if you'd like.

@thadguidry
Copy link
Collaborator

thadguidry commented May 11, 2023

@wardellbagby any updates? :-) yes, I'm asking nicely.

Looks good enough? PR #35

@wardellbagby
Copy link
Contributor

wardellbagby commented May 30, 2023

@thadguidry It looks like we either need to update the 1.0 tag to point the latest commit on master or create a new 1.0.1 pre-release to get the GitHub Marketplace page to pull the correct README.

Since this is just a documentation change, it's a good candidate for just updating the 1.0 tag but creating a new 1.0.1 is a bit easier and safer.

Either/or, once that's done, we can close this issue.

@thadguidry
Copy link
Collaborator

thadguidry commented May 30, 2023

OK, I've created a new 1.0.1 pre-release. Does that seem to fix things?

@wardellbagby
Copy link
Contributor

OK, I've created a new 1.0.1 pre-release. Does that seem to fix things?

@thadguidry Yup, all good!

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

No branches or pull requests

3 participants