mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 06:18:42 +02:00
Change tests
* Try to fix check for generated files to create a comment on a PR. * Check for generated files does not count as a failure. * Lint doesn't fail based on stuff in dist. Prettier and lint no longer use the "diff" version. * Removed some commands that weren't really used (specific version electron packager commands that require you to have already ran npm run electron to generate .package folder)
This commit is contained in:
67
.github/workflows/check-for-generated-files.yml
vendored
67
.github/workflows/check-for-generated-files.yml
vendored
@@ -35,51 +35,30 @@ jobs:
|
||||
|
||||
- name: Warn when bundle files were changed
|
||||
id: warn-bundles-changed
|
||||
if: steps.changed-bundle-files.outputs.any_changed == 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
echo "One or more files in the bundle files were changed." >> warnings.txt
|
||||
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
|
||||
|
||||
- name: Warn when documentation markdown files were changed
|
||||
id: warn-markdown-changed
|
||||
if: steps.changed-markdown-doc-files.outputs.any_changed == 'true'
|
||||
run: |
|
||||
echo "One or more files in the markdown documentation were changed." >> warnings.txt
|
||||
|
||||
- name: Print Warnings
|
||||
id: get-warnings
|
||||
run: |
|
||||
if [ -f warnings.txt ]
|
||||
then
|
||||
echo "::set-output name=has_warnings::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 "::set-output name=has_warnings::false"
|
||||
touch warnings.txt
|
||||
echo "Forbidden files included, generating warning"
|
||||
|
||||
touch comment.txt
|
||||
echo "## Generated build or documentation files were included. PRs should not normally contain any generated files." >> comment.txt
|
||||
echo "" >> comment.txt
|
||||
echo "Review the changes and ensure that including built 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
|
||||
fi
|
||||
|
||||
- name: Get Comment Body
|
||||
id: get-comment-body
|
||||
if: steps.get-warnings.outputs.has_warnings == 'true'
|
||||
run: |
|
||||
cat warnings.txt > comment.txt
|
||||
echo "" >> comment.txt
|
||||
echo "Please do not commit files generated by webpack or generated markdown" >> comment.txt
|
||||
echo "" >> comment.txt
|
||||
echo "See [CONTRIBUTING.md](https://github.com/bitburner-official/bitburner-src/blob/dev/doc/CONTRIBUTING.md) for details." >> comment.txt
|
||||
|
||||
body=$(cat comment.txt)
|
||||
body="${body//'%'/'%25'}"
|
||||
body="${body//$'\n'/'%0A'}"
|
||||
body="${body//$'\r'/'%0D'}"
|
||||
|
||||
echo ::set-output name=body::$body
|
||||
- name: Add github comment on problem
|
||||
if: steps.get-warnings.outputs.has_warnings == 'true'
|
||||
uses: peter-evans/commit-comment@v1
|
||||
with:
|
||||
body: ${{ steps.get-comment-body.outputs.body }}
|
||||
- name: Flag as error
|
||||
if: steps.get-warnings.outputs.has_warnings == 'true'
|
||||
run: |
|
||||
COMMIT_WARNINGS=$(cat warnings.txt)
|
||||
echo "::warning:: $COMMIT_WARNINGS"
|
||||
exit 1
|
||||
|
||||
6
.github/workflows/ci-pr.yml
vendored
6
.github/workflows/ci-pr.yml
vendored
@@ -1,7 +1,7 @@
|
||||
name: CI Pull Request
|
||||
|
||||
on:
|
||||
# Triggers the workflow on pull request events but only for the dev branch, checking only diffs
|
||||
# Triggers the workflow on pull request events but only for the dev branch
|
||||
pull_request:
|
||||
branches: [dev]
|
||||
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
- name: Install npm dependencies
|
||||
run: npm ci
|
||||
- name: Run linter
|
||||
run: npm run lint:report-diff
|
||||
run: npm run lint:report
|
||||
prettier:
|
||||
name: Prettier
|
||||
runs-on: ubuntu-latest
|
||||
@@ -54,7 +54,7 @@ jobs:
|
||||
- name: Install npm dependencies
|
||||
run: npm ci
|
||||
- name: Run prettier check
|
||||
run: npm run format:report-diff
|
||||
run: npm run format:report
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
Reference in New Issue
Block a user