Skip to content

Commit

Permalink
Make stable branch commit check clearer (#4727)
Browse files Browse the repository at this point in the history
# Summary

- Include remediation instructions in error message.
- Rename check file to "Release branch checks"
(release-branch-checks.yml)
- This makes the prefix of the check where it's listed on a PR
non-redundant, and also sets us up to potentially have more checks in
there in the future.
- I've called it "Release branch checks" instead of "Custom DC stable
branch checks" because technically the same checks would apply if we
ever wanted to use release branches for website prod and staging.
- Rename job to "verify_all_commits_are_already_in_master" so the name
makes sense on its own.

Also, update version of checkout action to one that isn't about to be
deprecated.

# Screenshots
## On PR
![on
PR](https://github.com/user-attachments/assets/af0e842c-19ae-485f-8d76-4e43f6e1db83)

## After clicking through from PR
![after clicking through from
PR](https://github.com/user-attachments/assets/4d68bf54-f8b5-4146-8a55-bc2183cfab31)

## In Actions tab
![in actions
tab](https://github.com/user-attachments/assets/f44d3bc4-a0a8-4350-bd80-236d9c0928a7)

## After clicking through from Actions tab
![after clicking through from actions
tab](https://github.com/user-attachments/assets/113e4093-0f6d-4005-a64f-7f6eaa0663c3)
  • Loading branch information
hqpho authored Nov 12, 2024
1 parent bbfaf23 commit 0bce14d
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name: all-commits-in-master
name: Release branch checks

on:
pull_request:
branches: [ "customdc_stable" ]

jobs:
check_commits:
verify_all_commits_are_already_in_master:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# Fetch all history for accurate comparison
fetch-depth: 0
# Check out the PR branch
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Check if commits exist in master
- name: Verify that all commits are already in the master branch
run: |
git remote add dc https://github.com/datacommonsorg/website.git
git fetch dc
Expand All @@ -26,8 +26,14 @@ jobs:
MISSING_COMMITS=$(git log --pretty="%H - %s" $MASTER_BRANCH..HEAD --)
if [[ -n "$MISSING_COMMITS" ]]; then
echo ""
echo "ERROR: The following commits are not present in $MASTER_BRANCH:"
echo ""
echo "$MISSING_COMMITS"
echo ""
echo "PRs to release branches should only contain commits that are already in master."
echo "To fix this PR, reset its branch locally to a commit at or behind https://github.com/datacommonsorg/website/commits/master/ and then force-push it."
echo "Note that a release branch PR should be based on master and not the previous version of the release branch, which contains merge commits."
exit 1
fi
Expand Down

0 comments on commit 0bce14d

Please sign in to comment.