Bump purgecss from 5.0.0 to 6.0.0 #45
Workflow file for this run
This file contains 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: Dependabot Tests | |
on: | |
pull_request: | |
branches: [main] | |
types: [opened, synchronize, closed] | |
paths: | |
- "package.json" | |
- "package-lock.json" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x, 16.x] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Label Dependabot PRs | |
uses: actions/github-script@v5 | |
with: | |
github-token: ${{ secrets.HYPERCRITICAL_SECRET }} | |
script: | | |
console.log(`Pull Request Number: ${context.issue.number}`); | |
const { owner, repo } = context.repo; | |
const pr_number = context.issue.number; | |
const pr = await github.rest.pulls.get({ owner, repo, pull_number: pr_number }); | |
if (pr.data.user.login === 'dependabot[bot]') { | |
await github.rest.issues.addLabels({ | |
owner, | |
repo, | |
issue_number: pr_number, | |
labels: ['dependencies'] | |
}); | |
} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Cache Node.js modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install Dependencies | |
run: npm ci | |
- name: Check if PR is for @types/ | |
id: check-types | |
run: | | |
if [[ "${{ github.event.pull_request.title }}" == *"@types/"* ]]; then | |
echo "::set-output name=skip::true" | |
fi | |
- name: Run Tests | |
if: steps.check-types.outputs.skip != 'true' | |
run: npm test | |
- name: Comment on failed tests | |
if: failure() && steps.check-types.outputs.skip != 'true' | |
uses: actions/github-script@v5 | |
with: | |
github-token: ${{ secrets.HYPERCRITICAL_SECRET }} | |
script: | | |
const { owner, repo } = context.repo; | |
const issue_number = context.issue.number; | |
const message = 'Tests failed! Please check the logs for more details.'; | |
await github.rest.issues.createComment({ | |
owner, | |
repo, | |
issue_number, | |
body: message | |
}); | |
- name: Run npm audit | |
if: steps.check-types.outputs.skip != 'true' | |
run: npm audit | |
- name: Rebase and merge | |
if: success() && steps.check-types.outputs.skip != 'true' | |
uses: actions/github-script@v5 | |
with: | |
github-token: ${{ secrets.HYPERCRITICAL_SECRET }} | |
script: | | |
const { owner, repo } = context.repo; | |
const pr_number = context.issue.number; | |
await github.rest.pulls.rebase({ owner, repo, pull_number }); | |
await github.rest.pulls.merge({ owner, repo, pull_number }); | |
delete-branch: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true && github.event.pull_request.user.login == 'dependabot[bot]' | |
steps: | |
- name: Delete branch | |
uses: actions/github-script@v5 | |
with: | |
github-token: ${{ secrets.HYPERCRITICAL_SECRET }} | |
script: | | |
const { owner, repo } = context.repo; | |
const pr_number = context.issue.number; | |
const pr = await github.rest.pulls.get({ owner, repo, pull_number }); | |
if (pr.data.merged) { | |
await github.rest.git.deleteRef({ | |
owner, | |
repo, | |
ref: `heads/${pr.data.head.ref}` | |
}); | |
} |