💻 development⁂
this project uses node.js and the twitter api v2 client.
prerequisites⁂
before you begin, ensure you have:
- node.js (v20 recommended)
- npm
- git
- x developer account and api credentials
setting up local development⁂
-
clone the repository:
bash git clone https://github.com/captradeoff/x-post-action.git cd x-post-action
-
install dependencies:
bash npm install
-
for testing with actual api calls, create a
.env
file:bash cp .env.sample .env
-
edit the
.env
file to add your x api credentials
project structure⁂
index.js
: main entry pointaction.yaml
: github action definitionindex.test.js
: unit testsintegration.test.js
: api integration testsintegration-action.test.js
: action function testsdist/
: compiled action code
building the action⁂
the action uses @vercel/ncc to compile the node.js code and dependencies into a single file:
npm run build
this will create a dist/index.js
file that is referenced in action.yaml
.
development workflow⁂
- make changes to the code
- update or add tests to cover your changes
- run tests to ensure everything works:
bash npm test
- build the action:
bash npm run build
- commit and push your changes
- create a pull request