Skip to content

Commit

Permalink
CI: change GH_PERSONAL_ACCESS_TOKEN secret useage
Browse files Browse the repository at this point in the history
  • Loading branch information
theofficialgman committed Aug 16, 2023
1 parent 8344b2d commit 0a18f0d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/update_apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:

# Runs a set of commands using the runners shell
- name: Run app update scripts
env:
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
run: |
# print user info
echo $USER $USERNAME $(id) $(whoami)
Expand All @@ -44,19 +46,19 @@ jobs:
#add special functions
get_release() {
curl -s --header "Authorization: token ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}" "https://api.github.com/repos/$1/releases/latest" | jq -r '.tag_name' | sed s/^v//g
curl -s --header "Authorization: token $GH_PERSONAL_ACCESS_TOKEN" "https://api.github.com/repos/$1/releases/latest" | jq -r '.tag_name' | sed s/^v//g
}
get_release_raw() {
curl -s --header "Authorization: token ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}" "https://api.github.com/repos/$1/releases/latest" | jq -r '.tag_name'
curl -s --header "Authorization: token $GH_PERSONAL_ACCESS_TOKEN" "https://api.github.com/repos/$1/releases/latest" | jq -r '.tag_name'
}
get_prerelease() {
curl -s --header "Authorization: token ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}" "https://api.github.com/repos/$1/releases" | jq -r 'map(select(.prerelease)) | first | .tag_name' | sed s/^v//g
curl -s --header "Authorization: token $GH_PERSONAL_ACCESS_TOKEN" "https://api.github.com/repos/$1/releases" | jq -r 'map(select(.prerelease)) | first | .tag_name' | sed s/^v//g
}
get_prerelease_raw() {
curl -s --header "Authorization: token ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}" "https://api.github.com/repos/$1/releases" | jq -r 'map(select(.prerelease)) | first | .tag_name'
curl -s --header "Authorization: token $GH_PERSONAL_ACCESS_TOKEN" "https://api.github.com/repos/$1/releases" | jq -r 'map(select(.prerelease)) | first | .tag_name'
}
function validate_url(){
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/updates/System Monitoring Center.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
webVer=$(curl -s --header "Authorization: token ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}" "https://api.github.com/repos/hakandundar34coding/system-monitoring-center/releases" | jq -r 'map(select(.prerelease==false)) | map(select(.draft==false)) | map(select(.tag_name | startswith("v1."))) | first | .tag_name' | sed s/^v//g)
webVer=$(curl -s --header "Authorization: token $GH_PERSONAL_ACCESS_TOKEN" "https://api.github.com/repos/hakandundar34coding/system-monitoring-center/releases" | jq -r 'map(select(.prerelease==false)) | map(select(.draft==false)) | map(select(.tag_name | startswith("v1."))) | first | .tag_name' | sed s/^v//g)
all_url="https://github.com/hakandundar34coding/system-monitoring-center/releases/download/v${webVer}/system-monitoring-center_${webVer}_all.deb"

source $GITHUB_WORKSPACE/.github/workflows/update_github_script.sh

0 comments on commit 0a18f0d

Please sign in to comment.