Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: always use service user for git ops #24546

Merged
merged 1 commit into from
Dec 2, 2024
Merged

Conversation

gulducat
Copy link
Member

@gulducat gulducat commented Nov 22, 2024

We are shoring up our user and bot accesses, and this seems to be our only usage of the github-actions bot.

These were the commits that have been flagged as needing adjustment:

workflows/release.yml
145:            git commit --message "Generate files for ${{ github.event.inputs.version }} release"
212:            git commit --message 'Prepare for next release'

We may later discover other of our repos that need a similar treatment, if they've just not been run during this information-gathering time, but at present this is the only known case. Our CE->ENT merge workflow in the ENT repo is already set up properly.

@gulducat gulducat added theme/ci backport/ent/1.7.x+ent Changes are backported to 1.7.x+ent backport/ent/1.8.x+ent Changes are backported to 1.8.x+ent backport/1.9.x backport to 1.9.x release line labels Nov 22, 2024
@gulducat gulducat requested review from a team as code owners November 22, 2024 21:29
Comment on lines -218 to +219
contents: write
contents: read
Copy link
Member

Choose a reason for hiding this comment

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

This wasn't mentioned in the PR description. I know we've had to set this field to write in our workflows explicitly previously but that it was unexpected. Why is it safe to change it back now?

Copy link
Member Author

Choose a reason for hiding this comment

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

this permissions section specifies what the actions-dispensed GITHUB_TOKEN is capable of doing, and we only want it to pull the repo (actions/checkout). for pushes we instead want to use the ELEVATED_GITHUB_TOKEN attached to our bot user.

based on the commit that set this (b23fe72), I suspect we thought it needed to be write because actions/checkout sets github-actions bot token in local git config, which then takes precedence over the global git config that we set using the elevated token.

so to counteract all that, we both set this to read and actions/checkout to persist-credentials: false, so that git config --global takes effect.

Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@gulducat gulducat merged commit e963d55 into main Dec 2, 2024
27 checks passed
@gulducat gulducat deleted the un-gh-actions-user branch December 2, 2024 16:58
@gulducat gulducat added backport/ent/1.7.x+ent Changes are backported to 1.7.x+ent backport/ent/1.8.x+ent Changes are backported to 1.8.x+ent and removed backport/ent/1.7.x+ent Changes are backported to 1.7.x+ent backport/ent/1.8.x+ent Changes are backported to 1.8.x+ent labels Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/ent/1.7.x+ent Changes are backported to 1.7.x+ent backport/ent/1.8.x+ent Changes are backported to 1.8.x+ent backport/1.9.x backport to 1.9.x release line theme/ci
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants