Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SITE-1585] Move check-commits into GitHub actions #146

Merged
merged 32 commits into from
Jul 31, 2024

Conversation

jazzsequence
Copy link
Contributor

@jazzsequence jazzsequence commented Jul 30, 2024

This PR moves the check-commits script into a GitHub action workflow. It does not remove it from the deploy workflow, but adding it to a GHA workflow means that if we would mix non-release and release commits in a single PR, we are alerted early because the PR will fail.

This PR also creates a relationship between the Playwright (functional) tests and the linting tests and commit checks. If anything in the linting tests (ci.yml) fails, it prevents the Playwright tests from executing.

If the check-commits script fails -- and finds mixed commits to release and non-release files in the same PR -- a message is added to the PR and the workflow fails.

This does not change or fix the issues in the upstream or solve the issue described in SITE-1585, but it will (attempt to) prevent issues that currently exist in the upstream from happening again by failing the PR early.

this may or may not work depending on how GHA sources files, but we'll start here
@jazzsequence jazzsequence changed the title just add a step that runs the script [SITE-1585] Move check-commits into GitHub actions Jul 30, 2024
@jazzsequence jazzsequence marked this pull request as ready for review July 30, 2024 20:07
@jazzsequence jazzsequence requested review from a team as code owners July 30, 2024 20:07
@@ -35,7 +35,7 @@ function identify_commit_type() {
# Verifies that the given commit does not contain forbidden files.
function only_allowed_files() {
local commit=$1
local forbidden_files=("composer.lock" ".github/workflows/ci.yml")
local forbidden_files=("composer.lock" "package-lock.json")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove .github/workflows/ci.yml?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the immediate need, it was blocking the workflow from running on this PR. However, I tried to figure out why we added it in the first place and it looked like a "¯_(ツ)_/¯ maybe this will fix something" addition. There was no ticket associated with it and I don't really know why we would be disallowing changes to the workflow (they're non-release changes anyway).

Copy link
Member

@greg-1-anderson greg-1-anderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@jazzsequence jazzsequence merged commit 498e705 into default Jul 31, 2024
13 checks passed
@jazzsequence jazzsequence deleted the site-1585-move-commit-checker branch July 31, 2024 15:03
jazzsequence added a commit that referenced this pull request Jul 31, 2024
* just add a step that runs the script
this may or may not work depending on how GHA sources files, but we'll start here

* specify the path

* run a git fetch before running the script

* check out default branch so we have a local copy

* check out a local copy of default

* don't warn about detached head

* allow changes to ci.yml

* remove `variable`

* create a failure status artifact
don't run playwright tests if ci failed

* don't create a status file if it already exists

* create an aggregate status file

* use the same php-version matrix

* remove aggregate status

* pull and aggregate all statuses

* update perms and add logging

* trigger on workflow dispatch

* remove status checks

* trigger workflow on success

* add token

* re-add the status artifacts

* go back to running on PR

* wait for the status artifacts and check them before running the tests

* remove test job

* add missing done

* add some debugging code

* make the files unique

* allow gh run download to fail

* upload the artifacts

* add a comment when we're done checking the linting status

* comment on the PR

* update permissions

* exclude status check files
jazzsequence added a commit that referenced this pull request Aug 1, 2024
* just add a step that runs the script
this may or may not work depending on how GHA sources files, but we'll start here

* specify the path

* run a git fetch before running the script

* check out default branch so we have a local copy

* check out a local copy of default

* don't warn about detached head

* allow changes to ci.yml

* remove `variable`

* create a failure status artifact
don't run playwright tests if ci failed

* don't create a status file if it already exists

* create an aggregate status file

* use the same php-version matrix

* remove aggregate status

* pull and aggregate all statuses

* update perms and add logging

* trigger on workflow dispatch

* remove status checks

* trigger workflow on success

* add token

* re-add the status artifacts

* go back to running on PR

* wait for the status artifacts and check them before running the tests

* remove test job

* add missing done

* add some debugging code

* make the files unique

* allow gh run download to fail

* upload the artifacts

* add a comment when we're done checking the linting status

* comment on the PR

* update permissions

* exclude status check files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants