From adfd4af872d5fd91817915ac0ca539165e1e0cd2 Mon Sep 17 00:00:00 2001 From: "Y. Meyer-Norwood" <106889957+norwd@users.noreply.github.com> Date: Mon, 11 Nov 2024 12:58:40 +1300 Subject: [PATCH 1/3] Create upload-robots-txt-file-to-release.yml --- .../upload-robots-txt-file-to-release.yml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/upload-robots-txt-file-to-release.yml diff --git a/.github/workflows/upload-robots-txt-file-to-release.yml b/.github/workflows/upload-robots-txt-file-to-release.yml new file mode 100644 index 0000000..df57bee --- /dev/null +++ b/.github/workflows/upload-robots-txt-file-to-release.yml @@ -0,0 +1,23 @@ +--- + +name: "Upload robots.txt file to release" +run-name: "Upload robots.txt file to release" + +on: + release: + types: + - published + +jobs: + upload-robots-txt-file-to-release: + name: "Upload robots.txt file to release" + runs-on: ubuntu-latest + steps: + - name: "Checkout" + uses: actions/checkout@v4 + + - name: "Upload" + run: gh --repo "${REPO}" release upload "${TAG}" robots.txt + env: + REPO: ${{ github.repository }} + TAG: ${{ github.event.release.tag_name }} From 94ceb3cffdc3001dccfdfbd48140cd8057116242 Mon Sep 17 00:00:00 2001 From: "Y. Meyer-Norwood" <106889957+norwd@users.noreply.github.com> Date: Mon, 11 Nov 2024 13:04:55 +1300 Subject: [PATCH 2/3] Add authentication for `gh` command --- .github/workflows/upload-robots-txt-file-to-release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/upload-robots-txt-file-to-release.yml b/.github/workflows/upload-robots-txt-file-to-release.yml index df57bee..370feb6 100644 --- a/.github/workflows/upload-robots-txt-file-to-release.yml +++ b/.github/workflows/upload-robots-txt-file-to-release.yml @@ -8,6 +8,9 @@ on: types: - published +permissions: + contents: write + jobs: upload-robots-txt-file-to-release: name: "Upload robots.txt file to release" @@ -19,5 +22,6 @@ jobs: - name: "Upload" run: gh --repo "${REPO}" release upload "${TAG}" robots.txt env: + GH_TOKEN: ${{ github.token }} REPO: ${{ github.repository }} TAG: ${{ github.event.release.tag_name }} From e8f0784a0058f8a737ef150ae132ecb13051979d Mon Sep 17 00:00:00 2001 From: "Y. Meyer-Norwood" <106889957+norwd@users.noreply.github.com> Date: Wed, 13 Nov 2024 10:26:37 +1300 Subject: [PATCH 3/3] Explicitly use release tag for checkout --- .github/workflows/upload-robots-txt-file-to-release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/upload-robots-txt-file-to-release.yml b/.github/workflows/upload-robots-txt-file-to-release.yml index 370feb6..5bf2b29 100644 --- a/.github/workflows/upload-robots-txt-file-to-release.yml +++ b/.github/workflows/upload-robots-txt-file-to-release.yml @@ -18,6 +18,8 @@ jobs: steps: - name: "Checkout" uses: actions/checkout@v4 + with: + ref: ${{ github.event.release.tag_name }} - name: "Upload" run: gh --repo "${REPO}" release upload "${TAG}" robots.txt