Skip to content

fix(auth): honor APIFY_TOKEN env var over stored login token #7755

fix(auth): honor APIFY_TOKEN env var over stored login token

fix(auth): honor APIFY_TOKEN env var over stored login token #7755

Workflow file for this run

# This workflow runs for every pull request to lint and test the proposed changes.
name: Check
on:
push:
branches: [master, renovate/**]
pull_request:
branches: [master]
env:
LATEST_NODE_VERSION: 24
APIFY_CLI_DISABLE_TELEMETRY: 1
concurrency:
cancel-in-progress: false
group: checks-${{ github.ref }}
jobs:
build:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[docs build]') }}
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Use Node.js ${{ env.LATEST_NODE_VERSION }}
uses: actions/setup-node@v7
with:
node-version: ${{ env.LATEST_NODE_VERSION }}
- name: Install pnpm and dependencies
uses: apify/actions/pnpm-install@v1.3.1
- name: Run TSC
run: pnpm run build
- name: Ensure the reference documentation builds
run: pnpm run update-docs
lint:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[docs build]') }}
name: Lint & Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Use Node.js ${{ env.LATEST_NODE_VERSION }}
uses: actions/setup-node@v7
with:
node-version: ${{ env.LATEST_NODE_VERSION }}
- name: Install pnpm and dependencies
uses: apify/actions/pnpm-install@v1.3.1
- name: Run lint checks
run: pnpm run lint
- name: Run format checks
run: pnpm run format
test_local:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[docs build]') }}
name: Local Tests
needs: [build]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-2025]
node-version: [20, 22, 24]
runs-on: ${{ matrix.os }}
steps:
- name: Mask secrets
run: |
echo "::add-mask::${{ secrets.APIFY_TEST_USER_API_TOKEN }}"
- uses: actions/checkout@v7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
- name: Install pnpm and dependencies
uses: apify/actions/pnpm-install@v1.3.1
- name: Set up Python (Windows)
if: ${{ matrix.os == 'windows-2025' }}
uses: actions/setup-python@v6
with:
python-version: 3.14
- name: Run local tests
run: pnpm run test:local
test_api:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[docs build]') }}
name: API Tests
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Mask secrets
run: |
echo "::add-mask::${{ secrets.APIFY_TEST_USER_API_TOKEN }}"
- uses: actions/checkout@v7
- name: Use Node.js ${{ env.LATEST_NODE_VERSION }}
uses: actions/setup-node@v7
with:
node-version: ${{ env.LATEST_NODE_VERSION }}
- name: Install pnpm and dependencies
uses: apify/actions/pnpm-install@v1.3.1
- name: Run API tests
env:
TEST_USER_TOKEN: ${{ secrets.APIFY_TEST_USER_API_TOKEN }}
run: pnpm run test:api
test_python_support:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[docs build]') }}
name: Python Support
needs: [build]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-2025]
python-version: ["3.11", "3.12", "3.13", "3.14"]
runs-on: ${{ matrix.os }}
steps:
- name: Mask secrets
run: |
echo "::add-mask::${{ secrets.APIFY_TEST_USER_API_TOKEN }}"
- uses: actions/checkout@v7
- name: Use Node.js ${{ env.LATEST_NODE_VERSION }}
uses: actions/setup-node@v7
with:
node-version: ${{ env.LATEST_NODE_VERSION }}
- name: Install pnpm and dependencies
uses: apify/actions/pnpm-install@v1.3.1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Run Python tests
env:
TEST_USER_TOKEN: ${{ secrets.APIFY_TEST_USER_API_TOKEN }}
run: pnpm run test:python
# Aggregate gate for the whole Python Support matrix. Branch protection requires only this single
# check, so the matrix versions can change without having to update the required checks in lockstep.
test_python_support_result:
if: ${{ always() && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[docs build]') }}
name: Python Support Result
needs: [test_python_support]
runs-on: ubuntu-latest
steps:
- name: Verify the Python Support matrix succeeded
run: |
result="${{ needs.test_python_support.result }}"
echo "Python Support matrix result: ${result}"
if [ "${result}" != "success" ]; then
exit 1
fi
docs:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[docs build]') }}
name: Docs build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Use Node.js ${{ env.LATEST_NODE_VERSION }}
uses: actions/setup-node@v7
with:
node-version: ${{ env.LATEST_NODE_VERSION }}
- name: Install pnpm and dependencies
uses: apify/actions/pnpm-install@v1.3.1
- name: Build & deploy docs
run: pnpm --filter apify-cli-website run build
build_bundles:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[docs build]') }}
name: Bundles (${{ matrix.label }})
needs: [build]
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
label: unix
- os: windows-latest
label: windows-x64
- os: windows-11-arm
label: windows-arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- name: Use Node.js ${{ env.LATEST_NODE_VERSION }}
uses: actions/setup-node@v7
with:
node-version: ${{ env.LATEST_NODE_VERSION }}
- name: Install pnpm and dependencies
uses: apify/actions/pnpm-install@v1.3.1
- name: Install bun
uses: oven-sh/setup-bun@v2
if: ${{ matrix.os != 'windows-11-arm' }}
with:
bun-version-file: .bun-version
no-cache: true
- name: Install bun (Windows ARM)
if: ${{ matrix.os == 'windows-11-arm' }}
run: |
$bunVersion = (Get-Content .bun-version).Trim()
irm bun.sh/install.ps1 -OutFile install.ps1
# Bun doesn't have Windows ARM64 builds, so the setup-bun action fails. The install script however,
# does "support" it.
.\install.ps1 -Version $bunVersion
Join-Path (Resolve-Path ~).Path ".bun\bin" >> $env:GITHUB_PATH
# https://github.com/oven-sh/bun/issues/11198
- name: Fix cross-platform building on Actions
if: ${{ matrix.os != 'ubuntu-latest' }}
run: |
mkdir C:\test
cd C:\test
bun init -y
bun build --compile --target=bun-windows-x64 --outfile test index.ts
bun build --compile --target=bun-windows-x64-baseline --outfile test index.ts
- name: Build Bundles
run: pnpm run insert-cli-metadata && pnpm run build-bundles
- name: Upload Bundles
uses: actions/upload-artifact@v7
with:
name: apify-cli-bundles-${{ matrix.label }}
path: bundles/**