Skip to content

Modify deploy.js to accept site and accessToken variables from credentials file#128

Open
bunnypranav wants to merge 1 commit into
wikimedia-gadgets:masterfrom
bunnypranav:deploy-script
Open

Modify deploy.js to accept site and accessToken variables from credentials file#128
bunnypranav wants to merge 1 commit into
wikimedia-gadgets:masterfrom
bunnypranav:deploy-script

Conversation

@bunnypranav

Copy link
Copy Markdown
Contributor
  • This allows the script to work with https://gadget-deploy.toolforge.org/, a three-click gadget GitHub-to-wiki deploy tool for interface administrators.
  • Takes in the site value as apiUrl for the --quick mode, if it exists
  • Update loading of credentials.json to a dictionary for better flexibility

Partially resolves #101
Related PR in gadget-deploy repo wikimedia-gadgets/gadget-deploy#4

@bunnypranav

Copy link
Copy Markdown
Contributor Author

Hi @NovemLinguae, any update on this? Thanks :)

@bunnypranav

Copy link
Copy Markdown
Contributor Author

Hi @siddharthvp, Novem asked me to request a review from you, as they are on a break for a couple months. Thanks! :)

@siddharthvp siddharthvp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are syntax errors in this file.

@bunnypranav

Copy link
Copy Markdown
Contributor Author

Should have caught that earlier, fixed.

Comment thread bin/deploy.js Outdated
Comment thread bin/deploy.js
Comment thread bin/deploy.js Outdated
Comment thread bin/deploy.js Outdated
…tials file

* This allows the script to work with https://gadget-deploy.toolforge.org/, a three-click gadget GitHub-to-wiki deploy tool for interface administrators.
* Takes in the site value as apiUrl for the --quick mode, if it exists
* Update loading of credentials.json to a dictionary for better flexibility
@bunnypranav

Copy link
Copy Markdown
Contributor Author

Hope my changes work!

@siddharthvp

Copy link
Copy Markdown
Member

Suggest testing instead of just hoping that it'd work.

@bunnypranav

Copy link
Copy Markdown
Contributor Author

I thought about that, but I was wondering how can I test since I am not a interface admin. Could you help me with this?

@siddharthvp

Copy link
Copy Markdown
Member

You can temporarily change the page names to point to your userspace.

@NovemLinguae

Copy link
Copy Markdown
Member

If someone wants to reply with a "steps to test", would be happy to test it and report back.

@siddharthvp

Copy link
Copy Markdown
Member
  1. Temporarily modify the deploy script to deploy to pages your account can access.
  2. Generate an owner-only OAuth consumer from Special:OAuthConsumerRegistration on metawiki. Make sure the grants to edit sensitive pages are checked.
  3. Create the credentials.json file with { "site": "https://test.wikipedia.org/w/api.php", "accessToken": "...." }.
  4. Run node scripts/deploy.js --quick.

Comment thread bin/deploy.js
apiUrl: `https://${wiki}.wikipedia.org/w/api.php`,
username: username,
password: password
const api = await Mwn.init({

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS D:\other-peoples-githubs\xfdcloser> node bin/deploy.js --quick
QUICK MODE: Using defaults (site from credentials.json, beta, blank edit summary, auto-continue)
Edit summary is: "v4.0.16 at 8f4d745: Updated from repository"
D:\other-peoples-githubs\xfdcloser\bin\deploy.js:135
                const api = await Mwn.init({
                                      ^

TypeError: Cannot read properties of undefined (reading 'init')
    at deploy (D:\other-peoples-githubs\xfdcloser\bin\deploy.js:135:25)
    at Object.<anonymous> (D:\other-peoples-githubs\xfdcloser\bin\deploy.js:171:1)
    at Module._compile (node:internal/modules/cjs/loader:1692:14)
    at Object..js (node:internal/modules/cjs/loader:1824:10)
    at Module.load (node:internal/modules/cjs/loader:1427:32)
    at Module._load (node:internal/modules/cjs/loader:1250:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:152:5)
    at node:internal/main/run_main_module:33:47

Node.js v24.4.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add this tool to https://gadget-deploy.toolforge.org/ (requires some deploy script changes)

3 participants