{"id":30060780,"url":"https://github.com/kriasoft/pr-codename","last_synced_at":"2026-04-12T18:23:11.215Z","repository":{"id":306323634,"uuid":"1025804168","full_name":"kriasoft/pr-codename","owner":"kriasoft","description":"Generates unique, deterministic codenames for pull requests for easier referencing.","archived":false,"fork":false,"pushed_at":"2025-08-01T11:01:06.000Z","size":1917,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-01T12:57:41.263Z","etag":null,"topics":["automation","ci-cd","cicd","codename","codenames","deployment-automation","determenistic","developer-tools","devops","github","github-action","github-actions","hash","human-readable","name-generator","nodejs","pr","preview-deployments","pull-requests","utils"],"latest_commit_sha":null,"homepage":"https://levelup.gitconnected.com/zero-wait-pr-previews-the-pre-configured-slots-pattern-72d711bdd70d","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kriasoft.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-24T20:36:34.000Z","updated_at":"2025-08-01T11:00:05.000Z","dependencies_parsed_at":"2025-07-25T01:47:21.953Z","dependency_job_id":"4198d001-25c3-4cec-8c76-2caea08c3526","html_url":"https://github.com/kriasoft/pr-codename","commit_stats":null,"previous_names":["kriasoft/pr-number"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/kriasoft/pr-codename","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kriasoft%2Fpr-codename","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kriasoft%2Fpr-codename/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kriasoft%2Fpr-codename/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kriasoft%2Fpr-codename/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kriasoft","download_url":"https://codeload.github.com/kriasoft/pr-codename/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kriasoft%2Fpr-codename/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269351902,"owners_count":24402673,"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-07T02:00:09.698Z","response_time":73,"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":["automation","ci-cd","cicd","codename","codenames","deployment-automation","determenistic","developer-tools","devops","github","github-action","github-actions","hash","human-readable","name-generator","nodejs","pr","preview-deployments","pull-requests","utils"],"created_at":"2025-08-08T01:47:04.372Z","updated_at":"2026-04-12T18:23:11.169Z","avatar_url":"https://github.com/kriasoft.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PR Codename GitHub Action\n\nA GitHub Action that turns boring PR numbers into memorable codenames like \"tokyo\" or \"elephant\". Because saying \"Can you check the london branch?\" sounds way better than \"Can you check PR #1247?\"\n\nBuilt on top of the [codenames](https://github.com/kriasoft/codenames) library, this action generates deterministic, human-readable names from numbers. Same number in = same name out, every time.\n\n## Why This Exists\n\nYou know that moment when someone mentions \"PR #1247\" in Slack and you have zero idea which one they're talking about? This fixes that. Instead of forgetting numbers, you'll remember names like \"tokyo\" or \"elephant\" - because human brains are weird like that.\n\n## Quick Start\n\n```yaml\nname: Generate PR Codename\non:\n  pull_request:\n    types: [opened, synchronize]\n\njobs:\n  codename:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: kriasoft/pr-codename@v1\n        id: codename\n\n      - name: Comment with codename\n        uses: actions/github-script@v7\n        with:\n          script: |\n            github.rest.issues.createComment({\n              issue_number: context.issue.number,\n              owner: context.repo.owner,\n              repo: context.repo.repo,\n              body: `🏷️ **Codename:** ${{ steps.codename.outputs.codename }}`\n            })\n```\n\nNow your PRs get friendly names automatically. Your teammates will thank you (probably).\n\n## Configuration\n\n### Inputs\n\n| Input      | Description                                                   | Required | Default                |\n| ---------- | ------------------------------------------------------------- | -------- | ---------------------- |\n| `number`   | Number to convert (auto-detects PR number)                    | No       | Auto-detected          |\n| `theme`    | Word theme to use (see available themes below)                | No       | `cities-20`            |\n| `template` | Output template with `{codename}` and `{number}` placeholders | No       | -                      |\n| `token`    | GitHub token for API access (for push events)                 | No       | `GITHUB_TOKEN` env var |\n\n### Outputs\n\n| Output      | Description                                 | Example                     |\n| ----------- | ------------------------------------------- | --------------------------- |\n| `codename`  | The generated codename                      | `tokyo`                     |\n| `number`    | The input number used                       | `1247`                      |\n| `formatted` | Template result (when template is provided) | `https://tokyo.preview.com` |\n\n### Available Themes\n\nPick your flavor of memorable names:\n\n- [**Animals**](https://github.com/kriasoft/codenames/blob/main/words/animals.txt): [`animals-10`](https://github.com/kriasoft/codenames/blob/main/words/animals-10.ts), [`animals-20`](https://github.com/kriasoft/codenames/blob/main/words/animals-20.ts), [`animals-30`](https://github.com/kriasoft/codenames/blob/main/words/animals-30.ts), [`animals-50`](https://github.com/kriasoft/codenames/blob/main/words/animals-50.ts), [`animals-100`](https://github.com/kriasoft/codenames/blob/main/words/animals-100.ts)\n- [**Cities**](https://github.com/kriasoft/codenames/blob/main/words/cities.txt): [`cities-10`](https://github.com/kriasoft/codenames/blob/main/words/cities-10.ts), [`cities-20`](https://github.com/kriasoft/codenames/blob/main/words/cities-20.ts), [`cities-30`](https://github.com/kriasoft/codenames/blob/main/words/cities-30.ts), [`cities-50`](https://github.com/kriasoft/codenames/blob/main/words/cities-50.ts), [`cities-100`](https://github.com/kriasoft/codenames/blob/main/words/cities-100.ts)\n- [**Colors**](https://github.com/kriasoft/codenames/blob/main/words/colors.txt): [`colors-10`](https://github.com/kriasoft/codenames/blob/main/words/colors-10.ts), [`colors-20`](https://github.com/kriasoft/codenames/blob/main/words/colors-20.ts), [`colors-30`](https://github.com/kriasoft/codenames/blob/main/words/colors-30.ts), [`colors-50`](https://github.com/kriasoft/codenames/blob/main/words/colors-50.ts), [`colors-100`](https://github.com/kriasoft/codenames/blob/main/words/colors-100.ts)\n- [**Food**](https://github.com/kriasoft/codenames/blob/main/words/food.txt): [`food-10`](https://github.com/kriasoft/codenames/blob/main/words/food-10.ts), [`food-20`](https://github.com/kriasoft/codenames/blob/main/words/food-20.ts), [`food-30`](https://github.com/kriasoft/codenames/blob/main/words/food-30.ts), [`food-50`](https://github.com/kriasoft/codenames/blob/main/words/food-50.ts), [`food-100`](https://github.com/kriasoft/codenames/blob/main/words/food-100.ts)\n- [**Nature**](\u003c(https://github.com/kriasoft/codenames/blob/main/words/nature.txt)\u003e): [`nature-10`](https://github.com/kriasoft/codenames/blob/main/words/nature-10.ts), [`nature-20`](https://github.com/kriasoft/codenames/blob/main/words/nature-20.ts), [`nature-30`](https://github.com/kriasoft/codenames/blob/main/words/nature-30.ts), [`nature-50`](https://github.com/kriasoft/codenames/blob/main/words/nature-50.ts), [`nature-100`](https://github.com/kriasoft/codenames/blob/main/words/nature-100.ts)\n- **Plus**: [`adjectives`](https://github.com/kriasoft/codenames/blob/main/words/adjectives.txt), [`clothing`](https://github.com/kriasoft/codenames/blob/main/words/clothing.txt), [`countries`](https://github.com/kriasoft/codenames/blob/main/words/countries.txt), [`elements`](https://github.com/kriasoft/codenames/blob/main/words/elements.txt), [`emotions`](https://github.com/kriasoft/codenames/blob/main/words/emotions.txt), [`gems`](https://github.com/kriasoft/codenames/blob/main/words/gems.txt), [`snacks`](https://github.com/kriasoft/codenames/blob/main/words/snacks.txt)\n\nThe number indicates how many words are in that theme (more words = less chance of repeats, but potentially less memorable names).\n\n## Real-World Examples\n\n### Preview Deployments\n\nStop squinting at URLs with random hashes:\n\n```yaml\n- uses: kriasoft/pr-codename@v1\n  id: codename\n  with:\n    theme: cities-30\n    template: \"https://{codename}.preview.myapp.com\"\n\n- name: Deploy preview\n  run: |\n    echo \"🚀 Deploying to ${{ steps.codename.outputs.formatted }}\"\n    # Deploy your app here\n```\n\n### Container Names\n\nBecause `app-1247` is forgettable but `app-elephant` sticks:\n\n```yaml\n- uses: kriasoft/pr-codename@v1\n  id: codename\n  with:\n    theme: animals-50\n\n- name: Build and tag container\n  run: |\n    docker build -t myapp:${{ steps.codename.outputs.codename }} .\n    echo \"📦 Built container: myapp:${{ steps.codename.outputs.codename }}\"\n```\n\n### Slack Notifications\n\nMake your notifications actually readable:\n\n```yaml\n- uses: kriasoft/pr-codename@v1\n  id: codename\n\n- name: Notify team\n  run: |\n    curl -X POST -H 'Content-type: application/json' \\\n      --data '{\"text\":\"🎉 The **${{ steps.codename.outputs.codename }}** branch is ready for review!\\nPR: ${{ github.event.pull_request.html_url }}\"}' \\\n      ${{ secrets.SLACK_WEBHOOK_URL }}\n```\n\n### Feature Branch Identification\n\nGreat for long-running feature work:\n\n```yaml\n- uses: kriasoft/pr-codename@v1\n  id: codename\n  with:\n    number: ${{ github.event.issue.number }}\n    theme: gems-20\n\n- name: Update issue with codename\n  uses: actions/github-script@v7\n  with:\n    script: |\n      const { data: issue } = await github.rest.issues.get({\n        owner: context.repo.owner,\n        repo: context.repo.repo,\n        issue_number: context.issue.number\n      });\n\n      if (!issue.body.includes('Codename:')) {\n        await github.rest.issues.update({\n          owner: context.repo.owner,\n          repo: context.repo.repo,\n          issue_number: context.issue.number,\n          body: issue.body + `\\n\\n**Codename:** ${{ steps.codename.outputs.codename }}`\n        });\n      }\n```\n\n## Advanced Usage\n\n### Custom Numbers\n\nNot just for PRs - works with any number:\n\n```yaml\n- uses: kriasoft/pr-codename@v1\n  with:\n    number: ${{ github.run_number }}\n    theme: nature-100\n  id: build-name\n\n- run: echo \"Build codename: ${{ steps.build-name.outputs.codename }}\"\n```\n\n### Multiple Themes in One Workflow\n\n```yaml\n- name: Generate environment codenames\n  run: |\n    # Different themes for different purposes\n    PREVIEW=$(echo '${{ steps.codename-cities.outputs.codename }}')\n    STAGING=$(echo '${{ steps.codename-animals.outputs.codename }}')\n    echo \"Preview: https://$PREVIEW.preview.com\"\n    echo \"Staging: https://$STAGING.staging.com\"\n```\n\n## How It Works\n\nThe magic happens in the [codenames library](https://github.com/kriasoft/codenames). It uses a deterministic hash function that:\n\n1. Takes your number (like PR #1247)\n2. Runs it through a consistent algorithm\n3. Maps it to a word from the chosen theme\n4. Always gives you the same result for the same input\n\nNo randomness, no database, no external calls. Just pure, predictable naming.\n\n## GitHub Token Setup\n\nFor push events and other non-PR contexts, the action needs GitHub API access to find the associated PR. Add these permissions to your workflow:\n\n```yaml\njobs:\n  codename:\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n      pull-requests: read # Required for API fallback\n    steps:\n      - uses: kriasoft/pr-codename@v1\n        with:\n          token: ${{ secrets.GITHUB_TOKEN }} # Explicit token\n```\n\nOr use the environment variable approach:\n\n```yaml\n- uses: kriasoft/pr-codename@v1\n  env:\n    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Environment variable\n```\n\nThe action will gracefully handle missing tokens by falling back to manual number input.\n\n## Common Issues\n\n**Q: Why am I getting \"Could not determine number\"?**  \nA: The action tries to auto-detect PR numbers, but if you're not in a PR context, pass the `number` input manually or ensure proper GitHub token permissions.\n\n**Q: Can I use custom word lists?**  \nA: Not directly in this action, but you can fork the [codenames library](https://github.com/kriasoft/codenames) and add your own themes.\n\n**Q: Are the names actually unique?**  \nA: Within a theme's word count, yes. But with `animals-10`, you'll get repeats after 10 different numbers. Use larger themes for bigger projects.\n\n## Contributing\n\nFound a bug? Want a feature? The code is pretty straightforward:\n\n- [`index.ts`](./index.ts) - Main action logic\n- [`action.yml`](./action.yml) - GitHub Action metadata\n- Built on [codenames](https://github.com/kriasoft/codenames)\n\nPRs welcome! (And yes, they'll get codenames too.)\n\n## License\n\nMIT - Use it however you want. Build cool things.\n\n---\n\n_Made with ☕ by [Konstantin Tarkus](https://github.com/koistya) and contributors._\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkriasoft%2Fpr-codename","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkriasoft%2Fpr-codename","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkriasoft%2Fpr-codename/lists"}