Skip to content

Commit a0caf48

Browse files
author
Greg Bowler
authored
Merge pull request #91 from execut/master
More simple instructions for PAT usage
2 parents cd191d0 + df89a2d commit a0caf48

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

README.md

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -197,38 +197,23 @@ It's recommended to use SSH keys for authentication, but sometimes HTTP basic au
197197

198198
1) Create a [personal access token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) for the Github account you wish to authenticate with.
199199

200-
2) Add the following JSON to a new Github Secret called `COMPOSER_AUTH_JSON`:
201-
202-
```json
203-
{
204-
"http-basic": {
205-
"github.com": {
206-
"username": "<YOUR_GITHUB_USERNAME>",
207-
"password": "<YOUR_PERSONAL_ACCESS_TOKEN>"
208-
}
209-
}
210-
}
211-
```
200+
2) Create a new GitHub Secret called `PAT` with a value of personal access token.
212201

213-
3) Pass this secret to auth.json as a separate action step within your Yaml config, and remove auth.json to prevent deploying it:
202+
3) Pass this secret to COMPOSER_AUTH variable:
214203

215204
```yaml
216205
jobs:
217206
build:
218207
219208
...
220-
221-
- name: Add HTTP basic auth credentials
222-
run: echo '${{ secrets.COMPOSER_AUTH_JSON }}' > $GITHUB_WORKSPACE/auth.json
223209
224210
- name: Install dependencies
225211
uses: php-actions/composer@v6
226-
227-
- name: Remove auth.json file
228-
run: rm -f $GITHUB_WORKSPACE/auth.json
212+
env:
213+
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.PAT }}"} }'
229214
```
230215

231-
4) Now, any connections Composer makes to Github.com will use your HTTP basic auth credentials, which is essentially the same as being logged in as you, so your private repositories will now be available to Composer.
216+
4) Now, any connections Composer makes to GitHub.com will use your HTTP basic auth credentials, which is essentially the same as being logged in as you, so your private repositories will now be available to Composer.
232217

233218
***
234219

0 commit comments

Comments
 (0)