Skip to content

Sync fork with GitHub App token #8

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

Merged
merged 1 commit into from
Mar 9, 2025
Merged

Conversation

wata727
Copy link
Member

@wata727 wata727 commented Mar 9, 2025

See https://github.com/terraform-linters/magic-modules/actions/runs/13745172118/job/38439197950
See cli/cli#7574

The auto-sync introduced in #7 failed with the following error:

HTTP 404: Not Found (https://api.github.com/repos/GoogleCloudPlatform/magic-modules/git/refs/heads/tflint_provider)

The cause of this confusing error is that the GITHUB_TOKEN issued by GitHub Actions does not have the permissions to modify workflow files. See cli/cli#7574

This is a security feature, and to work around it you need to issue a temporary token using something like actions/create-github-app-token.

In this PR, we will use the tflint-automation app created in this organization to issue a token and use it for gh repo sync.

@wata727 wata727 merged commit 8f5a230 into tflint_provider Mar 9, 2025
4 of 10 checks passed
@wata727 wata727 deleted the use_app_token branch March 9, 2025 07:17
@wata727
Copy link
Member Author

wata727 commented Mar 9, 2025

@bendrucker To support this requirement, I created a GitHub App for our organization.
https://github.com/apps/tflint-automation

The APP_ID and APP_PRIVATE_KEY were created as organization variables and secrets and can be found here.
https://github.com/organizations/terraform-linters/settings/secrets/actions
As you can see, the scope of repositories that can use APP_PRIVATE_KEY is limited, so add more if necessary.

You can check the settings installed in the organization from the link below.
https://github.com/organizations/terraform-linters/settings/installations
The repositories that can be referenced by the app are similarly restricted, so please add them if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant