diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 732ab2a51..000000000 --- a/.gitattributes +++ /dev/null @@ -1,10 +0,0 @@ -# Git attributes configuration for selective merging - -# Prevent merging of GitHub workflow and configuration files - use custom driver -.github/** merge=keep-ours -.github/workflows/** merge=keep-ours -.github/ISSUE_TEMPLATE/** merge=keep-ours - -# Prevent merging of version info files -cookbook/version_info.py merge=ours -version.py merge=ours diff --git a/.github/workflows/build-docker-open-data.yml b/.github/workflows/build-docker-open-data.yml new file mode 100644 index 000000000..597221cac --- /dev/null +++ b/.github/workflows/build-docker-open-data.yml @@ -0,0 +1,112 @@ +name: Build Docker Container with open data plugin installed + +on: + push: + branches: [disabled] + +jobs: + build-container: + name: Build ${{ matrix.name }} Container + runs-on: ubuntu-latest + if: github.repository_owner == 'TandoorRecipes' + continue-on-error: ${{ matrix.continue-on-error }} + permissions: + contents: read + packages: write + strategy: + matrix: + include: + # Standard build config + - name: Standard + dockerfile: Dockerfile + platforms: linux/amd64,linux/arm64 + suffix: "" + continue-on-error: false + steps: + - uses: actions/checkout@v4 + + - name: Get version number + id: get_version + run: | + if [[ "$GITHUB_REF" = refs/tags/* ]]; then + echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT + elif [[ "$GITHUB_REF" = refs/heads/beta ]]; then + echo VERSION=beta >> $GITHUB_OUTPUT + else + echo VERSION=develop >> $GITHUB_OUTPUT + fi + + # clone open data plugin + - name: clone open data plugin repo + uses: actions/checkout@master + with: + repository: TandoorRecipes/open_data_plugin + ref: master + path: ./recipes/plugins/open_data_plugin + + # Build Vue frontend + - uses: actions/setup-node@v4 + with: + node-version: '18' + cache: yarn + cache-dependency-path: vue/yarn.lock + - name: Install dependencies + working-directory: ./vue + run: yarn install --frozen-lockfile + - name: Build dependencies + working-directory: ./vue + run: yarn build + + - name: Setup Open Data Plugin Links + working-directory: ./recipes/plugins/open_data_plugin + run: python setup_repo.py + + - name: Build Open Data Frontend + working-directory: ./recipes/plugins/open_data_plugin/vue + run: yarn build + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub + uses: docker/login-action@v3 + if: github.secret_source == 'Actions' + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + if: github.secret_source == 'Actions' + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + vabene1111/recipes + ghcr.io/TandoorRecipes/recipes + flavor: | + latest=false + suffix=${{ matrix.suffix }} + tags: | + type=raw,value=latest,suffix=-open-data-plugin,enable=${{ startsWith(github.ref, 'refs/tags/') }} + type=semver,suffix=-open-data-plugin,pattern={{version}} + type=semver,suffix=-open-data-plugin,pattern={{major}}.{{minor}} + type=semver,suffix=-open-data-plugin,pattern={{major}} + type=ref,suffix=-open-data-plugin,event=branch + - name: Build and Push + uses: docker/build-push-action@v5 + with: + context: . + file: ${{ matrix.dockerfile }} + pull: true + push: ${{ github.secret_source == 'Actions' }} + platforms: ${{ matrix.platforms }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 000000000..bc37abf3b --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,83 @@ +name: Build Docker Container + +on: + push: + branches: [tandoor-1] + +jobs: + build-container: + name: Build ${{ matrix.name }} Container + runs-on: ubuntu-latest + if: github.repository_owner == 'TandoorRecipes' + continue-on-error: ${{ matrix.continue-on-error }} + permissions: + contents: read + packages: write + strategy: + matrix: + include: + # Standard build config + - name: Standard + dockerfile: Dockerfile + platforms: linux/amd64,linux/arm64,linux/arm/v7 + suffix: "" + continue-on-error: false + steps: + - uses: actions/checkout@v4 + + # Build Vue frontend + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: yarn + cache-dependency-path: vue/yarn.lock + - name: Install dependencies + working-directory: ./vue + run: yarn install --frozen-lockfile + - name: Build dependencies + working-directory: ./vue + run: yarn build + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub + uses: docker/login-action@v3 + if: github.secret_source == 'Actions' + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + if: github.secret_source == 'Actions' + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + vabene1111/recipes + ghcr.io/TandoorRecipes/recipes + flavor: | + latest=false + suffix=${{ matrix.suffix }} + tags: | + type=raw,value=tandoor-v1-{{date 'YYYYMMDD'}} + type=raw,value=tandoor-v1 + - name: Build and Push + uses: docker/build-push-action@v5 + with: + context: . + file: ${{ matrix.dockerfile }} + pull: true + push: ${{ github.secret_source == 'Actions' }} + platforms: ${{ matrix.platforms }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e6fc364a4..65a9d9771 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,111 +1,86 @@ name: Continuous Integration -on: - workflow_dispatch: - workflow_call: +on: + push: + branches: [disabled] pull_request: - branches: [ "main", "master", "working" ] + branches: [disabled] -# Cancel redundant runs -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -permissions: - contents: read jobs: - test: - runs-on: ubuntu-latest - timeout-minutes: 120 - permissions: - contents: read - actions: read + build: + if: github.repository_owner == 'TandoorRecipes' + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + matrix: + python-version: ["3.10"] + node-version: ["18"] - strategy: - fail-fast: false - max-parallel: 4 - matrix: - # 3.13 CI disabled due until https://github.com/TandoorRecipes/recipes/issues/3784 resolved - # python-version: ["3.12", "3.13"] - python-version: ["3.12"] - node-version: ["20"] + steps: + - uses: actions/checkout@v4 + - uses: awalsh128/cache-apt-pkgs-action@v1.4.3 + with: + packages: libsasl2-dev python3-dev libxml2-dev libxmlsec1-dev libxslt-dev libxmlsec1-openssl libldap2-dev libssl-dev gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev openssl-dev libffi-dev cargo openldap-dev python3-dev xmlsec-dev xmlsec build-base g++ curl + version: 1.0 - steps: - - uses: actions/checkout@v4 + # Setup python & dependencies + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" - - uses: awalsh128/cache-apt-pkgs-action@5902b33ae29014e6ca012c5d8025d4346556bd40 # v1.4.3 - with: - packages: libsasl2-dev python3-dev libxml2-dev libxmlsec1-dev libxslt-dev libxmlsec1-openssl libldap2-dev libssl-dev gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev openssl-dev libffi-dev cargo openldap-dev python3-dev xmlsec-dev xmlsec build-base g++ curl - version: 1.0 + - name: Install Python Dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt - # Setup python & dependencies - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - cache: "pip" + - name: Cache StaticFiles + uses: actions/cache@v4 + id: django_cache + with: + path: | + ./cookbook/static + ./vue/webpack-stats.json + ./staticfiles + key: | + ${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.node-version }}-collectstatic-${{ hashFiles('**/*.css', '**/*.js', 'vue/src/*') }} - - name: Install Python Dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt + # Build Vue frontend & Dependencies + - name: Set up Node ${{ matrix.node-version }} + if: steps.django_cache.outputs.cache-hit != 'true' + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "yarn" + cache-dependency-path: ./vue/yarn.lock - - name: Cache StaticFiles - uses: actions/cache@v4 - id: django_cache - with: - path: | - ./cookbook/static - ./vue/webpack-stats.json - ./staticfiles - key: | - ${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.node-version }}-collectstatic-${{ hashFiles('**/*.css', '**/*.js', 'vue/src/*') }} + - name: Install Vue dependencies + if: steps.django_cache.outputs.cache-hit != 'true' + working-directory: ./vue + run: yarn install - # Build Vue frontend & Dependencies - - name: Set up Node ${{ matrix.node-version }} - if: steps.django_cache.outputs.cache-hit != 'true' - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: "yarn" - cache-dependency-path: ./vue/yarn.lock + - name: Build Vue dependencies + if: steps.django_cache.outputs.cache-hit != 'true' + working-directory: ./vue + run: yarn build - - name: Install Vue dependencies - if: steps.django_cache.outputs.cache-hit != 'true' - working-directory: ./vue - run: yarn install + - name: Compile Django StaticFiles + if: steps.django_cache.outputs.cache-hit != 'true' + run: | + python3 manage.py collectstatic --noinput + python3 manage.py collectstatic_js_reverse - - name: Build Vue dependencies - if: steps.django_cache.outputs.cache-hit != 'true' - working-directory: ./vue - run: yarn build + - uses: actions/cache/save@v4 + if: steps.django_cache.outputs.cache-hit != 'true' + with: + path: | + ./cookbook/static + ./vue/webpack-stats.json + ./staticfiles + key: | + ${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.node-version }}-collectstatic-${{ hashFiles('**/*.css', '**/*.js', 'vue/src/*') }} - - name: Compile Django StaticFiles - if: steps.django_cache.outputs.cache-hit != 'true' - run: | - python3 manage.py collectstatic --noinput - python3 manage.py collectstatic_js_reverse - - - uses: actions/cache/save@v4 - if: steps.django_cache.outputs.cache-hit != 'true' - with: - path: | - ./cookbook/static - ./vue/webpack-stats.json - ./staticfiles - key: | - ${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.node-version }}-collectstatic-${{ hashFiles('**/*.css', '**/*.js', 'vue/src/*') }} - - # Testing - - name: Django Testing - run: pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml --disable-warnings - - # Upload test results - - name: Upload Test Results - uses: actions/upload-artifact@v4 - if: always() - with: - name: test-results-${{ matrix.python-version }}-${{ matrix.node-version }} - path: junit/test-results-*.xml - retention-days: 7 + - name: Django Testing project + run: pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 743a0cc3a..de8521c99 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,41 +1,53 @@ -name: "CodeQL" +name: "Code scanning - action" on: - workflow_dispatch: push: - branches: [ "main", "master", "develop", "working" ] + branches: [disabled] pull_request: - branches: [ "main", "master", "working" ] - schedule: - # Run weekly on Tuesdays at 2:17 AM UTC - - cron: '17 2 * * 2' + branches: [disabled] -permissions: - contents: read jobs: - analyze: - name: Analyze + CodeQL-Build: + if: github.repository_owner == 'TandoorRecipes' runs-on: ubuntu-latest - timeout-minutes: 360 - permissions: - contents: read - security-events: write - actions: read - strategy: - fail-fast: false - matrix: - language: ['python', 'javascript-typescript', 'actions'] - steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 + with: + # We must fetch at least the immediate parents so that if this is + # a pull request then we can checkout the head. + fetch-depth: 2 - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - queries: security-extended + # If this run was triggered by a pull request event, then checkout + # the head of the pull request instead of the merge commit. + - run: git checkout HEAD^2 + if: ${{ github.event_name == 'pull_request' }} - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + # Override language selection by uncommenting this and choosing your languages + with: + languages: python, javascript + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + # - name: Autobuild + # uses: github/codeql-action/autobuild@v1 + + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + languages: javascript, python diff --git a/.github/workflows/create-upstream-pr.yml b/.github/workflows/create-upstream-pr.yml new file mode 100644 index 000000000..292753457 --- /dev/null +++ b/.github/workflows/create-upstream-pr.yml @@ -0,0 +1,235 @@ +name: Create Upstream PR + +on: + workflow_run: + workflows: ["Push Workflow"] + types: + - completed + branches: [working] + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + +jobs: + create-upstream-pr: + runs-on: ubuntu-latest + concurrency: + group: upstream-pr + cancel-in-progress: true + if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' + steps: + - name: Generate GitHub App token (for branch push) + id: generate_token_push + uses: actions/create-github-app-token@v2 + with: + app-id: ${{ secrets.BOT_APP_ID }} + private-key: ${{ secrets.BOT_PRIVATE_KEY }} + + - name: Checkout fork + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ steps.generate_token_push.outputs.token }} + + - name: Setup git user + run: | + git config user.name "GitHub Action" + git config user.email "action@github.com" + + - name: Add upstream remote + run: | + git remote get-url upstream || git remote add upstream https://github.com/TandoorRecipes/recipes.git + git fetch upstream + + - name: Ensure jq is available + run: | + if ! command -v jq &> /dev/null; then + sudo apt-get update && sudo apt-get install -y jq + fi + + - name: Create upstream PR branch + id: create_branch + run: | + BRANCH_NAME="upstream-pr-$(date +%Y%m%d-%H%M%S)" + git checkout -b "$BRANCH_NAME" || { echo "❌ Failed to create branch $BRANCH_NAME"; exit 1; } + echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT + echo "✅ Created branch: $BRANCH_NAME" + + - name: Restore upstream infrastructure files + id: restore_infra + run: | + BRANCH_NAME="${{ steps.create_branch.outputs.branch_name }}" + git checkout "$BRANCH_NAME" + git rm .gitattributes || echo "â„šī¸ .gitattributes not present, skipping removal." + git checkout upstream/tandoor-1 -- .github/workflows/ || echo "â„šī¸ No workflows to restore." + git checkout upstream/tandoor-1 -- cookbook/version_info.py || echo "â„šī¸ No version_info.py to restore." + git add . + if ! git diff --cached --quiet; then + git commit -m $'Restore upstream infrastructure files for PR\n\n- Removed fork-specific .gitattributes\n- Restored upstream .github/workflows/\n- Restored upstream cookbook/version_info.py' + echo "✅ Infrastructure files restored and committed." + else + echo "â„šī¸ No infrastructure changes to commit." + fi + + - name: Push branch to fork (after infra commit) + env: + GITHUB_TOKEN: ${{ steps.generate_token_push.outputs.token }} + run: | + BRANCH_NAME="${{ steps.create_branch.outputs.branch_name }}" + echo "Pushing branch $BRANCH_NAME after infra file restore." + git push --set-upstream https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git "$BRANCH_NAME" + echo "✅ Branch pushed: $BRANCH_NAME (infra files)" + + + - name: Merge upstream branch + id: merge_upstream + run: | + BRANCH_NAME="${{ steps.create_branch.outputs.branch_name }}" + git checkout "$BRANCH_NAME" + if git merge --no-edit upstream/tandoor-1; then + echo "✅ Merged upstream/tandoor-1 into $BRANCH_NAME" + if ! git diff --cached --quiet || [ -n "$(git log origin/$BRANCH_NAME..$BRANCH_NAME --oneline)" ]; then + echo "merge_commit=true" >> $GITHUB_OUTPUT + else + echo "merge_commit=false" >> $GITHUB_OUTPUT + fi + else + echo "❌ Merge conflict detected during merge with upstream/tandoor-1. Please resolve conflicts manually." >&2 + exit 1 + fi + + - name: Push branch to fork (after merge) + if: steps.merge_upstream.outputs.merge_commit == 'true' + env: + GITHUB_TOKEN: ${{ steps.generate_token_push.outputs.token }} + run: | + BRANCH_NAME="${{ steps.create_branch.outputs.branch_name }}" + echo "Pushing branch $BRANCH_NAME after merge." + git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git "$BRANCH_NAME" + echo "✅ Branch pushed: $BRANCH_NAME (after merge)" + + + - name: Get commit list + id: get_commits + run: | + BRANCH_NAME="${{ steps.create_branch.outputs.branch_name }}" + COMMITS_RAW=$(git log upstream/tandoor-1..$BRANCH_NAME --oneline) + if [ -z "$COMMITS_RAW" ]; then + echo "has_changes=false" >> $GITHUB_OUTPUT + echo "✅ No commits to contribute - exiting gracefully" + exit 0 + fi + echo "commits_raw<> $GITHUB_OUTPUT + printf "%s\n" "$COMMITS_RAW" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + echo "has_changes=true" >> $GITHUB_OUTPUT + + + - name: Get changed files + id: get_files + run: | + BRANCH_NAME="${{ steps.create_branch.outputs.branch_name }}" + CHANGED_FILES=$(git diff upstream/tandoor-1..$BRANCH_NAME --name-only) + echo "changed_files<> $GITHUB_OUTPUT + printf "%s\n" "$CHANGED_FILES" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + CODE_COUNT=$(echo "$CHANGED_FILES" | grep -c '^' || true) + echo "code_count=$CODE_COUNT" >> $GITHUB_OUTPUT + + - name: Summarize changes + id: summarize_changes + run: | + CODE_COUNT=${{ steps.get_files.outputs.code_count }} + CHANGES_SUMMARY="Modified $CODE_COUNT code files" + echo "changes_summary=$CHANGES_SUMMARY" >> $GITHUB_OUTPUT + + - name: Prepare commit subjects and JSON + id: prepare_commits + run: | + COMMITS_RAW="${{ steps.get_commits.outputs.commits_raw }}" + CODE_FILES=( $(echo "${{ steps.get_files.outputs.changed_files }}") ) + FILTERED_COMMITS_JSON="[]" + COMMIT_SUBJECTS_ARRAY=() + INFRA_PATTERNS='^\.github/|^cookbook/version_info\.py$|^\.gitattributes$' + while IFS= read -r commit_line; do + if [ -z "$commit_line" ]; then continue; fi + COMMIT_SHA=$(echo "$commit_line" | cut -d' ' -f1) + COMMIT_SUBJECT=$(echo "$commit_line" | cut -d' ' -f2-) + mapfile -t COMMIT_FILES < <(git diff-tree --no-commit-id --name-only -r "$COMMIT_SHA" | grep -Ev "$INFRA_PATTERNS") + # Only include commit if it touches at least one non-infra file that is still different + INCLUDE_COMMIT=false + for file in "${COMMIT_FILES[@]}"; do + for code_file in "${CODE_FILES[@]}"; do + if [ "$file" = "$code_file" ]; then + INCLUDE_COMMIT=true + break 2 + fi + done + done + if [ "$INCLUDE_COMMIT" = true ]; then + COMMIT_SUBJECTS_ARRAY+=("- $COMMIT_SUBJECT") + FILES_JSON=$(printf '%s\n' "${COMMIT_FILES[@]}" | jq -R . | jq -s .) + COMMIT_JSON=$(jq -n --arg sha "$COMMIT_SHA" --arg subject "$COMMIT_SUBJECT" --argjson files "$FILES_JSON" '{sha: $sha, subject: $subject, files: $files}') + FILTERED_COMMITS_JSON=$(echo "$FILTERED_COMMITS_JSON" | jq --argjson item "$COMMIT_JSON" '. + [$item]') + fi + done <<< "$COMMITS_RAW" + echo 'commits_json<> $GITHUB_OUTPUT + printf "%s\n" "$FILTERED_COMMITS_JSON" >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT + echo "commit_subjects<> $GITHUB_OUTPUT + printf '%s\n' "${COMMIT_SUBJECTS_ARRAY[@]}" >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT + + + - name: Build PR content + if: steps.get_commits.outputs.has_changes == 'true' + id: build_pr_content + uses: actions/github-script@v7 + env: + COMMITS_JSON: ${{ steps.prepare_commits.outputs.commits_json }} + CHANGES_SUMMARY: ${{ steps.summarize_changes.outputs.changes_summary }} + BRANCH_NAME: ${{ steps.create_branch.outputs.branch_name }} + GITHUB_REPOSITORY: ${{ github.repository }} + with: + github-token: ${{ steps.generate_token_push.outputs.token }} + script: | + const commits = JSON.parse(process.env.COMMITS_JSON || '[]'); + const changesSummary = process.env.CHANGES_SUMMARY || 'Changes from fork'; + const branchName = process.env.BRANCH_NAME || ''; + const repo = process.env.GITHUB_REPOSITORY || ''; + const [owner, reponame] = repo.split('/'); + const nCommits = commits.length; + let prTitle = 'Sync ' + nCommits + ' commit' + (nCommits !== 1 ? 's' : '') + ' from fork:'; + if (nCommits > 0) { + prTitle += ' ' + commits[0].subject; + } + let prBody = `This PR syncs ${nCommits} commit${nCommits !== 1 ? 's' : ''} from branch ${branchName}.\n\n`; + prBody += `**Changes Summary:**\n${changesSummary}\n\n`; + prBody += `Commits included:\n`; + for (const c of commits) { + prBody += `- ${c.subject} ([${c.sha}](https://github.com/${owner}/${reponame}/commit/${c.sha}))\n`; + } + prBody += `\n---\n`; + core.setOutput('prTitle', prTitle); + core.setOutput('prBody', prBody); + + + - name: Print PR creation instructions + if: steps.get_commits.outputs.has_changes == 'true' + env: + BRANCH_NAME: ${{ steps.create_branch.outputs.branch_name }} + PR_TITLE: ${{ steps.build_pr_content.outputs.prTitle }} + PR_BODY: ${{ steps.build_pr_content.outputs.prBody }} + run: | + echo "✅ Branch pushed: $BRANCH_NAME" + echo + echo "To create a pull request, open:" + echo "https://github.com/TandoorRecipes/recipes/compare/tandoor-1...${{ github.repository_owner }}:$BRANCH_NAME?expand=1" + echo + echo "Suggested PR title:" + echo "$PR_TITLE" + echo + echo "Suggested PR body:" + echo "$PR_BODY" diff --git a/.github/workflows/dependabot-automerge.yml b/.github/workflows/dependabot-automerge.yml index 7536c60a7..bf2682293 100644 --- a/.github/workflows/dependabot-automerge.yml +++ b/.github/workflows/dependabot-automerge.yml @@ -25,18 +25,18 @@ jobs: uses: actions-ecosystem/action-add-labels@1a9c3715c0037e96b97bb38cb4c4b56a1f1d4871 # v1.1.0 with: labels: invalid - + - name: Comment restriction uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 with: issue-number: ${{ github.event.pull_request.number }} body: | âš ī¸ **Automerge Restriction Notice** - + The `automerge` label has been removed from this PR because it has restricted use. Only PRs created by `dependabot[bot]` are allowed to use the automerge functionality. - + If you believe this is an error, please contact a repository maintainer. - + auto-merge: if: github.actor == 'dependabot[bot]' && contains(github.event.pull_request.labels.*.name, 'automerge') runs-on: ubuntu-latest @@ -57,9 +57,9 @@ jobs: github-token: ${{ steps.generate_token.outputs.token }} review-message: | 🤖 **Dependabot Auto-merge** - + This PR has been automatically approved and enabled for auto-merge. It will be merged automatically once all required checks pass. - + - name: Enable auto-merge uses: daneden/enable-automerge-action@f8558b65c5b8d8bfb592c4e74e3d491624a38fbd # v1.0.0 with: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 000000000..c679b8062 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,20 @@ +name: Make Docs +on: + # the 1st condition + workflow_run: + workflows: ["Continuous Integration"] + branches: [master] + types: + - completed + +jobs: + deploy: + if: github.repository_owner == 'TandoorRecipes' && ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - run: pip install mkdocs-material mkdocs-include-markdown-plugin + - run: mkdocs gh-deploy --force diff --git a/.github/workflows/push-orchestrator.yml b/.github/workflows/push-orchestrator.yml index 8f6c795d8..2375afd04 100644 --- a/.github/workflows/push-orchestrator.yml +++ b/.github/workflows/push-orchestrator.yml @@ -16,7 +16,7 @@ jobs: pull-requests: read outputs: pr_merged: ${{ steps.detect_pr.outputs.result }} - steps: + steps: - name: Check if commit is part of a PR id: detect_pr uses: actions/github-script@v7 @@ -30,7 +30,7 @@ jobs: const pr = prs.data.find(pr => pr.merged_at); const merged = pr ? 'true' : 'false'; - + // Set the output explicitly core.setOutput('pr_merged', merged); return merged; diff --git a/.github/workflows/stage-branch-for-pr.yml b/.github/workflows/stage-branch-for-pr.yml index 4b7c6fcbd..4f8b278a8 100644 --- a/.github/workflows/stage-branch-for-pr.yml +++ b/.github/workflows/stage-branch-for-pr.yml @@ -242,7 +242,7 @@ jobs: const prBody = process.env.PR_BODY || ''; const repo = process.env.GITHUB_REPOSITORY || ''; const [owner, reponame] = repo.split('/'); - const prLink = `https://github.com/TandoorRecipes/recipes/compare/tandoor-1...${owner}:${branch}?expand=1&title=${encodeURIComponent(prTitle)}&body=${encodeURIComponent(prBody)}`; + const prLink = `https://github.com/TandoorRecipes/recipes/compare/tandoor-1...${owner}:${branch}?expand=1&title=${encodeURIComponent(prTitle)}`; const issueTitle = `Manual Upstream PR Checklist: ${branch}`; const issueBody = [ `A new branch is ready for upstream PR submission.`, diff --git a/cookbook/version_info.py b/cookbook/version_info.py index d606daee7..65c435815 100644 --- a/cookbook/version_info.py +++ b/cookbook/version_info.py @@ -1,3 +1,3 @@ -TANDOOR_VERSION = "cf0401a119ba4024a53dbdf877e4cdb5522f4f32" -TANDOOR_REF = "cf0401a119ba4024a53dbdf877e4cdb5522f4f32" -VERSION_INFO = [{'name': 'Tandoor ', 'version': 'commit cf0401a119ba4024a53dbdf877e4cdb5522f4f32\nAuthor: smilerz \nDate: Fri Mar 22 15:34:54 2024 -0500\n\n python client generation\n', 'website': 'https://github.com/smilerz/recipes', 'commit_link': 'https://github.com/smilerz/recipes/commit/cf0401a119ba4024a53dbdf877e4cdb5522f4f32', 'ref': 'cf0401a119ba4024a53dbdf877e4cdb5522f4f32', 'branch': 'working', 'tag': ''}] \ No newline at end of file +TANDOOR_VERSION = "" +TANDOOR_REF = "" +VERSION_INFO = []