Skip to content

Commit 766b5cf

Browse files
authored
Merge branch 'main' into dependabot/cargo/jsonwebtoken-10.3.0
2 parents ed84306 + 8b913d8 commit 766b5cf

15 files changed

+158
-108
lines changed

.github/workflows/changelog.yml

Lines changed: 53 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,46 +17,75 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout repository
20-
# v6.0.2
20+
# yamllint disable-line rule:line-length
2121
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2222
with:
2323
fetch-depth: 0
2424

2525
- name: Generate changelog
26-
# v4.5.0
27-
uses: orhun/git-cliff-action@c93ef52f3d0ddcdcc9bd5447d98d458a11cd4f72
26+
# yamllint disable-line rule:line-length
27+
uses: orhun/git-cliff-action@c93ef52f3d0ddcdcc9bd5447d98d458a11cd4f72 # v4.5.0
2828
with:
2929
config: cliff.toml
3030
args: --verbose
3131
env:
3232
OUTPUT: CHANGELOG.md
3333

34-
- name: Commit changelog
34+
- name: Check for changes
35+
id: diff
36+
run: |
37+
if git diff --quiet CHANGELOG.md 2>/dev/null; then
38+
echo "changed=false" >> "$GITHUB_OUTPUT"
39+
else
40+
echo "changed=true" >> "$GITHUB_OUTPUT"
41+
fi
42+
43+
- name: Create pull request
44+
if: steps.diff.outputs.changed == 'true'
3545
env:
3646
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3747
TAG_NAME: ${{ github.ref_name }}
3848
run: |
39-
if git diff --quiet CHANGELOG.md 2>/dev/null; then
40-
echo "No changes to commit"
41-
exit 0
49+
BRANCH="chore/changelog-${TAG_NAME}"
50+
51+
# Reuse existing remote branch if it already exists; otherwise create it.
52+
if git ls-remote --exit-code origin "${BRANCH}" >/dev/null 2>&1; then
53+
echo "Branch ${BRANCH} already exists on origin; checking it out."
54+
git fetch origin "${BRANCH}:${BRANCH}"
55+
git checkout "${BRANCH}"
56+
else
57+
echo "Creating new branch ${BRANCH}."
58+
git checkout -b "${BRANCH}"
4259
fi
4360
44-
REPO="${{ github.repository }}"
45-
API_PATH="repos/${REPO}/contents/CHANGELOG.md"
46-
CONTENT=$(base64 -i CHANGELOG.md)
47-
SHA=$(gh api "$API_PATH" \
48-
--jq '.sha' 2>/dev/null || echo "")
49-
50-
MSG="docs: update CHANGELOG.md for ${TAG_NAME}"
51-
ARGS=(
52-
-f "message=${MSG}"
53-
-f "content=${CONTENT}"
54-
-f "branch=main"
55-
)
56-
if [ -n "$SHA" ]; then
57-
ARGS+=(-f "sha=${SHA}")
61+
git add CHANGELOG.md
62+
git config user.name "github-actions[bot]"
63+
git config user.email "github-actions[bot]@users.noreply.github.com"
64+
65+
# Only commit and push if there are staged changes.
66+
if git diff --cached --quiet; then
67+
echo "No changes to commit on branch ${BRANCH}; skipping commit and push."
68+
else
69+
git commit -m "docs: update CHANGELOG.md for ${TAG_NAME}"
70+
git push origin "${BRANCH}"
5871
fi
5972
60-
gh api "$API_PATH" \
61-
--method PUT "${ARGS[@]}"
62-
echo "Changelog updated via GitHub API"
73+
TITLE="docs: update CHANGELOG.md for ${TAG_NAME}"
74+
BODY="Auto-generated changelog update for ${TAG_NAME}."
75+
76+
# Reuse existing open PR for this branch if present; otherwise create a new one.
77+
PR_NUMBER="$(gh pr list --head "${BRANCH}" --state open --json number --jq '.[0].number' || true)"
78+
79+
if [ -z "${PR_NUMBER}" ]; then
80+
echo "No existing pull request for ${BRANCH}; creating a new one."
81+
gh pr create \
82+
--title "${TITLE}" \
83+
--body "${BODY}" \
84+
--base main \
85+
--head "${BRANCH}"
86+
else
87+
echo "Pull request #${PR_NUMBER} already exists for ${BRANCH}; updating title and body."
88+
gh pr edit "${PR_NUMBER}" \
89+
--title "${TITLE}" \
90+
--body "${BODY}"
91+
fi

.github/workflows/ci-doctor.lock.yml

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/container-scan.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232

3333
- name: Run Trivy vulnerability scanner
3434
# master
35-
uses: aquasecurity/trivy-action@97e0b3872f55f89b95b2f65b3dbab56962816478
35+
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1
3636
with:
3737
image-ref: rust-template:scan
3838
format: sarif
@@ -48,7 +48,7 @@ jobs:
4848

4949
- name: Generate human-readable report
5050
# master
51-
uses: aquasecurity/trivy-action@97e0b3872f55f89b95b2f65b3dbab56962816478
51+
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1
5252
with:
5353
image-ref: rust-template:scan
5454
format: table

.github/workflows/daily-docs-review.lock.yml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/daily-qa.lock.yml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/daily-repo-status.lock.yml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/issue-triage.lock.yml

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)