From c67ba2372e9e6bf6fae9ea9d00682ad2110b4633 Mon Sep 17 00:00:00 2001 From: Ben Carter Date: Mon, 3 Jun 2024 17:41:34 -0400 Subject: [PATCH 1/2] Updated to address set-output warning and support private orgs/repos --- .github/workflows/latest_tag.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/latest_tag.yml b/.github/workflows/latest_tag.yml index 31585c3b3..28ae90d9a 100644 --- a/.github/workflows/latest_tag.yml +++ b/.github/workflows/latest_tag.yml @@ -5,6 +5,13 @@ on: types: - released +permissions: + contents: write + actions: read + pull-requests: write + issues: read + discussions: read + jobs: update_latest_tag: runs-on: ubuntu-latest @@ -14,13 +21,18 @@ jobs: - name: Check if the latest release id: check_latest_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - latest_release=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name') - if [[ "refs/tags/$latest_release" == "${{ github.ref }}" ]]; then - echo "::set-output name=is_latest::true" + latest_release=$(curl -s -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name') + echo "Latest release: $latest_release" + echo "Current release: ${{ github.ref }}" + if [[ "refs/tags/$latest_release" == "${{ github.ref }}" ]]; then + echo "is_latest=true" >> $GITHUB_OUTPUT else - echo "::set-output name=is_latest::false" + echo "is_latest=false" >> $GITHUB_OUTPUT fi + - name: Update latest tag if: steps.check_latest_release.outputs.is_latest == 'true' uses: EndBug/latest-tag@latest @@ -34,3 +46,4 @@ jobs: uses: softprops/action-gh-release@v2 with: files: LICENSE + token: ${{ secrets.GITHUB_TOKEN }} From c1799f85abe8b4fb763f6ef06c13d8156b77c866 Mon Sep 17 00:00:00 2001 From: Ben Carter Date: Mon, 3 Jun 2024 17:44:47 -0400 Subject: [PATCH 2/2] removed unnecessary permissions required for this action token --- .github/workflows/latest_tag.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/latest_tag.yml b/.github/workflows/latest_tag.yml index 28ae90d9a..769f7746a 100644 --- a/.github/workflows/latest_tag.yml +++ b/.github/workflows/latest_tag.yml @@ -5,13 +5,6 @@ on: types: - released -permissions: - contents: write - actions: read - pull-requests: write - issues: read - discussions: read - jobs: update_latest_tag: runs-on: ubuntu-latest