From d1280a2e839a5914ac9c2e8c34be255828ae3f4e Mon Sep 17 00:00:00 2001 From: MattyTheHacker <18513864+MattyTheHacker@users.noreply.github.com> Date: Mon, 14 Apr 2025 22:16:38 +0100 Subject: [PATCH 1/4] Change to use non-fork --- .github/workflows/check-build-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-build-deploy.yaml b/.github/workflows/check-build-deploy.yaml index d0f9a1ffe..12c818e75 100644 --- a/.github/workflows/check-build-deploy.yaml +++ b/.github/workflows/check-build-deploy.yaml @@ -111,7 +111,7 @@ jobs: steps: - name: Prevent migrations files changing - uses: CSSUoB/action-prevent-file-change@v1.7.0 + uses: xalvarez/prevent-file-change-action@v2.0.0 with: githubToken: ${{ secrets.GITHUB_TOKEN }} pattern: '.*\/db\/.+\/migrations\/\d{4}\w*\.py$' From 297bee796823621ad55bfe3f3bb8e9f4d16ccf4b Mon Sep 17 00:00:00 2001 From: MattyTheHacker <18513864+MattyTheHacker@users.noreply.github.com> Date: Mon, 14 Apr 2025 22:53:39 +0100 Subject: [PATCH 2/4] migrate to own file --- .github/workflows/check-build-deploy.yaml | 16 --------------- .../prevent-migrations-deletion.yaml | 20 +++++++++++++++++++ 2 files changed, 20 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/prevent-migrations-deletion.yaml diff --git a/.github/workflows/check-build-deploy.yaml b/.github/workflows/check-build-deploy.yaml index 12c818e75..e4cbc7c18 100644 --- a/.github/workflows/check-build-deploy.yaml +++ b/.github/workflows/check-build-deploy.yaml @@ -101,22 +101,6 @@ jobs: - name: Run pre-commit run: uv run -- pre-commit run --all-files --hook-stage manual # TODO: Add GitHub workflows output format - prevent-migrations-deletion: - runs-on: ubuntu-latest - - permissions: - pull-requests: read - - if: github.event_name == 'pull_request' - - steps: - - name: Prevent migrations files changing - uses: xalvarez/prevent-file-change-action@v2.0.0 - with: - githubToken: ${{ secrets.GITHUB_TOKEN }} - pattern: '.*\/db\/.+\/migrations\/\d{4}\w*\.py$' - allowNewFiles: true - pymarkdown: runs-on: ubuntu-latest env: diff --git a/.github/workflows/prevent-migrations-deletion.yaml b/.github/workflows/prevent-migrations-deletion.yaml new file mode 100644 index 000000000..7b05558be --- /dev/null +++ b/.github/workflows/prevent-migrations-deletion.yaml @@ -0,0 +1,20 @@ +name: Prevent deletion of database migration files + +on: + pull_request_target: + branches: [main] + +jobs: + prevent-migrations-deletion: + runs-on: ubuntu-latest + + permissions: + pull-requests: read + + steps: + - name: Prevent migrations files changing + uses: xalvarez/prevent-file-change-action@v2.0.0 + with: + githubToken: ${{ secrets.GITHUB_TOKEN }} + pattern: '.*\/db\/.+\/migrations\/\d{4}\w*\.py$' + allowNewFiles: true From e13c0b2441a67ab393f78d44d742b9b2b69bd833 Mon Sep 17 00:00:00 2001 From: MattyTheHacker <18513864+MattyTheHacker@users.noreply.github.com> Date: Mon, 14 Apr 2025 22:54:44 +0100 Subject: [PATCH 3/4] ya yeet --- .github/workflows/check-build-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-build-deploy.yaml b/.github/workflows/check-build-deploy.yaml index e4cbc7c18..fdc123037 100644 --- a/.github/workflows/check-build-deploy.yaml +++ b/.github/workflows/check-build-deploy.yaml @@ -206,7 +206,7 @@ jobs: github.event.pull_request.head.repo.full_name == 'CSSUoB/TeX-Bot-Py-V2' runs-on: ubuntu-latest environment: publish - needs: [mypy, pre-commit, prevent-migrations-deletion, pymarkdown, pytest, ruff-lint, uv-check] + needs: [mypy, pre-commit, pymarkdown, pytest, ruff-lint, uv-check] permissions: contents: read packages: write From 7ee8e0746f20610a8bd2948cb57167350a076f02 Mon Sep 17 00:00:00 2001 From: MattyTheHacker <18513864+MattyTheHacker@users.noreply.github.com> Date: Tue, 15 Apr 2025 11:22:25 +0100 Subject: [PATCH 4/4] change name --- .github/workflows/prevent-migrations-deletion.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prevent-migrations-deletion.yaml b/.github/workflows/prevent-migrations-deletion.yaml index 7b05558be..dec108f6e 100644 --- a/.github/workflows/prevent-migrations-deletion.yaml +++ b/.github/workflows/prevent-migrations-deletion.yaml @@ -12,7 +12,7 @@ jobs: pull-requests: read steps: - - name: Prevent migrations files changing + - name: Prevent migrations files being changed or deleted uses: xalvarez/prevent-file-change-action@v2.0.0 with: githubToken: ${{ secrets.GITHUB_TOKEN }}