Skip to content

Commit

Permalink
Merge pull request github#34723 from github/repo-sync
Browse files Browse the repository at this point in the history
Repo sync
  • Loading branch information
docs-bot committed Sep 24, 2024
2 parents 42a566c + a93acf6 commit e3d1d10
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 80 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'Orphaned assets check'
name: 'Orphaned files check'

# **What it does**: Checks that there are no files in ./assets/ that aren't mentioned in any source file.
# **What it does**: Checks that there are no files in ./assets/ and ./data/reusables that aren't mentioned in any source file.
# **Why we have it**: To avoid orphans into the repo.
# **Who does it impact**: Docs content.

Expand All @@ -14,6 +14,7 @@ on:
# In case any of the dependencies affect the script
- 'package*.json'
- src/assets/scripts/find-orphaned-assets.js
- src/content-render/scripts/reusables-cli/find/unused.ts
- src/workflows/walk-files.js
- src/languages/lib/languages.js
- .github/actions/clone-translations/action.yml
Expand Down Expand Up @@ -44,7 +45,7 @@ jobs:

- uses: ./.github/actions/node-npm-setup

- name: Check for orphaned assets
- name: Check for orphaned assets and reusables
env:
# Needed for gh
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_READPUBLICKEY }}
Expand All @@ -54,10 +55,16 @@ jobs:
# The `-s` is to make npm run silent and not print verbose
# information about the npm script alias.
filesToRemove=`npm run -s find-orphaned-assets`
[ -z "$filesToRemove" ] && exit 0
assetFilesToRemove=$(npm run -s find-orphaned-assets)
reusableFilesToRemove=$(npm run -s reusables -- find unused | grep '^data/reusables')
[ -z "$assetFilesToRemove" ] && [ -z "$reusableFilesToRemove" ] && exit 0
echo $filesToRemove | xargs git rm
if [ -n "$assetFilesToRemove" ]; then
echo $assetFilesToRemove | xargs git rm
fi
if [ -n "$reusableFilesToRemove" ]; then
echo $reusableFilesToRemove | xargs git rm
fi
git status
Expand All @@ -76,25 +83,26 @@ jobs:
git config --global user.email "77750099+docs-bot@users.noreply.github.com"
date=$(date '+%Y-%m-%d-%H-%M')
branchname=orphaned-assets-$date-$GITHUB_RUN_ID
branchname=orphaned-files-$date-$GITHUB_RUN_ID
git checkout -b $branchname
git commit -m "Delete orphaned assets $date"
git commit -m "Delete orphaned files $date"
git push origin $branchname
body=$(cat <<-EOM
Found with the npm run find-orphaned-assets script.
The orphaned assets workflow file .github/workflows/orphaned-assets-check.yml
The orphaned files workflow file .github/workflows/orphaned-files-check.yml
runs every Monday at 16:20 UTC / 8:20 PST.
The first responder should just spot-check some of the unused assets
to make sure they aren't referenced anywhere
and then approve and merge the pull request.
For more information, see [Doc: Orphaned Assets](https://github.com/github/docs-engineering/blob/main/docs/orphaned-assets.md).
For more information, see [Doc: Orphaned Assets](https://github.com/github/docs-engineering/blob/main/docs/orphaned-assets.md)
and [Doc: Reusables CLI](https://github.com/github/docs-internal/tree/main/src/content-render/scripts/reusables-cli).
EOM
)
gh pr create \
--title "Delete orphaned assets ($date)" \
--title "Delete orphaned files ($date)" \
--body "$body" \
--repo github/docs-internal \
--label docs-content-fr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ Your account is selected for mandatory 2FA if you have taken some action on {% d
* Publishing an app or action for others
* Creating a release for your repository
* Contributing to specific high-importance repositories, such as [the projects tracked by the Open Source Security Foundation](https://github.com/ossf/wg-securing-critical-projects#current-work)
* Being an administrator of a high-importance repository
* Being an administrator or a contributor of a high-importance repository
* Being an organization owner for an organization containing repositories or other users
* Being an administrator or a contributor for repositories that published one or more packages
* Being an enterprise administrator

{% data variables.product.prodname_dotcom %} is continually assessing improvements to our account security features and 2FA requirements, so these criteria may change over time.
Expand Down
134 changes: 67 additions & 67 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/audit-logs/lib/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"apiOnlyEvents": "This event is not available in the web interface, only via the REST API, audit log streaming, or JSON/CSV exports.",
"apiRequestEvent": "This event is only available via audit log streaming."
},
"sha": "5fa07b3da273718e2dfc2571e560e0839801606d"
"sha": "f96836015a3f036f654b38521840a964a65c72df"
}

0 comments on commit e3d1d10

Please sign in to comment.