Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## The Issue

- Fixes #REPLACE_ME_WITH_RELATED_ISSUE_NUMBER

<!-- Provide a brief description of the issue. -->

## How This PR Solves The Issue

<!-- Describe the key change(s) in this PR that address the issue above. -->

## Manual Testing Instructions

<!-- If this PR changes logic, consider adding additional steps or context to the instructions below. -->

## Automated Testing Overview

<!-- Please describe the tests introduced by this PR, or explain why no tests are needed. -->

## Release/Deployment Notes

<!-- Does this affect anything else or have ramifications for other code? Does anything have to be done on deployment? -->
55 changes: 43 additions & 12 deletions .github/workflows/deploy-to-github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Load 1password secret(s)
if: ${{ !inputs.skip_update_addons && !contains(github.event.head_commit.message, '[skip update]') }}
uses: 1password/load-secrets-action@v3
uses: 1password/load-secrets-action@v4
with:
export-env: true
env:
Expand All @@ -58,6 +58,12 @@ jobs:
with:
limit-access-to-actor: true

- name: Fetch existing add-ons from history branch
if: ${{ !inputs.skip_update_addons && !contains(github.event.head_commit.message, '[skip update]') }}
run: |
git fetch origin history
git checkout origin/history -- _addons/ || echo "No existing _addons in history branch"

- name: Fetch add-on data with Go
if: ${{ !inputs.skip_update_addons && !contains(github.event.head_commit.message, '[skip update]') }}
run: |
Expand All @@ -68,7 +74,7 @@ jobs:
- name: Check for GitHub search API degradation
if: ${{ !inputs.skip_update_addons && !contains(github.event.head_commit.message, '[skip update]') }}
run: |
# Check if any deleted addon repos still have the ddev-get topic (indicating search API issues)
# Check if any deleted add-on repos still have the ddev-get topic (indicating search API issues)
DELETED_ADDONS=$(git status --porcelain | grep '^.D.*\.md$' | sed 's|.D _addons/\([^/]*\)/\([^/]*\)\.md|\1/\2|')

if [ -n "$DELETED_ADDONS" ]; then
Expand Down Expand Up @@ -141,8 +147,8 @@ jobs:
ADDON_FILE="_addons/$repo.md"
OWNER=$(echo "$repo" | cut -d'/' -f1)
OWNER_INDEX="_addons/$OWNER/index.html"
git checkout HEAD -- "$ADDON_FILE" || { echo "Could not restore $ADDON_FILE"; exit 1; }
git checkout HEAD -- "$OWNER_INDEX" || { echo "Could not restore $OWNER_INDEX"; exit 1; }
git checkout origin/history -- "$ADDON_FILE" || { echo "Could not restore $ADDON_FILE"; exit 1; }
git checkout origin/history -- "$OWNER_INDEX" || { echo "Could not restore $OWNER_INDEX"; exit 1; }
echo "Files $ADDON_FILE and $OWNER_INDEX have been restored."
elif [ "$SHOULD_DELETE" = true ]; then
echo "$REASON, safe to delete."
Expand All @@ -152,25 +158,50 @@ jobs:
echo "No add-on deletions detected."
fi

- name: Commit and push changes
- name: Commit and push add-ons to history branch
if: ${{ !inputs.skip_update_addons && !contains(github.event.head_commit.message, '[skip update]') }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"

# Use a worktree to commit to history without switching branches
git worktree add /tmp/history-worktree origin/history
rm -rf /tmp/history-worktree/_addons/
cp -r _addons/ /tmp/history-worktree/_addons/

cd /tmp/history-worktree
SNAPSHOT_DATE=$(date +%F)
git add _addons/
git commit -m "Update addons [skip ci]" || echo "No changes to commit"
git push
if ! git diff --cached --quiet; then
LAST_MSG=$(git log -1 --pretty=%s)
if echo "$LAST_MSG" | grep -q "snapshot ${SNAPSHOT_DATE}"; then
git commit --amend --no-edit
git push origin history --force-with-lease
else
git commit -m "chore(add-ons): snapshot ${SNAPSHOT_DATE}"
git push origin history
fi
else
echo "No changes to commit"
fi

git worktree remove /tmp/history-worktree

# Build job
build:
runs-on: ubuntu-latest
needs: update-addons
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
ref: main

- name: Fetch add-ons from history branch
run: |
git fetch origin history
git checkout origin/history -- _addons/

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
Expand All @@ -180,7 +211,7 @@ jobs:

- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
uses: actions/configure-pages@v6

- name: Build with Jekyll
# Outputs to the './_site' directory by default
Expand All @@ -190,7 +221,7 @@ jobs:

- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v4
uses: actions/upload-pages-artifact@v5

# Deployment job
deploy:
Expand All @@ -202,4 +233,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v5
Loading