forked from cline/cline
-
Couldn't load subscription status.
- Fork 2.3k
ci: refresh contrib.rocks cache workflow #8083
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
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,46 +1,67 @@ | ||||||||
| name: Update Contributors | ||||||||
| name: Update Contributors # Refresh contrib.rocks image cache | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor style suggestion: The inline comment after the workflow name is unconventional. Consider either removing it or moving it to a separate comment line:
Suggested change
|
||||||||
|
|
||||||||
| on: | ||||||||
| push: | ||||||||
| branches: | ||||||||
| - main | ||||||||
| workflow_dispatch: | ||||||||
|
|
||||||||
| permissions: | ||||||||
| contents: write | ||||||||
| pull-requests: write | ||||||||
|
|
||||||||
| jobs: | ||||||||
| update-contributors: | ||||||||
| refresh-contrib-cache: | ||||||||
| runs-on: ubuntu-latest | ||||||||
| permissions: | ||||||||
| contents: write # Needed for pushing changes. | ||||||||
| pull-requests: write # Needed for creating PRs. | ||||||||
| steps: | ||||||||
| - name: Checkout code | ||||||||
| - name: Checkout | ||||||||
| uses: actions/checkout@v4 | ||||||||
| - name: Setup Node.js and pnpm | ||||||||
| uses: ./.github/actions/setup-node-pnpm | ||||||||
| - name: Disable Husky | ||||||||
|
|
||||||||
| - name: Bump cacheBust in all README files | ||||||||
| run: | | ||||||||
| echo "HUSKY=0" >> $GITHUB_ENV | ||||||||
| git config --global core.hooksPath /dev/null | ||||||||
| - name: Update contributors and format | ||||||||
| set -euo pipefail | ||||||||
| TS="$(date +%s)" | ||||||||
| # Target only the root README.md and localized READMEs under locales/*/README.md | ||||||||
| mapfile -t FILES < <(git ls-files README.md 'locales/*/README.md' || true) | ||||||||
|
|
||||||||
| if [ "${#FILES[@]}" -eq 0 ]; then | ||||||||
| echo "No target README files found." >&2 | ||||||||
| exit 1 | ||||||||
| fi | ||||||||
|
|
||||||||
| UPDATED=0 | ||||||||
| for f in "${FILES[@]}"; do | ||||||||
| if grep -q 'cacheBust=' "$f"; then | ||||||||
| # Use portable sed in GNU environment of ubuntu-latest | ||||||||
| sed -i -E "s/cacheBust=[0-9]+/cacheBust=${TS}/g" "$f" | ||||||||
| echo "Updated cacheBust in $f" | ||||||||
| UPDATED=1 | ||||||||
| else | ||||||||
| echo "Warning: cacheBust parameter not found in $f" >&2 | ||||||||
| fi | ||||||||
| done | ||||||||
|
|
||||||||
| if [ "$UPDATED" -eq 0 ]; then | ||||||||
| echo "No files were updated. Ensure READMEs embed contrib.rocks with cacheBust param." >&2 | ||||||||
| exit 1 | ||||||||
| fi | ||||||||
|
|
||||||||
| - name: Detect changes | ||||||||
| id: changes | ||||||||
| run: | | ||||||||
| pnpm update-contributors | ||||||||
| npx prettier --write README.md locales/*/README.md | ||||||||
| if git diff --quiet; then echo "changes=false" >> $GITHUB_OUTPUT; else echo "changes=true" >> $GITHUB_OUTPUT; fi | ||||||||
| id: check-changes | ||||||||
| env: | ||||||||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||
| if git diff --quiet; then | ||||||||
| echo "changed=false" >> $GITHUB_OUTPUT | ||||||||
| else | ||||||||
| echo "changed=true" >> $GITHUB_OUTPUT | ||||||||
| fi | ||||||||
|
|
||||||||
| - name: Create Pull Request | ||||||||
| if: steps.check-changes.outputs.changes == 'true' | ||||||||
| if: steps.changes.outputs.changed == 'true' | ||||||||
| uses: peter-evans/create-pull-request@v7 | ||||||||
| with: | ||||||||
| token: ${{ secrets.GITHUB_TOKEN }} | ||||||||
| commit-message: "docs: update contributors list [skip ci]" | ||||||||
| commit-message: "chore: refresh contrib.rocks image cache across all READMEs [skip ci]" | ||||||||
| committer: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" | ||||||||
| branch: update-contributors | ||||||||
| branch: refresh-contrib-cache | ||||||||
| delete-branch: true | ||||||||
| title: "Update contributors list" | ||||||||
| title: "Refresh contrib.rocks image cache (all READMEs)" | ||||||||
| body: | | ||||||||
| Automated update of contributors list and related files | ||||||||
|
|
||||||||
| This PR was created automatically by a GitHub Action workflow and includes all changed files. | ||||||||
| Automated refresh of the contrib.rocks image cache by bumping the cacheBust parameter in README.md and locales/*/README.md. | ||||||||
| base: main | ||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional? The workflow filename is still
update-contributors.ymlbut its purpose has completely changed to refreshing contrib.rocks cache. Should we rename this file to something likerefresh-contrib-cache.ymlto better reflect its new purpose?