From bf64f28382356683b9769ea41c3abc660ecaa60c Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 11 May 2021 20:35:39 -0700 Subject: [PATCH 1/2] Remove obsolete submission URL extraction script This script was used for the previous issue-based submission system, and so will be of no more use after the switch to the new system. --- extract_library_from_issue.sh | 77 ----------------------------------- 1 file changed, 77 deletions(-) delete mode 100755 extract_library_from_issue.sh diff --git a/extract_library_from_issue.sh b/extract_library_from_issue.sh deleted file mode 100755 index 154d7725..00000000 --- a/extract_library_from_issue.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash - -ISSUE=$1 -REPO=arduino/Arduino - -if [ -z $ISSUE ]; then - echo Please specify the issue number - echo $0 6543 - exit 1 -fi - -TOKEN=`cat token` -REPO_URL=`curl -H "Authorization: token $TOKEN" -s -f https://api.github.com/repos/$REPO/issues/$ISSUE | jq -r .body | tr "\\r\\n" " " | egrep -o 'https?://[^ )]+' | head -n1 | sed -r 's/[/]releases[/].*//' | sed -r 's/[/]tree[/].*//' | sed -r 's/.+\\]\\(//' | sed -r 's/[,./]$//' | sed -r 's/.git$//'`.git - -echo Detected repo url is: $REPO_URL -echo Press enter to continue -read - - -TMP=`mktemp -u` - -git clone $REPO_URL $TMP -if [ $? != 0 ]; then - echo "Failed to fetch $REPO_URL." - exit 1 -fi -cd $TMP -TAGS=`git tag` -echo TAGS=$TAGS - -if [ -z "$TAGS" ]; then - echo "ERROR: Failed to detect TAGS." - exit 2 -fi - -git config advice.detachedHead false - -for TAG in `git tag`; do - git checkout "$TAG" - N=`cat library.properties | grep "name="` - if [ $? != 0 ]; then - echo "Invalid library.properties in tag $TAG" - continue - fi - NAME=${N#*=} - echo "Found name: $NAME" -done - -if [ -z "$NAME" ]; then - echo "ERROR: Failed to detect library NAME." - exit 2 -fi - -echo "" -echo ">> Library content:" -ls -l - -cd - - -rm -rf $TMP - -echo "" -echo ">> possible duplicates on repositories.txt:" -grep "$NAME" -i repositories.txt - -ADDED_LINE="$REPO_URL|Contributed|$NAME" - -echo "" -echo ">> Line to be added:" -echo $ADDED_LINE -echo Press enter to proceed -read - -echo $ADDED_LINE >> repositories.txt -git add -u repositories.txt -echo -e "Added lib $NAME\n\nhttps://github.com/arduino/Arduino/issues/$ISSUE" | git commit -F - - From bbf3b9198f1e91641140c06364b292f63d69f01f Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 11 May 2021 20:47:44 -0700 Subject: [PATCH 2/2] Replace utility script with tasks There is already a task for `go fmt` and `go vet`, so the remaining unique component of the `fmt_fix_vet`script was `go fix`. --- .github/workflows/check-go.yml | 19 +++++++++++++++++++ Taskfile.yml | 5 +++++ fmt_fix_vet | 8 -------- 3 files changed, 24 insertions(+), 8 deletions(-) delete mode 100755 fmt_fix_vet diff --git a/.github/workflows/check-go.yml b/.github/workflows/check-go.yml index d7b8377c..956660c4 100644 --- a/.github/workflows/check-go.yml +++ b/.github/workflows/check-go.yml @@ -39,6 +39,25 @@ jobs: - name: Check for errors run: task go:vet + check-outdated: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install Task + uses: arduino/actions/setup-taskfile@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + version: 3.x + + - name: Modernize usages of outdated APIs + run: task go:fix + + - name: Check if any fixes were needed + run: git diff --color --exit-code + check-style: runs-on: ubuntu-latest diff --git a/Taskfile.yml b/Taskfile.yml index 6627e6bd..ab3ccf9c 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -27,6 +27,11 @@ tasks: cmds: - go vet {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} + go:fix: + desc: Modernize usages of outdated APIs + cmds: + - go fix {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} + go:lint: desc: Lint Go code cmds: diff --git a/fmt_fix_vet b/fmt_fix_vet deleted file mode 100755 index 793c565b..00000000 --- a/fmt_fix_vet +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -x - -go fmt ./... -go fmt sync_libraries.go -go fix ./... -go fix sync_libraries.go -go vet ./... -go vet sync_libraries.go