Skip to content

Bump @types/chrome from 0.0.203 to 0.0.284 #172

Bump @types/chrome from 0.0.203 to 0.0.284

Bump @types/chrome from 0.0.203 to 0.0.284 #172

Workflow file for this run

name: PR Build and Release
on:
pull_request:
types: [opened, synchronize, closed, ready_for_review]
permissions: write-all
jobs:
build:
if: github.event.action != 'closed'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node.js from .nvmrc
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
run: npm ci --verbose
- name: Run build
run: npm run build
- name: Create and push release branch
id: create_branch
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b pr-releases/pr-${PR_NUMBER}
git add -f build
git commit -m "Add build folder for PR ${PR_NUMBER}"
git push -u origin pr-releases/pr-${PR_NUMBER} --force
echo "BRANCH_NAME=pr-releases/pr-${PR_NUMBER}" >> $GITHUB_ENV
echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Find Previous Comment
uses: peter-evans/find-comment@v3
id: find_comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: 'Temporary Branch Update'
direction: last
- name: Create Comment Body
uses: actions/github-script@v7
id: create_body
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const branchName = process.env.BRANCH_NAME;
const commitHash = process.env.COMMIT_HASH;
const prNumber = context.issue.number;
const repoUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}`;
const branchUrl = `${repoUrl}/tree/${branchName}`;
const commitUrl = `${repoUrl}/commit/${commitHash}`;
const commentBody = `
### Temporary Branch Update
The temporary branch has been updated with the latest changes. Below are the details:
- **Branch Name**: [${branchName}](${branchUrl})
- **Commit Hash**: [${commitHash}](${commitUrl})
**NPM**
\`\`\`bash
npm i github:duckduckgo/privacy-dashboard#${commitHash}
\`\`\`
**Git submodule:**
\`\`\`bash
git submodule update --remote --init submodules/privacy-dashboard
cd submodules/privacy-dashboard
git fetch origin
git checkout pr-releases/pr-227
git reset --hard origin/pr-releases/pr-227
\`\`\`
**Swift**
\`\`\`swift
.package(url: "https://github.com/duckduckgo/privacy-dashboard", revision: "${commitHash}"),
\`\`\`
`;
core.setOutput('comment_body', commentBody);
core.setOutput('pr_number', prNumber);
- name: Create, or Update the Comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.find_comment.outputs.comment-id }}
body: ${{ steps.create_body.outputs.comment_body }}
edit-mode: replace
clean_up:
if: github.event.action == 'closed'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Delete release branch
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push origin --delete pr-releases/pr-${PR_NUMBER}