Skip to content

Commit e3bceb7

Browse files
fix(project): stop creating duplicate hourly PRs in update cron jobs (#15318)
Because * The update cron jobs were creating a new PR every hour even when the tree content was identical, because the "skip if no changes" check was broken * git diff external-config origin/external-config fails with "unknown revision" because remote branches aren't fetched by default * The || fallback to git diff HEAD~1 always has content (we just committed), so the check always passed This commit * Fetches the remote branch before comparing * Only proceeds to close/recreate PR if the remote branch doesn't exist yet OR the tree content differs * Applies the same fix to the Firefox version updater script Fixes #15317
1 parent 4787e3d commit e3bceb7

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

.github/workflows/update-configs.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@ jobs:
4747
git checkout -B external-config
4848
git add experimenter/ schemas/
4949
git commit -m 'chore(nimbus): Update External Configs'
50-
if (( $((git diff external-config origin/external-config || git diff HEAD~1) | wc -c) > 0 )); then
50+
git fetch origin external-config 2>/dev/null || true
51+
if git show-ref --verify --quiet refs/remotes/origin/external-config && [ -z "$(git diff external-config origin/external-config)" ]; then
52+
echo "Content matches existing PR, skipping"
53+
else
5154
gh pr close external-config --repo mozilla/experimenter 2>/dev/null || true
5255
git push origin external-config -f
5356
gh pr create -t "chore(nimbus): Update External Configs" -F /tmp/pr-body.txt --base main --head external-config --repo mozilla/experimenter
54-
else
55-
echo "Changes already committed, skipping"
5657
fi
5758
else
5859
echo "No config changes, skipping"
@@ -97,12 +98,13 @@ jobs:
9798
git checkout -B update-application-services
9899
git add application-services/
99100
git commit -m "chore(nimbus): Update Application Services"
100-
if (( $((git diff update-application-services origin/update-application-services || git diff HEAD~1) | wc -c) > 0 )); then
101+
git fetch origin update-application-services 2>/dev/null || true
102+
if git show-ref --verify --quiet refs/remotes/origin/update-application-services && [ -z "$(git diff update-application-services origin/update-application-services)" ]; then
103+
echo "Content matches existing PR, skipping"
104+
else
101105
gh pr close update-application-services --repo mozilla/experimenter 2>/dev/null || true
102106
git push origin update-application-services -f
103107
gh pr create -t "chore(nimbus): Update Application Services" -b "" --base main --head update-application-services --repo mozilla/experimenter
104-
else
105-
echo "Changes already committed, skipping"
106108
fi
107109
else
108110
echo "No config changes, skipping"

scripts/external_integration_updater_script.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,14 @@ if (($(git status --porcelain | wc -c) > 0)); then
120120
fi
121121

122122
git commit -m "${COMMIT_MSG}"
123-
gh pr close "${BRANCH_NAME}" --repo mozilla/experimenter 2>/dev/null || true
124-
git push origin -f "${BRANCH_NAME}"
125-
gh pr create -t "${PR_TITLE}" -b "${PR_BODY}" --base main --head "${BRANCH_NAME}" --repo mozilla/experimenter
123+
git fetch origin "${BRANCH_NAME}" 2>/dev/null || true
124+
if git show-ref --verify --quiet "refs/remotes/origin/${BRANCH_NAME}" && [ -z "$(git diff "${BRANCH_NAME}" "origin/${BRANCH_NAME}")" ]; then
125+
echo "Content matches existing PR, skipping"
126+
else
127+
gh pr close "${BRANCH_NAME}" --repo mozilla/experimenter 2>/dev/null || true
128+
git push origin -f "${BRANCH_NAME}"
129+
gh pr create -t "${PR_TITLE}" -b "${PR_BODY}" --base main --head "${BRANCH_NAME}" --repo mozilla/experimenter
130+
fi
126131
else
127132
echo "No config changes, skipping"
128133
fi

0 commit comments

Comments
 (0)