Skip to content

feat: [FX-4053] create codemods for RTE #5600

feat: [FX-4053] create codemods for RTE

feat: [FX-4053] create codemods for RTE #5600

name: Release Alpha Package
on:
issue_comment:
types: [ created ]
jobs:
triggerPrWorkflow:
name: Trigger PR Workflow
if: >
github.event.issue.pull_request &&
github.event.comment.body == '@toptal-bot run package:alpha-release'
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.TOPTAL_DEVBOT_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN_PUBLISH }}
STATUS_CHECK_NAME: Publish Alpha Package
STATUS_TARGET_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
steps:
- name: Feedback on action started
uses: actions/github-script@v6
with:
github-token: ${{ env.GITHUB_TOKEN }}
script: |
const { owner, repo } = context.issue;
await github.rest.reactions.createForIssueComment({ owner, repo, comment_id: context.payload.comment.id, content: '+1' });
- id: branch
uses: xt0rted/[email protected]
- name: Specify branch
id: get-branch
run: |
echo "branch=${{ steps.branch.outputs.head_ref }}" >> $GITHUB_OUTPUT
echo "sha=${{ steps.branch.outputs.head_sha }}" >> $GITHUB_OUTPUT
- name: Configure git user
run: |
git config --global user.email "[email protected]"
git config --global user.name "toptal-bot"
- name: Checkout the latest code
uses: actions/checkout@v3
with:
token: ${{ env.GITHUB_TOKEN }}
ref: ${{ steps.get-branch.outputs.branch }}
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
- name: Set status check - pending
uses: actions/github-script@v6
with:
github-token: ${{ env.GITHUB_TOKEN }}
script: |
const { owner, repo } = context.issue;
await github.rest.repos.createCommitStatus({
repo,
owner,
state: 'pending',
sha: "${{ steps.get-branch.outputs.sha }}",
context: process.env.STATUS_CHECK_NAME,
target_url: process.env.STATUS_TARGET_URL
})
- name: Trigger alpha package
id: alpha-package
uses: toptal/davinci-github-actions/[email protected]
with:
npm-token: ${{ env.NPM_TOKEN }}
branch: ${{ steps.get-branch.outputs.branch }}
- name: Alpha package — Handle success
if: ${{ success() }}
uses: actions/github-script@v6
env:
versions: ${{ steps.alpha-package.outputs.versions }}
with:
github-token: ${{ env.GITHUB_TOKEN }}
script: |
const { repo: { owner, repo }, issue } = context
const { versions } = process.env
const body = "Your alpha package is ready 🎉<br/>" + versions.split(' ').reduce((acc, version) => {
acc += `\`yarn add ${version}\`<br/>`
return acc
}, '')
await github.rest.issues.createComment({ issue_number: issue.number, owner, repo, body })
- name: Set status check - success / failure / error
if: ${{ always() }}
uses: actions/github-script@v6
with:
github-token: ${{ env.GITHUB_TOKEN }}
script: |
const { owner, repo } = context.issue;
const status = "${{ job.status }}";
const state = status === 'cancelled' ? 'error' : status;
await github.rest.repos.createCommitStatus({
repo,
owner,
state,
sha: "${{ steps.get-branch.outputs.sha }}",
context: process.env.STATUS_CHECK_NAME,
target_url: process.env.STATUS_TARGET_URL
})
- uses: toptal/davinci-github-actions/[email protected]
name: Create Jira deployment
with:
token: ${{ env.GITHUB_TOKEN }}
environment: alpha-package
environment-url: https://www.npmjs.com/package/@toptal/picasso?activeTab=versions