{"id":18400422,"url":"https://github.com/polarsource/actions","last_synced_at":"2025-08-26T23:32:54.563Z","repository":{"id":191152473,"uuid":"684026525","full_name":"polarsource/actions","owner":"polarsource","description":"GitHub Actions for Polar","archived":true,"fork":false,"pushed_at":"2024-09-04T12:09:29.000Z","size":153,"stargazers_count":10,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-18T13:45:54.686Z","etag":null,"topics":["actions","github-actions","polar"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/polarsource.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-08-28T09:48:14.000Z","updated_at":"2025-08-17T20:16:50.000Z","dependencies_parsed_at":"2023-10-02T08:40:41.537Z","dependency_job_id":"8c3414ae-eb2d-45ae-9165-74ae3b6c6498","html_url":"https://github.com/polarsource/actions","commit_stats":null,"previous_names":["polarsource/actions"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/polarsource/actions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polarsource%2Factions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polarsource%2Factions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polarsource%2Factions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polarsource%2Factions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polarsource","download_url":"https://codeload.github.com/polarsource/actions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polarsource%2Factions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272267230,"owners_count":24903642,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-26T02:00:07.904Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","github-actions","polar"],"created_at":"2024-11-06T02:33:05.839Z","updated_at":"2025-08-26T23:32:54.267Z","avatar_url":"https://github.com/polarsource.png","language":"Python","funding_links":["https://polar.sh","https:/docs.polar.sh","https://docs.polar.sh/github/install","https://api.polar.sh/api/v1/oauth2/userinfo","https://api.polar.sh/api/v1/benefits/$","https://docs.polar.sh/benefits/ads"],"categories":[],"sub_categories":[],"readme":"# Polar GitHub Actions\n\n\u003cdiv align=\"center\"\u003e\n\n\u003ca href=\"https://polar.sh\"\u003eWebsite\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"https:/docs.polar.sh\"\u003eDocumentation\u003c/a\u003e\n\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/polarsource/polar/blob/main/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/license-Apache%202.0-blue.svg\" alt=\"Polar is released under the Apache 2.0 license.\" /\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://discord.gg/STfRufb32V\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/chat-on%20discord-7289DA.svg\" alt=\"Discord Chat\" /\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://twitter.com/intent/follow?screen_name=polar_sh\"\u003e\n    \u003cimg src=\"https://img.shields.io/twitter/follow/polar_sh.svg?label=Follow%20@polar_sh\" alt=\"Follow @polar_sh\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003c/div\u003e\n\nIntegrate Polar into your GitHub Actions workflows easily thanks to our ready-to-use actions.\n\n## `polarsource/actions/auth`\n\nThis action allows you to generate a temporary Polar API token for your workflow, **without the need to generate a long-lived personal access token**.\n\n### 1. Link your repository on Polar\n\nYou'll need to link the repository running the workflow to your Polar organization, as described [here](https://docs.polar.sh/github/install).\n\n### 2. Add the action to your workflow\n\nYour workflow will need the `id-token` permission:\n\n```yaml\npermissions:\n  id-token: write\n```\n\nYou can then use the action like this:\n\n```yaml\n- uses: polarsource/actions/auth@v1\n  id: polar\n  with:\n    scope: 'openid benefits:read products:read'\n```\n\nThe only required parameter, `scope`, is a space-separated list of scopes you want to grant to the resulting token. The token is available as an output of the action. For example, you can use it like this:\n\n```yaml\n- name: 'Check Polar access'\n  run: |\n    resp=$(curl -XGET -H \"Authorization: Bearer ${{ steps.polar.outputs.token }}\" https://api.polar.sh/api/v1/oauth2/userinfo)\n    echo $resp\n```\n\n\u003e [!NOTE]\n\u003e The generated token is an [organization access token](/docs/api/authentication#user-vs-organization-access-tokens).\n\n\u003e [!TIP]\n\u003e **How does it work?**\n\u003e\n\u003e We use [GitHub OpenID Connect](https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/about-security-hardening-with-openid-connect) mechanism to authenticate the request truly comes for your repository's workflow. Since you've linked the repository on Polar, we can trust the action comes from you and deliver a short-lived token.\n\n### Scenarios\n\n**Tag an issue as `priority` if the author has access to a specific benefit**\n\n```yaml\nname: Priority Issues\n\non:\n  issues:\n    types: [opened]\n\npermissions:\n  id-token: write\n  contents: read\n  issues: write\n\nenv:\n  POLAR_BENEFIT_ID: 00000000-0000-0000-0000-000000000000\n\njobs:\n  check-priority:\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions/checkout@v4\n\n      - uses: polarsource/actions/auth@v1\n        id: polar\n        with:\n          scope: 'benefits:read'\n\n      - name: 'Check if author has access to priority answers'\n        id: check-benefit\n        run: |\n          resp=$(curl -XGET -H \"Authorization: Bearer ${{ steps.polar.outputs.token }}\" https://api.polar.sh/api/v1/benefits/${{ env.POLAR_BENEFIT_ID }}/grants?is_granted=true\u0026github_user_id=${{ github.event.issue.user.id }})\n          count=$(($(jq -r '.pagination | .total_count' \u003c\u003c\u003c \"${resp}\")))\n          echo \"count=$(echo $count)\" \u003e\u003e $GITHUB_OUTPUT\n\n      - name: 'Add the priority label'\n        if: steps.check-benefit.outputs.count \u003e 0\n        run: gh issue edit \"$NUMBER\" --add-label \"$LABELS\"\n        env:\n          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          GH_REPO: ${{ github.repository }}\n          NUMBER: ${{ github.event.issue.number }}\n          LABELS: priority\n```\n\n## `polarsource/actions/ads`\n\nThis action allows you to automatically synchronize the ads created by your customers as part of an [Ad benefit](https://docs.polar.sh/benefits/ads) in a Markdown or HTML page.\n\n### 1. Add the magic comment to your document\n\n```html\n\u003c!-- POLAR type=ads benefit_id=00000000-0000-0000-0000-000000000000 width=100 height=100 --\u003e\n```\n\n`benefit_id` is the ID of your ad benefit. You can find it in your dashboard, on the `Benefits` page.\n\n### 2. Add the action to your workflow\n\n```yaml\n- name: Sync Polar ads\n  uses: polarsource/actions/ads@main\n  with:\n    path: README.md\n    token: ${{ secrets.POLAR_ACCESS_TOKEN }}\n```\n\n`path` is the path of the file you want to update. Glob patterns are supported. `token` is a valid Polar access token, which you can set in your repository secrets or generate using our [auth action](#polarsourceactionsauth).\n\n### Scenarios\n\n**Update ads in README.md on push and every day**\n\n```yaml\nname: Ads sync example\n\non:\n  push:\n    branches: [\"main\"]\n\n  schedule:\n    - cron: \"0 7 * * *\"\n\njobs:\n  sync:\n    runs-on: ubuntu-latest\n\n    permissions:\n      contents: write\n      id-token: write\n\n    steps:\n      - name: Check out code\n        uses: actions/checkout@v4\n\n      - uses: polarsource/actions/auth@v1\n        id: polar\n        with:\n          scope: 'openid'\n\n      - name: Sync Polar ads\n        uses: polarsource/actions/ads@v1\n        with:\n          path: README.md\n          token: ${{ steps.polar.outputs.token }}\n\n      - uses: stefanzweifel/git-auto-commit-action@v4\n        with:\n          commit_message: Update Polar ads\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolarsource%2Factions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolarsource%2Factions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolarsource%2Factions/lists"}