-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into FelixMcFelix-update-r…
…a-version
- Loading branch information
Showing
3 changed files
with
102 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
This file contains 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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Check update RA settings | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
pull-requests: write | ||
repository-projects: write | ||
|
||
jobs: | ||
new_settings: | ||
name: Check updated RA settings | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Get TAG from PR | ||
id: tag-from | ||
run: echo ::set-output name=TAG::$(rg -o 'TAG = "([^"]+)"' -r \$1 "plugin.py") | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
|
||
- name: Get TAG from main | ||
id: tag-to | ||
run: echo ::set-output name=TAG::$(rg -o 'TAG = "([^"]+)"' -r \$1 "plugin.py") | ||
|
||
- name: Run new_settings.sh script | ||
id: new_settings | ||
run: echo ::set-output name=CHANGES::$(./scripts/new_settings.sh ${{ steps.tag-from.outputs.TAG }} ${{ steps.tag-to.outputs.TAG }}) | ||
|
||
- name: Find Comment | ||
if: steps.new_settings.outputs.CHANGES != "No changes" | ||
uses: peter-evans/find-comment@v2 | ||
id: find-comment | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
comment-author: 'github-actions[bot]' | ||
body-includes: Build output | ||
|
||
- name: Create or update comment | ||
if: steps.new_settings.outputs.CHANGES != "No changes" | ||
uses: peter-evans/create-or-update-comment@v3 | ||
with: | ||
comment-id: ${{ steps.find-comment.outputs.comment-id }} | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body: | | ||
Changes in https://github.com/rust-lang/rust-analyzer/blob/master/editors/code/package.json | ||
<details> | ||
<summary>New settings</summary> | ||
```diff | ||
${{ steps.new_settings.outputs.CHANGES }} | ||
``` | ||
</details> | ||
edit-mode: replace |
This file contains 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,30 +1,48 @@ | ||
#!/usr/bin/env bash | ||
|
||
# The following script finds the keys that are in the `rust-analyzer` | ||
# package.json, but not in `LSP-rust-analyzer`'s sublime-settings. | ||
# The following script prints differences in `rust-analyzer` settings | ||
# between two tags. | ||
|
||
# exit when any command fails | ||
set -e | ||
|
||
RA_REPO_URL="https://github.com/rust-lang/rust-analyzer" | ||
RA_REPO_DIR=$(echo "${RA_REPO_URL}" | command grep -oE '[^/]*$') | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
LSP_REPO_DIR="$SCRIPT_DIR/.." | ||
|
||
read -rp 'Provide directory path to the rust-analyzer repository (for example: /usr/local/github/rust-analyzer/): ' RA_REPO_DIR | ||
if [ ! -d "$RA_REPO_DIR" ]; then | ||
echo "Directory path '$RA_REPO_DIR' DOES NOT exist." | ||
exit | ||
if [ "$#" -ne 2 ]; then | ||
echo 'You must provide 2 arguments - two tags between which to check for diffrences in settings.' | ||
exit 1 | ||
fi | ||
|
||
lsp_ra_settings=$(rg -o '"rust-analyzer.([^"]+)"' "${LSP_REPO_DIR}/LSP-rust-analyzer.sublime-settings" | sort) | ||
ra_settings=$(jq '.contributes.configuration.properties | ||
| to_entries | ||
| map(.key) | ||
| .[] | select(. != "$generated-start" and . != "$generated-end")' \ | ||
"${RA_REPO_DIR}/editors/code/package.json" | sort) | ||
function download_rust_by_tag { | ||
tag=$1 | ||
|
||
if [ ! "$tag" ]; then | ||
exit "No tag provided" | ||
fi | ||
|
||
pushd "${LSP_REPO_DIR}" || exit | ||
|
||
archive_url="${RA_REPO_URL}/archive/${tag}.zip" | ||
temp_zip="src-${tag}.zip" | ||
curl -L "${RA_REPO_URL}/archive/${tag}.zip" -o "${temp_zip}" --silent --show-error | ||
unzip -q "${temp_zip}" | ||
rm -f "${temp_zip}" || exit | ||
mv "${RA_REPO_DIR}-"* "${RA_REPO_DIR}" | ||
} | ||
|
||
tag_from=$1 | ||
tag_to=$2 | ||
|
||
download_rust_by_tag "$tag_from" | ||
settings_from=$(jq ".contributes.configuration.properties" "${RA_REPO_DIR}/editors/code/package.json") | ||
rm -rf "${RA_REPO_DIR}" | ||
|
||
# Missing settings in LSP-rust-analyzer | ||
rg -vf <(echo "${lsp_ra_settings}") <(echo "${ra_settings}") | ||
download_rust_by_tag "$tag_to" | ||
settings_to=$(jq ".contributes.configuration.properties" "${RA_REPO_DIR}/editors/code/package.json") | ||
rm -rf "${RA_REPO_DIR}" | ||
|
||
# Settings in LSP-rust-analyzer that are no longer relevant | ||
rg -vf <(echo "${ra_settings}") <(echo "${lsp_ra_settings}") \ | ||
| rg -v 'terminusAutoClose|terminusUsePanel' | ||
diff -u <(echo "$settings_from") <(echo "$settings_to") || echo "No changes" |