Skip to content

Don't open a PR for bot related changes, just push #717

Don't open a PR for bot related changes, just push

Don't open a PR for bot related changes, just push #717

Workflow file for this run

name: CI
on: pull_request
env:
FORCE_COLOR: 3
permissions:
contents: read
jobs:
lint:
name: Lint
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: Brightspace/third-party-actions@actions/checkout
- name: Set up node
uses: Brightspace/third-party-actions@actions/setup-node
with:
node-version-file: .nvmrc
cache: npm
- name: Install dependencies
run: npm ci
- name: Lint (ESLint)
run: npm run lint:eslint
- name: Lint (EditorConfig)
run: npm run lint:editorconfig
licenses:
name: Check Licenses
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: Brightspace/third-party-actions@actions/checkout
- name: Set up node
uses: Brightspace/third-party-actions@actions/setup-node
with:
node-version-file: .nvmrc
cache: npm
- name: Install dependencies
run: npm ci
- name: Check licenses
run: npm run license-check
build:
name: Build
timeout-minutes: 5
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: Brightspace/third-party-actions@actions/checkout
- name: Set up node
uses: Brightspace/third-party-actions@actions/setup-node
with:
node-version-file: .nvmrc
cache: npm
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Handle changes (pull request)
uses: Brightspace/third-party-actions@peter-evans/create-pull-request
if: github.triggering_actor != 'devpow112'
id: changes-pr
with:
commit-message: Update Build
base: ${{github.event.pull_request.head.ref}}
branch: ghworkflow/update-build-for-pr-${{github.event.number}}
title: Update Build for PR ${{github.event.number}}
body: 'Update build for PR #${{github.event.number}}.'
delete-branch: true
draft: true
add-paths: dist/*
- name: Leave comment
if: >
github.triggering_actor != 'devpow112' &&
steps.changes-pr.outputs.pull-request-operation == 'created'
uses: BrightspaceUI/actions/comment-on-pr@main
with:
message: >
New build required - pull request
#${{steps.changes-pr.outputs.pull-request-number}} has been opened with
new built files.
post-mode: hide-previous
- name: Report status
if: >
github.triggering_actor != 'devpow112' &&
(
steps.changes-pr.outputs.pull-request-operation == 'created' ||
steps.changes-pr.outputs.pull-request-operation == 'updated'
)
uses: Brightspace/third-party-actions@actions/github-script
with:
script: core.setFailed('Build changes detected')
- name: Handle changes (push)
id: changes-push
if: github.triggering_actor == 'devpow112'
run: |
set +e
git diff --exit-code --name-only 'dist/*'
RESULT="$?"
set -e
if [[ "$RESULT" -eq 0 ]]; then
echo "No changes detected"
echo "exist=false" >> $GITHUB_OUTPUT
exit 0
fi
echo "exist=true" >> $GITHUB_OUTPUT
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git add 'dist/*'
git commit -m 'Update Build'
git push -f "https://$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY" "$GITHUB_REF"
env:
GITHUB_TOKEN: ${{secrets.PR_MANAGE_TOKEN}}
- name: Approve
if: steps.changes-push.outputs.exist == 'true'
run: gh pr review --approve "$PULL_REQUEST_NUMBER"
env:
PULL_REQUEST_NUMBER: ${{github.event.number}}
GITHUB_TOKEN: ${{secrets.PR_MANAGE_TOKEN}}
test:
name: Test
timeout-minutes: 5
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: Brightspace/third-party-actions@actions/checkout
- name: Set up node
uses: Brightspace/third-party-actions@actions/setup-node
with:
node-version-file: .nvmrc
cache: npm
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test:unit
- name: Upload report (debug, dry run)
uses: ./
if: github.actor != 'dependabot[bot]'
with:
aws-access-key-id: ${{secrets.AWS_ACCESS_KEY_ID}}
aws-secret-access-key: ${{secrets.AWS_SECRET_ACCESS_KEY}}
aws-session-token: ${{secrets.AWS_SESSION_TOKEN}}
dry-run: true
debug: true
- name: Upload report
uses: ./
if: github.actor != 'dependabot[bot]'
with:
aws-access-key-id: ${{secrets.AWS_ACCESS_KEY_ID}}
aws-secret-access-key: ${{secrets.AWS_SECRET_ACCESS_KEY}}
aws-session-token: ${{secrets.AWS_SESSION_TOKEN}}