Skip to content

Commit

Permalink
ci: use authenticated git url for pushing updated changelog entries
Browse files Browse the repository at this point in the history
Use the authenticated git url for pushing updated changelog entries, also sets persist_credentials
to false for the action/checkout@2 usage in the workflow.

Additionally, because the authentication is being provided via the git url [email protected]
can be used as the email once again.
  • Loading branch information
josephperrott committed Sep 2, 2021
1 parent 17ef5ad commit da43b2e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# Setting `persist-credentials: false` prevents the github-action account from being the
# account that is attempted to be used for authentication, instead the remote is set to
# an authenticated URL.
persist-credentials: false
- uses: ./tools/local-actions/changelog
with:
angular-robot-key: ${{ secrets.ANGULAR_ROBOT_PRIVATE_KEY }}
3 changes: 2 additions & 1 deletion tools/local-actions/changelog/lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {AuthenticatedGitClient} from '../../../../ng-dev/utils/git/authenticated
import {ANGULAR_ROBOT, getAuthTokenFor} from '../../../../github-actions/utils';
import {GithubConfig, setConfig} from '../../../../ng-dev/utils/config';
import {ReleaseConfig} from '../../../../ng-dev/release/config/index';
import {addTokenToGitHttpsUrl} from '../../../../ng-dev/utils/git/github-urls';

/** The tag used for tracking the last time the changlog was generated. */
const lastChangelogTag = 'most-recent-changelog-generation';
Expand Down Expand Up @@ -46,7 +47,7 @@ async function run(): Promise<void> {
AuthenticatedGitClient.configure(await getAuthTokenFor(ANGULAR_ROBOT));
/** The authenticed GitClient. */
const git = AuthenticatedGitClient.get();
git.run(['config', 'user.email', '56403804+angular-robot[bot]@users.noreply.github.com']);
git.run(['config', 'user.email', 'angular-robot@google.com']);
git.run(['config', 'user.name', 'Angular Robot']);

/** The full path to the changelog file. */
Expand Down
7 changes: 4 additions & 3 deletions tools/local-actions/changelog/main.js

Large diffs are not rendered by default.

0 comments on commit da43b2e

Please sign in to comment.