This repository was archived by the owner on Mar 17, 2025. It is now read-only.
chore: update readme.txt to test workflows #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Generate Changeset | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - develop | |
| workflow_dispatch: | |
| inputs: | |
| pr_number: | |
| description: 'PR number to generate changeset for' | |
| required: true | |
| type: string | |
| jobs: | |
| generate-changeset: | |
| if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| ref: develop | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '16' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Extract PR information | |
| id: pr_info | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| PR_NUMBER="${{ github.event.inputs.pr_number }}" | |
| PR_DATA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
| "https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}") | |
| else | |
| PR_NUMBER="${{ github.event.pull_request.number }}" | |
| PR_DATA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
| "https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}") | |
| fi | |
| PR_TITLE=$(echo "$PR_DATA" | jq -r '.title') | |
| PR_BODY=$(echo "$PR_DATA" | jq -r '.body') | |
| PR_AUTHOR=$(echo "$PR_DATA" | jq -r '.user.login') | |
| echo "::set-output name=pr_number::${PR_NUMBER}" | |
| echo "::set-output name=pr_title::${PR_TITLE}" | |
| echo "::set-output name=pr_author::${PR_AUTHOR}" | |
| echo "::set-output name=pr_body::${PR_BODY}" | |
| - name: Generate changeset | |
| run: | | |
| npm run changeset:generate -- \ | |
| --pr=${{ steps.pr_info.outputs.pr_number }} \ | |
| --title="${{ steps.pr_info.outputs.pr_title }}" \ | |
| --author="${{ steps.pr_info.outputs.pr_author }}" \ | |
| --body="${{ steps.pr_info.outputs.pr_body }}" | |
| - name: Commit changeset | |
| uses: stefanzweifel/git-auto-commit-action@v4 | |
| with: | |
| commit_message: "chore: add changeset for PR #${{ steps.pr_info.outputs.pr_number }}" | |
| file_pattern: ".changesets/*.md" | |
| branch: develop |