bitburner-src/.github/workflows/check-for-generated-files.yml
omuretsu e9bdc29c8c Some dev updates
* Bump electron version to 22.2.1
* Fix npm run electron command (needed the electron-packager-all command which I had removed)
* Improve the npm run format command, no longer floods terminal with all file names
* Updated start command to serve the built version of the game in .app
* Remove some unused commands and unused workflows. Combined the ci and ci-pr workflows.
* Modify check for generated files logic. Attempt to fix so it will edit its own comment instead of posting a new one on every commit.
2023-02-11 15:12:55 -05:00

56 lines
2.0 KiB
YAML

name: Check for Generated Files
on:
# Triggers the workflow on push or pull request events but only for the dev branch
pull_request:
branches: [dev]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
checkFiles:
name: Check Files
runs-on: ubuntu-latest
steps:
- name: Checkout files
uses: actions/checkout@v2
- name: Check bundle files
id: changed-bundle-files
uses: tj-actions/changed-files@v18.4
with:
files: |
dist/*
index.html
- name: Warn when bundle files were changed
id: warn-bundles-changed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Creating label (if it does not exist)"
LABEL="validation: bundle files modified"
gh --repo "${{ github.repository }}" \
label create "$LABEL" --description "Modifications to this pull request are suggested" --color D93F0B || true
if [ "${{ steps.changed-bundle-files.outputs.any_changed }}" == "false" ]; then
echo "No forbidden files included, removing warning"
gh --repo "${{ github.repository }}" \
pr edit "${{ github.event.number }}" --remove-label "$LABEL" || true
else
echo "Forbidden files included, generating warning"
touch comment.txt
echo "## Generated build files were included. PRs should not normally contain generated files." >> comment.txt
echo "" >> comment.txt
echo "Review the changes and ensure that including generated files was necessary." >> comment.txt
echo "Add pr label"
gh --repo "${{ github.repository }}" \
pr edit "${{ github.event.number }}" --add-label "$LABEL"
echo "And comment on the pr"
gh --repo "${{ github.repository }}" \
pr comment "${{ github.event.number }}" --body-file comment.txt --edit-last
fi