Skip to content

feature/PLAT-2546

feature/PLAT-2546 #466

Workflow file for this run

name: '🤖 🎨'
on:
pull_request:
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: './lib/package-lock.json'
- run: make format
- name: ignore package-lock changes
run: git restore "*/package-lock.json"
- run: git diff
- run: git diff-files --ignore-submodules
- name: Check that files have been formatted before PR submission
run: git diff-files --quiet --ignore-submodules
if: ${{ github.event.pull_request.head.repo.full_name != 'opentdf/client-web' }}
- name: Commit changes
id: auto-commit
if: ${{ github.event.pull_request.head.repo.full_name == 'opentdf/client-web' }}
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: |-
🤖 🎨 Autoformat
- name: Suggest user signoff
if: steps.auto-commit.outputs.changes_detected == 'true'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const body = `If these changes look good, signoff on them with:
\`\`\`
git pull && git commit --amend --signoff && git push --force-with-lease origin
\`\`\`
If they aren't any good, please remove them with:
\`\`\`
git pull && git reset --hard HEAD~1 && git push --force-with-lease origin
\`\`\`
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body,
});