* re-enable graphql updater workflow * remove scheduled run temporarily * lint yaml * re-enable graphql updater workflow * add my pat for test * use my pat for create pr * update peter-evans action * Action ran graphql script"update-files" * use github-token * revert * Action ran graphql script"update-files" (#17000) * update another workflow * add schedule run back Co-authored-by: rachmari <rachmari@users.noreply.github.com> Co-authored-by: Octomerger Bot <63058869+Octomerger@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
56 lines
2.1 KiB
YAML
56 lines
2.1 KiB
YAML
name: Remove unused assets
|
|
|
|
env:
|
|
FREEZE: ${{ secrets.FREEZE }}
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '20 15 * * 0' # run every Sunday at 20:15 UTC / 12:15 PST
|
|
|
|
jobs:
|
|
remove_unused_assets:
|
|
name: Remove unused assets
|
|
if: github.repository == 'github/docs-internal'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- if: ${{ env.FREEZE == 'true' }}
|
|
run: |
|
|
echo 'The repo is currently frozen! Exiting this workflow.'
|
|
exit 1 # prevents further steps from running
|
|
- name: Checkout
|
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
|
|
- name: npm ci
|
|
run: npm ci
|
|
- name: Run scripts
|
|
run: |
|
|
script/remove-unused-assets.js > results.md
|
|
script/remove-extraneous-translation-files.js
|
|
- name: Get script results to use in PR body
|
|
id: results
|
|
uses: juliangruber/read-file-action@e0a316da496006ffd19142f0fd594a1783f3b512
|
|
with:
|
|
path: ./results.md
|
|
- name: Remove script results file
|
|
run: rm -rf ./results.md
|
|
- name: Create pull request
|
|
uses: peter-evans/create-pull-request@8c603dbb04b917a9fc2dd991dc54fef54b640b43
|
|
with:
|
|
# need to use a token with repo and workflow scopes for this step
|
|
token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
|
|
commit-message: Action ran script/remove-unused-assets.js
|
|
title: Remove unused assets
|
|
body:
|
|
"Hello! This PR removes some files that exist in the repo but are not used in content or data files:\n\n
|
|
${{ steps.results.outputs.content }}
|
|
\n\nIf you have any questions, please contact @github/docs-engineering."
|
|
labels: unused assets
|
|
project: Core docs work for the current week
|
|
project-column: Should do
|
|
branch: remove-unused-assets
|
|
- if: ${{ failure() }}
|
|
name: Delete remote branch (if previous steps failed)
|
|
uses: dawidd6/action-delete-branch@47743101a121ad657031e6704086271ca81b1911
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
branches: remove-unused-assets
|