Skip to content

Commit f577aa6

Browse files
André DietrichAndré Dietrich
authored andcommitted
fix pat to fine token
1 parent 4fe3cbf commit f577aa6

4 files changed

Lines changed: 34 additions & 2 deletions

File tree

src/components/GitHub/PatHelp.vue

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export default defineComponent({
1414
reason: { type: String, default: "auth" },
1515
// whether write access (Contents: read & write) is required (push)
1616
needWrite: { type: Boolean, default: false },
17+
// whether the operation creates a new repository. Fine-grained tokens can
18+
// only target existing repos, so creating one requires a *classic* token
19+
// with the "repo" scope — we point the user to a different page in that case.
20+
needCreate: { type: Boolean, default: false },
1721
},
1822
1923
emits: ["saved"],
@@ -49,7 +53,25 @@ export default defineComponent({
4953
{{ $t("github.pat.howtoToggle") }}
5054
</button>
5155

52-
<ol v-if="expanded" class="small">
56+
<ol v-if="expanded && needCreate" class="small">
57+
<li>
58+
<i18n-t keypath="github.pat.step1" tag="span">
59+
<template #link>
60+
<a
61+
href="https://github.com/settings/tokens/new?scopes=repo&description=LiaScript"
62+
target="_blank"
63+
>
64+
github.com/settings/tokens
65+
</a>
66+
</template>
67+
</i18n-t>
68+
</li>
69+
<li>{{ $t("github.pat.step2Classic") }}</li>
70+
<li>{{ $t("github.pat.step3Classic") }}</li>
71+
<li>{{ $t("github.pat.step4") }}</li>
72+
</ol>
73+
74+
<ol v-else-if="expanded" class="small">
5375
<li>
5476
<i18n-t keypath="github.pat.step1" tag="span">
5577
<template #link>

src/i18n/de.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@
278278
"step2": "Wähle einen Namen und eine Gültigkeitsdauer und wähle die zu verwendenden Repositories aus.",
279279
"step3Read": "Setze unter „Repository permissions\" die Berechtigung „Contents\" auf „Read-only\".",
280280
"step3Write": "Setze unter „Repository permissions\" die Berechtigung „Contents\" auf „Read and write\".",
281+
"step2Classic": "Stelle sicher, dass der „repo\"-Scope ausgewählt ist (zum Anlegen eines Repositories wird ein klassischer Token benötigt – fine-grained Tokens können das nicht).",
282+
"step3Classic": "Wähle einen Namen und eine Gültigkeitsdauer.",
281283
"step4": "Erzeuge den Token, kopiere ihn und füge ihn unten ein.",
282284
"placeholder": "github_pat_…",
283285
"save": "Speichern"

src/i18n/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@
278278
"step2": "Choose a name and an expiration, then select the repositories you want to use.",
279279
"step3Read": "Under \"Repository permissions\" set \"Contents\" to \"Read-only\".",
280280
"step3Write": "Under \"Repository permissions\" set \"Contents\" to \"Read and write\".",
281+
"step2Classic": "Make sure the \"repo\" scope is checked (creating a repository needs a classic token — fine-grained tokens cannot do this).",
282+
"step3Classic": "Choose a name and an expiration.",
281283
"step4": "Generate the token, copy it and paste it below.",
282284
"placeholder": "github_pat_…",
283285
"save": "Save"

src/views/GitHub/PublishModal.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,13 @@ export default defineComponent({
241241
</div>
242242
</template>
243243

244-
<PatHelp v-if="patReason" :reason="patReason" :need-write="true" @saved="onPatSaved" />
244+
<PatHelp
245+
v-if="patReason"
246+
:reason="patReason"
247+
:need-write="true"
248+
:need-create="true"
249+
@saved="onPatSaved"
250+
/>
245251
<div v-if="errorMessage" class="alert alert-danger mt-2 mb-0">{{ errorMessage }}</div>
246252

247253
<template #footer>

0 commit comments

Comments
 (0)