Skip to content
Open
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
32 changes: 19 additions & 13 deletions .github/workflows/command-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,27 @@
needs: init

steps:
- name: Restore cached git repository
uses: buildjet/cache@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
with:
path: .git
key: git-repo

- name: Checkout ${{ needs.init.outputs.head_ref }}
- name: Checkout (shallow) ${{ needs.init.outputs.head_ref }}
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# Needed to allow force push later
persist-credentials: true
token: ${{ secrets.COMMAND_BOT_PAT }}
fetch-depth: 0
fetch-depth: 1
ref: ${{ needs.init.outputs.head_ref }}

- name: Fetch parent commit for amend
if: ${{ contains(needs.init.outputs.arg1, 'amend') }}
run: git fetch --deepen=1

- name: Fetch full history for rebase
if: ${{ contains(needs.init.outputs.arg1, 'rebase') }}
run: |
git fetch --unshallow
git fetch origin "${BASE_REF}:${BASE_REF}"
env:
BASE_REF: ${{ needs.init.outputs.base_ref }}

- name: Setup git
run: |
git config --local user.email 'nextcloud-command@users.noreply.github.com'
Expand All @@ -123,10 +129,10 @@
fallbackNode: '^24'
fallbackNpm: '^11.3'

- name: Set up node ${{ steps.package-engines-versions.outputs.nodeVersion }}
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: ${{ steps.package-engines-versions.outputs.nodeVersion }}

Check failure

Code scanning / CodeQL

Checkout of untrusted code in a privileged context Critical

Potential execution of untrusted code on a privileged workflow (
issue_comment
)
cache: npm

- name: Set up npm ${{ steps.package-engines-versions.outputs.npmVersion }}
Expand All @@ -134,23 +140,23 @@

- name: Rebase to ${{ needs.init.outputs.base_ref }}
if: ${{ contains(needs.init.outputs.arg1, 'rebase') }}
env:
BASE_REF: ${{ needs.init.outputs.base_ref }}
run: |
git fetch origin '${{ needs.init.outputs.base_ref }}:${{ needs.init.outputs.base_ref }}'

# Start the rebase
git rebase 'origin/${{ needs.init.outputs.base_ref }}' || {
git rebase "$BASE_REF" || {
# Handle rebase conflicts in a loop
while [ -d .git/rebase-merge ] || [ -d .git/rebase-apply ]; do
echo "Handling rebase conflict..."

# Remove and checkout /dist and /js folders from the base branch
if [ -d "dist" ]; then
rm -rf dist
git checkout origin/${{ needs.init.outputs.base_ref }} -- dist/ 2>/dev/null || echo "No dist folder in base branch"
git checkout "$BASE_REF" -- dist/ 2>/dev/null || echo "No dist folder in base branch"
fi
if [ -d "js" ]; then
rm -rf js
git checkout origin/${{ needs.init.outputs.base_ref }} -- js/ 2>/dev/null || echo "No js folder in base branch"
git checkout "$BASE_REF" -- js/ 2>/dev/null || echo "No js folder in base branch"
fi

# Stage all changes
Expand All @@ -166,15 +172,15 @@
fi

# Break if rebase is complete
if [ ! -d .git/rebase-merge ] && [ ! -d .git/rebase-apply ]; then
break
fi
done
}

- name: Install dependencies & build
env:
CYPRESS_INSTALL_BINARY: 0

Check failure

Code scanning / CodeQL

Checkout of untrusted code in a privileged context Critical

Potential execution of untrusted code on a privileged workflow (
issue_comment
)
PUPPETEER_SKIP_DOWNLOAD: true
run: |
npm ci
Expand Down
Loading