Skip to content

Commit

Permalink
chore: update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
prince-deriv committed Sep 18, 2024
1 parent 0f59e52 commit ca66178
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions .github/workflows/generate-bundle-url.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, synchronize, reopened]
push:
branches:
- '**' # This will trigger the workflow for commits to any branch
- '**' # Trigger workflow for commits to any branch

jobs:
generate-url:
Expand All @@ -27,21 +27,17 @@ jobs:
run: |
node scripts/generate-bundle-url.js > url.txt
cat url.txt
- name: Update PR with CDN URL
uses: actions/github-script@v6
- name: Create or update PR comment with CDN URL
uses: peter-evans/create-or-update-comment@v3
with:
script: |
const fs = require('fs');
const url = fs.readFileSync('url.txt', 'utf8').trim();
const pr_number = process.env.GITHUB_REF.split('/').pop();
const { getOctokit } = require('@actions/github');
const octokit = getOctokit(process.env.GITHUB_TOKEN);
await octokit.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr_number,
body: `### Test Bundle URL:\n\n[Preview script bundle](${url})\n\n${context.payload.pull_request.body}`
});
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
### Test Bundle URL:
[Preview script bundle](${{ steps.generate-url.outputs.url }})
${GITHUB_EVENT_PULL_REQUEST_BODY}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_EVENT_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }}

0 comments on commit ca66178

Please sign in to comment.