Skip to content

Instantly share code, notes, and snippets.

@parth-gr
Created July 7, 2022 15:20
Show Gist options
  • Save parth-gr/61baa7c7cd27c5bbf1a351b1225db308 to your computer and use it in GitHub Desktop.
Save parth-gr/61baa7c7cd27c5bbf1a351b1225db308 to your computer and use it in GitHub Desktop.
Logs for auto-assign
2022-07-07T12:35:49.1963633Z Requested labels: ubuntu-latest
2022-07-07T12:35:49.1963682Z Job defined at: parth-gr/auto-assign-issue/.github/workflows/assign1.yaml@refs/heads/main
2022-07-07T12:35:49.1963704Z Waiting for a runner to pick up this job...
2022-07-07T12:35:50.0836720Z Job is waiting for a hosted runner to come online.
2022-07-07T12:35:54.3890312Z Job is about to start running on the hosted runner: Hosted Agent (hosted)
2022-07-07T12:35:57.8081397Z Current runner version: '2.294.0'
2022-07-07T12:35:57.8109448Z ##[group]Operating System
2022-07-07T12:35:57.8109974Z Ubuntu
2022-07-07T12:35:57.8110385Z 20.04.4
2022-07-07T12:35:57.8110712Z LTS
2022-07-07T12:35:57.8110980Z ##[endgroup]
2022-07-07T12:35:57.8111351Z ##[group]Virtual Environment
2022-07-07T12:35:57.8111756Z Environment: ubuntu-20.04
2022-07-07T12:35:57.8112443Z Version: 20220626.1
2022-07-07T12:35:57.8113036Z Included Software: https://github.com/actions/virtual-environments/blob/ubuntu20/20220626.1/images/linux/Ubuntu2004-Readme.md
2022-07-07T12:35:57.8113771Z Image Release: https://github.com/actions/virtual-environments/releases/tag/ubuntu20%2F20220626.1
2022-07-07T12:35:57.8114227Z ##[endgroup]
2022-07-07T12:35:57.8114611Z ##[group]Virtual Environment Provisioner
2022-07-07T12:35:57.8115064Z 1.0.0.0-main-20220616-1
2022-07-07T12:35:57.8115367Z ##[endgroup]
2022-07-07T12:35:57.8116433Z ##[group]GITHUB_TOKEN Permissions
2022-07-07T12:35:57.8117110Z Actions: write
2022-07-07T12:35:57.8117656Z Checks: write
2022-07-07T12:35:57.8118011Z Contents: write
2022-07-07T12:35:57.8118364Z Deployments: write
2022-07-07T12:35:57.8118781Z Discussions: write
2022-07-07T12:35:57.8119081Z Issues: write
2022-07-07T12:35:57.8119415Z Metadata: read
2022-07-07T12:35:57.8119769Z Packages: write
2022-07-07T12:35:57.8120058Z Pages: write
2022-07-07T12:35:57.8120444Z PullRequests: write
2022-07-07T12:35:57.8120828Z RepositoryProjects: write
2022-07-07T12:35:57.8121174Z SecurityEvents: write
2022-07-07T12:35:57.8121528Z Statuses: write
2022-07-07T12:35:57.8121876Z ##[endgroup]
2022-07-07T12:35:57.8125767Z Secret source: Actions
2022-07-07T12:35:57.8126354Z Prepare workflow directory
2022-07-07T12:35:57.8962569Z Prepare all required actions
2022-07-07T12:35:58.0395847Z ##[group]Run BODY="$(jq '.comment.body' $GITHUB_EVENT_PATH)"
2022-07-07T12:35:58.0396579Z BODY="$(jq '.comment.body' $GITHUB_EVENT_PATH)"
2022-07-07T12:35:58.0397026Z ISSUE_NUMBER="$(jq '.issue.number' $GITHUB_EVENT_PATH)"
2022-07-07T12:35:58.0397670Z LOGIN="$(jq '.comment.user.login' $GITHUB_EVENT_PATH | tr -d \")"
2022-07-07T12:35:58.0398220Z REPO="$(jq '.repository.full_name' $GITHUB_EVENT_PATH | tr -d \")"
2022-07-07T12:35:58.0398732Z ISSUE_JSON="$(jq '.issue' $GITHUB_EVENT_PATH)"
2022-07-07T12:35:58.0399200Z ISSUE_CURRENTLY_ASSIGNED=`echo $ISSUE_JSON | jq '.assignees | length == 0'`
2022-07-07T12:35:58.0399652Z 
2022-07-07T12:35:58.0400060Z if [[ $BODY == *"$INPUT_TRIGGER"* ]]; then
2022-07-07T12:35:58.0400462Z  if [[ "$ISSUE_CURRENTLY_ASSIGNED" == true ]]; then
2022-07-07T12:35:58.0401004Z  echo "Assigning issue $ISSUE_NUMBER to $LOGIN"
2022-07-07T12:35:58.0401735Z  curl -H "Authorization: token $GITHUB_TOKEN" -d '{"assignees":["'"$LOGIN"'"]}' https://api.github.com/repos/$REPO/issues/$ISSUE_NUMBER/assignees
2022-07-07T12:35:58.0402337Z  if [[ ! -z $INPUT_MESSAGE ]]; then
2022-07-07T12:35:58.0402827Z  jq -n -r --arg body "$INPUT_MESSAGE" '{body: $body}' > payload.json
2022-07-07T12:35:58.0403557Z  curl -X POST -H "Authorization: token $GITHUB_TOKEN" --data @payload.json https://api.github.com/repos/$REPO/issues/$ISSUE_NUMBER/comments
2022-07-07T12:35:58.0404138Z  fi
2022-07-07T12:35:58.0404412Z  else
2022-07-07T12:35:58.0404890Z  echo "This issue is currently assigned to a different user"
2022-07-07T12:35:58.0405415Z  if [[ ! -z $ISSUE_CURRENTLY_ASSIGNED_MESSAGE ]]; then
2022-07-07T12:35:58.0405972Z  jq -n -r --arg body "$ISSUE_CURRENTLY_ASSIGNED_MESSAGE" '{body: $body}' > payload.json
2022-07-07T12:35:58.0406662Z  curl -X POST -H "Authorization: token $GITHUB_TOKEN" --data @payload.json https://api.github.com/repos/$REPO/issues/$ISSUE_NUMBER/comments
2022-07-07T12:35:58.0407266Z  fi
2022-07-07T12:35:58.0407599Z  fi
2022-07-07T12:35:58.0407868Z fi
2022-07-07T12:35:58.0957669Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2022-07-07T12:35:58.0958172Z env:
2022-07-07T12:35:58.0958588Z INPUT_MESSAGE: Thanks for taking this issue! Let us know if you have any questions!
2022-07-07T12:35:58.0959076Z INPUT_TRIGGER: /assign
2022-07-07T12:35:58.0959593Z ISSUE_CURRENTLY_ASSIGNED_MESSAGE: The issue you are trying to assign to yourself is already assigned.
2022-07-07T12:35:58.0960516Z GITHUB_TOKEN: ***
2022-07-07T12:35:58.0960825Z ##[endgroup]
2022-07-07T12:35:58.3626827Z Cleaning up orphan processes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment