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_TOKEN authentication on workflows #464

Merged
merged 2 commits into from
Jan 9, 2025
Merged

Use GITHUB_TOKEN authentication on workflows #464

merged 2 commits into from
Jan 9, 2025

Conversation

Sherlouk
Copy link
Collaborator

@Sherlouk Sherlouk commented Jan 7, 2025

Pull Request

Related issue

CI is current very intermittent with predominantly rate limiting errors being thrown.

What does this PR do?

  • When GitHub creates a new workflow, it defines a new GITHUB_TOKEN secret which is unique to that individual run. This is managed entirely by GitHub and requires no additional setup by us.
  • This GitHub managed token therefore will have fresh rate limits and thus cannot be impacted by other users of the PATs we use right now.
  • Ultimately this should lead to a much more reliable test setup where it should never fail to authenticate.

⚠️ This currently uses a local copy of the install script. A subsequent PR has been raised to update the shared script (meilisearch/meilisearch#5216) which will then be used here.
ℹ️ Once the install script is updated, we should look to make this same change on all workflows across the Meilisearch estate, eliminating use of the PAT for testing.

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

@Sherlouk Sherlouk changed the title Explore using GITHUB_TOKEN Use GITHUB_TOKEN authentication on workflows Jan 8, 2025
meili-bors bot added a commit to meilisearch/meilisearch that referenced this pull request Jan 8, 2025
5216: Add support for GITHUB_TOKEN authentication in installation script r=curquiza a=Sherlouk

# Pull Request

## What does this PR do?
This tweaks the install script to support detection of a "GITHUB_TOKEN" variable. This is well documented [here](https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication) but is useful for GitHub Actions workflows, reducing the need for users to maintain a separate PAT token. This should be more reliable.

Note: these changes have been tested on the Swift project: meilisearch/meilisearch-swift#464.

## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!


Co-authored-by: James Sherlock <[email protected]>
meili-bors bot added a commit to meilisearch/meilisearch that referenced this pull request Jan 8, 2025
5216: Add support for GITHUB_TOKEN authentication in installation script r=curquiza a=Sherlouk

# Pull Request

## What does this PR do?
This tweaks the install script to support detection of a "GITHUB_TOKEN" variable. This is well documented [here](https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication) but is useful for GitHub Actions workflows, reducing the need for users to maintain a separate PAT token. This should be more reliable.

Note: these changes have been tested on the Swift project: meilisearch/meilisearch-swift#464.

## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!


Co-authored-by: James Sherlock <[email protected]>
@curquiza
Copy link
Member

curquiza commented Jan 8, 2025

@Sherlouk meilisearch/meilisearch#5216 has been merged, what can we do with this PR now?

@curquiza curquiza added the maintenance Anything related to maintenance (CI, tests, refactoring...) label Jan 8, 2025
@Sherlouk
Copy link
Collaborator Author

Sherlouk commented Jan 9, 2025

So https://install.meilisearch.com/ links to https://raw.githubusercontent.com/meilisearch/meilisearch/latest/download-latest.sh which I believe is driven by the latest tag on the repository. So until we re-tag the main repository, the install script won't be updated.

I could temporarily point to https://raw.githubusercontent.com/meilisearch/meilisearch/main/download-latest.sh (notice main vs latest in the URL), but yeah need to wait for a tag.

@Sherlouk
Copy link
Collaborator Author

Sherlouk commented Jan 9, 2025

Pushed with the updated script (https://raw.githubusercontent.com/meilisearch/meilisearch/main/download-latest.sh) just to demonstrate. Obviously once we re-tag we can revert the curl line back to curl -L https://install.meilisearch.com | sh.

The only necessary change (once tagged), and what will want to be reproduced on every repository (well those which don't use Docker), is:

-      GITHUB_PAT: ${{ secrets.MEILI_BOT_GH_PAT }}
+      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

edit:// looks like a tag was published a few hours ago, but didn't include these changes (see here). Need the updated script to be tagged.

Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

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

bors merge

Copy link
Contributor

meili-bors bot commented Jan 9, 2025

@meili-bors meili-bors bot merged commit 1e82898 into main Jan 9, 2025
6 checks passed
@meili-bors meili-bors bot deleted the ci-tweaks branch January 9, 2025 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Anything related to maintenance (CI, tests, refactoring...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants