Skip to content

Check: Update nanoid extension #41355

Check: Update nanoid extension

Check: Update nanoid extension #41355

name: Extensions
run-name: "${{ github.event_name == 'push' && format('Publish: {0}', github.event.head_commit.message) || (github.event_name == 'pull_request' && format('Check: {0}', github.event.pull_request.title) || github.event_name == 'workflow_dispatch' && format('Manual: {0} {1}', inputs.command, inputs.paths) || format('Event: {0}', github.event_name) ) }}"
on:
workflow_dispatch:
inputs:
paths:
description: 'Extensions to update (comma-separated relative paths for extensions) or ("extensions/**"" to execute on all possible subdirectories)'
required: true
command:
description: "Ray CLI command to run (build | publish)"
default: "build"
required: true
type: choice
options:
- build
- publish
cli_version:
description: 'CLI Version (optional, eg. "1.0.0")'
required: false
pull_request:
paths:
- "extensions/**"
branches: [main, master]
push:
paths:
- "extensions/**"
branches: [main, master]
jobs:
extensions_build_publish:
if: github.repository == 'raycast/extensions'
name: "${{ github.event_name == 'push' && 'Publish' || (github.event_name == 'pull_request' && 'Check' || github.event_name == 'workflow_dispatch' && inputs.command || github.event_name ) }}"
runs-on: macos-14
steps:
- name: Setup Xcode
uses: raycast/github-actions/[email protected]
- uses: actions/checkout@v4
with:
path: github_utils
sparse-checkout: |
.github
# This makes sure that the problems found while validating the extensions are shown in the PR diff
- name: Register Problem Matcher for Ray CLI
run: echo "##[add-matcher]github_utils/.github/ray.matcher.json"
- name: Generate 'allow_owners_only_for_extensions'
id: allow_owners_only_for_extensions
run: |
file_path="${{ github.workspace }}/github_utils/.github/public_raycast_extensions.txt"
if [[ -f "$file_path" ]]; then
echo "value<<EOF" >> "$GITHUB_OUTPUT"
while IFS= read -r line; do
echo "$line" >> "$GITHUB_OUTPUT"
done < "$file_path"
echo "EOF" >> "$GITHUB_OUTPUT"
fi
- name: Cleanup github_utils
run: |
rm -rf ${{ github.workspace }}/github_utils
- name: Run Ray CLI
id: ray_cli
uses: raycast/github-actions/[email protected]
with:
access_token: "${{ secrets.RAYCAST_CLI_ACCESS_TOKEN }}"
command: "${{ github.event.inputs.command }}"
paths: "${{ github.event.inputs.paths }}"
cli_version: "${{ github.event.inputs.cli_version }}"
allow_owners_only_for_extensions: "${{ steps.allow_owners_only_for_extensions.outputs.value }}"
- name: Post Store URLs
if: github.event_name == 'push'
uses: raycast/github-actions/[email protected]
with:
store_urls: ${{ steps.ray_cli.outputs.store_urls }}
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Reward Contributor
uses: actions/github-script@v7
if: github.event_name == 'push'
env:
PUBLISHING_BOT_TOKEN: ${{ secrets.RAYCAST_CLI_ACCESS_TOKEN }}
with:
github-token: ${{ secrets.RAYCAST_BOT_API_ACCESS_TOKEN }}
script: |
const result = await github.rest.repos.getContent({
mediaType: {
format: "raw",
},
owner: context.repo.owner,
repo: context.repo.repo,
path: "scripts/reward.js",
});
require('fs').writeFileSync('./reward.js', result.data);
const script = require('./reward')
await script({
github,
context,
fetch,
})
- name: Notify Failure to Slack
if: failure() && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
uses: raycast/github-actions/slack-send@master
with:
webhook: ${{ github.event_name == 'workflow_dispatch' && secrets.SLACK_RELEASE_CHANNEL_WEBHOOK_URL || secrets.SLACK_STREAM_ERRORS_STORE_PUBLIC }}
color: "danger"
text: |
:no_entry_sign: ${env.GITHUB_WORKFLOW} has failed
<${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}|Action logs> | <${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/commit/${ env.GITHUB_SHA }|Commit: ${ env.GITHUB_SHA.substr(0,8) }>
- name: Notify Success to Slack
if: success() && github.event_name == 'workflow_dispatch'
uses: raycast/github-actions/slack-send@master
with:
webhook: ${{ secrets.SLACK_RELEASE_CHANNEL_WEBHOOK_URL }}
color: "good"
text: |
:white_check_mark: ${env.GITHUB_WORKFLOW} has succeeded
<${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}|Action logs> | <${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/commit/${ env.GITHUB_SHA }|Commit: ${ env.GITHUB_SHA.substr(0,8) }>