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

use github app installation token for device repository cloning #422

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

rcooke-warwick
Copy link
Contributor

This is required for cloning private submodules - as the default behaviour means the token is scoped only to the repository the workflow is running on

Change-type: patch

- name: Create GitHub App installation token
uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
id: app-token
if: vars.FLOWZONE_APP_ID != ''
with:
app-id: ${{ vars.FLOWZONE_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the owner is the current org by default, does this actually change anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@klutchell if no owner arg is provided the docs say it defaults to repo only scope: https://github.com/actions/create-github-app-token/tree/5d869da34e18e7287c1daad50e0b8ea0f506ce69/?tab=readme-ov-file#create-a-token-for-the-current-repository

Logs on the step in action also show this:

"Run actions/create-github-app-token@5d869da
owner and repositories not set, creating token for the current repository ("balena-raspberrypi")"

Copy link
Contributor

Choose a reason for hiding this comment

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

TIL, LGTM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually wait, it looks like my owner arg is ignored in this PR run

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ignore me ^ I put it in the wrong place, (leviathan token) , fixing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok confirmed, now we get an org wide token

Run actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69
repositories not set, creating token for all repositories for given owner "balena-os"

Copy link
Contributor Author

@rcooke-warwick rcooke-warwick Oct 1, 2024

Choose a reason for hiding this comment

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

will test on a device repo. EDIT: works :)

Copy link
Member

@vipulgupta2048 vipulgupta2048 left a comment

Choose a reason for hiding this comment

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

NIT

.github/workflows/yocto-build-deploy.yml Outdated Show resolved Hide resolved
This is required for cloning private submodules - as the default behaviour means the token is scoped only to the repository the workflow is running on

Change-type: patch
Signed-off-by: Ryan Cooke <[email protected]>
@flowzone-app flowzone-app bot merged commit e09bdb6 into master Oct 2, 2024
58 checks passed
@flowzone-app flowzone-app bot deleted the ryan/app-token branch October 2, 2024 11:16
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.

3 participants