Skip to content

Commit fd72eb1

Browse files
Merge branch 'main' into dashboard
2 parents 6613eb4 + 7d542d6 commit fd72eb1

File tree

4 files changed

+30
-15
lines changed

4 files changed

+30
-15
lines changed

.github/workflows/npm-publish.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
description: 'Version accepted by `npm version *`'
1616
required: true
1717

18+
permissions:
19+
contents: write
20+
id-token: write
21+
1822
jobs:
1923
NPM:
2024
runs-on: ubuntu-latest
@@ -23,17 +27,14 @@ jobs:
2327
- uses: actions/setup-node@v6
2428
with:
2529
node-version-file: package.json
26-
registry-url: https://registry.npmjs.org
2730
- run: npm ci || npm install
2831
- uses: fregante/setup-git-user@v2
2932
- name: Create version
3033
# Get the generated version, this enables support for keywords: `npm version patch`
3134
run: |
3235
VERSION="$(npm version "${{ github.event.inputs.Version }}")"
3336
echo "VERSION=$VERSION" >> $GITHUB_ENV
34-
- run: npm publish
35-
env:
36-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
37+
- run: npm publish --provenance --access public
3738
- run: git push --follow-tags
3839
- run: gh release create "$VERSION" --generate-notes
3940
env:

index.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,16 @@ TEST: addTests('isRepo', [
424424
export const hasRepoHeader = (url: URL | HTMLAnchorElement | Location = location): boolean => isRepo(url) && !isRepoSearch(url);
425425
TEST: addTests('hasRepoHeader', combinedTestOnly);
426426

427-
// On empty repos, there's only isRepoHome; this element is found in `<head>`
428-
export const isEmptyRepoRoot = (): boolean => isRepoHome() && !exists('link[rel="canonical"]');
427+
export const isEmptyRepoRoot = (): boolean => isRepoHome() && exists([
428+
// If you don't have write access
429+
'.blankslate-icon',
430+
// If you have write access
431+
'#empty-setup-clone-url',
432+
].join(','));
429433

434+
/**
435+
* @deprecated Doesn't work anymore. Use `isEmptyRepoRoot` or API instead.
436+
*/
430437
export const isEmptyRepo = (): boolean => exists('[aria-label="Cannot fork because repository is empty."]');
431438

432439
export const isPublicRepo = (): boolean => exists('meta[name="octolytics-dimension-repository_public"][content="true"]');
@@ -885,7 +892,14 @@ TEST: addTests('isRepositoryActions', [
885892

886893
export const isUserTheOrganizationOwner = (): boolean => isOrganizationProfile() && exists('[aria-label="Organization"] [data-tab-item="org-header-settings-tab"]');
887894

888-
export const canUserAdminRepo = (): boolean => isRepo() && exists('.reponav-item[href$="/settings"], [data-tab-item$="settings-tab"]');
895+
export const canUserAdminRepo = (): boolean => {
896+
const repo = getRepo();
897+
return Boolean(repo && exists(`:is(${[
898+
'.GlobalNav',
899+
// Remove after June 2026
900+
'.js-repo-nav',
901+
].join(',')}) a[href="/${repo.nameWithOwner}/settings"]`));
902+
};
889903

890904
export const isNewRepo = (url: URL | HTMLAnchorElement | Location = location): boolean => !isGist(url) && (url.pathname === '/new' || /^organizations\/[^/]+\/repositories\/new$/.test(getCleanPathname(url)));
891905
TEST: addTests('isNewRepo', [

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "github-url-detection",
3-
"version": "11.1.2",
3+
"version": "11.1.3",
44
"description": "Which GitHub page are you on? Is it an issue? Is it a list? Perfect for your WebExtension or userscript.",
55
"keywords": [
66
"github",
@@ -42,7 +42,7 @@
4242
"xo": "xo"
4343
},
4444
"dependencies": {
45-
"github-reserved-names": "^2.1.2"
45+
"github-reserved-names": "^2.1.3"
4646
},
4747
"devDependencies": {
4848
"@sindresorhus/tsconfig": "^8.1.0",

0 commit comments

Comments
 (0)