From afb5c31f915050574fd27c9be9002ce660bb1ead Mon Sep 17 00:00:00 2001 From: Kevin Heis Date: Mon, 10 Jun 2024 13:20:16 -0700 Subject: [PATCH] Remove optimize images workflow (#51093) --- .github/workflows/optimize-images.yml | 72 --------------------------- 1 file changed, 72 deletions(-) delete mode 100644 .github/workflows/optimize-images.yml diff --git a/.github/workflows/optimize-images.yml b/.github/workflows/optimize-images.yml deleted file mode 100644 index 595c9086d6..0000000000 --- a/.github/workflows/optimize-images.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Optimize images - -# **What it does**: Optimize images. -# **Why we have it**: Reduce bandwidth needs. -# **Who does it impact**: Docs engineering. - -on: - workflow_dispatch: - pull_request: - paths: - - '**/*.png' - -permissions: - contents: write - pull-requests: write - -jobs: - optimize-images-on-pr: - # We can't make commits on forks - if: github.repository == 'github/docs-internal' - runs-on: ubuntu-latest - steps: - - name: Check out repo on head ref - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ github.head_ref }} - # Need to specify a PAT here because otherwise GITHUB_TOKEN is used - # by default. Workflows won't trigger in that case because actions - # performed with GITHUB_TOKEN don't trigger other workflows. - token: ${{ secrets.DOCS_BOT_PAT_READPUBLICKEY }} - - - name: Check out base ref - run: git fetch --no-tags --depth=1 origin $GITHUB_BASE_REF - - - name: Install the Optipng package - run: sudo apt-get update && sudo apt-get -y install optipng - - - name: Run optipng on new or changed images - run: | - set -e # exit when any command fails - - echo "Ensure we can view $GITHUB_BASE_REF" - git checkout $GITHUB_BASE_REF - - echo "Ensure we can view $GITHUB_HEAD_REF" - git checkout $GITHUB_HEAD_REF - - echo "List the files that changed" - git diff --name-only --diff-filter=d $GITHUB_BASE_REF $GITHUB_HEAD_REF - - echo "Run optipng on pngs in from the diff" - git diff --name-only -z --diff-filter=d $GITHUB_BASE_REF $GITHUB_HEAD_REF -- '*.png' | xargs -0 optipng -nx - - - name: Make a commit and a push - run: | - echo "If there's no changes, exit" - if [[ ! `git status --porcelain` ]] - then - echo "No changes found" - exit 0 - fi - - echo "Make a commit" - git config user.name github-actions - git config user.email github-actions@github.com - git add "*.png" - git commit --message="Optimize images" - - echo "Push up changes" - git push - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}