Skip to content

🚀 GitHub Action to check whether the user is a stargazer (starred a repo or not)

License

Notifications You must be signed in to change notification settings

gacts/is-stargazer

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Logo

Is the user stargazer?

Release version Build Status License

This action checks if the user is a stargazer (starred a repo or not). It can be run on Linux (ubuntu-latest), Windows (windows-latest) or macOS (macos-latest).

Usage

jobs:
  is-stargazer:
    runs-on: ubuntu-latest
    steps:
      - uses: gacts/is-stargazer@v1
        id: check-star
        #with:
        #  github-token: ${{ github.token }}
        #  username: ${{ github.actor }} # or ${{ github.event.pull_request.user.login }} for PR author
        #  repository: ${{ github.repository }}

      - if: steps.check-star.outputs.is-stargazer != 'true'
        uses: actions/github-script@v7
        with:
          script: core.setFailed('⭐ Please, star this repository!')

In addition, you can combine this action with, for example, actions/github-script:

on:
  issues:
    types: [opened]

jobs:
  comment:
    runs-on: ubuntu-latest
    steps:
      - uses: gacts/is-stargazer@v1
        id: check-star

      - if: steps.check-star.outputs.is-stargazer != 'true'
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: '⭐ Please, star this repository!'
            })

Customizing

Inputs

The following inputs can be used as step.with keys:

Name Type Default Required Description
github-token string ${{ github.token }} no GitHub token
username string ${{ github.actor }} no GitHub username to check (eg. octocat)
repository string ${{ github.repository }} no Target repository (eg. octocat/Hello-World)

Outputs

Name Type Description
is-stargazer string User starred a repo or not (true or false)

Releasing

To release a new version:

  • Build the action distribution (make build or npm run build).
  • Commit and push changes (including dist directory changes - this is important) to the master|main branch.
  • Publish the new release using the repo releases page (the git tag should follow the vX.Y.Z format).

Major and minor git tags (v1 and v1.2 if you publish a v1.2.Z release) will be updated automatically.

Tip

Use Dependabot to keep this action updated in your repository.

Support

Issues Pull Requests

If you find any errors in the action, please create an issue in this repository.

License

This is open-source software licensed under the MIT License.