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/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 - - 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