-
Notifications
You must be signed in to change notification settings - Fork 58.3k
55 lines (52 loc) · 2.08 KB
/
remove-unused-assets.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Remove unused assets
env:
FREEZE: ${{ secrets.FREEZE }}
on:
schedule:
# - cron: "20 15 * * 0" # run every Sunday at 20:15 UTC / 12:15 PST
- cron: 0 0 1 1 * # run next January 1st, aka temporarily disabled
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@a81bbbf8298c0fa03ea29cdc473d45769f953675
- 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@938e6aea6f8dbdaced2064e948cb806c77fe87b8
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