diff --git a/.github/workflows/codespace-review-check.yml b/.github/workflows/codespace-review-check.yml index 3919f0fae9..429936e8ce 100644 --- a/.github/workflows/codespace-review-check.yml +++ b/.github/workflows/codespace-review-check.yml @@ -32,17 +32,19 @@ jobs: LOGIN: docs-bot REPO: github/docs-internal run: | - ago=$(date -d '225 minutes ago' -Iseconds) + # If its approaching 4 hours, update the comment + # But don't keep trying to update the comment after 5 hours cause that wastes API calls + from=$(date -d '285 minutes ago' -Iseconds) # 5 * 60 - 15 = 285 + until=$(date -d '225 minutes ago' -Iseconds) # 4 * 60 - 15 = 225 echo "- Ago: $ago" # on mac: date -v-225M -Iseconds - # -v-225M means 225 minutes ago, 4 * 60 - 15 = 225 # -Iseconds means ISO 8601 format, to seconds branches=$( gh codespace list \ --repo "$REPO" \ --limit 1000 \ --json name,owner,lastUsedAt,gitStatus \ - --jq ".[] | select(.owner == \"$LOGIN\" and .lastUsedAt < \"$ago\") | .gitStatus.ref" \ + --jq ".[] | select(.owner == \"$LOGIN\" and .lastUsedAt < \"$until\" and .lastUsedAt > \"$from\") | .gitStatus.ref" \ ) echo "- Branches:" echo "$(echo "$branches" | sed 's/^/ /')" @@ -111,14 +113,14 @@ jobs: ### Review this PR in a codespace 📦 - Your codespace is no longer active. + The codespace is no longer active. You’ve reached the 4 hour limit. - In order to reactivate your codespace, please update your pull request by adding the https://github.com/${{ env.REPO }}/labels/extend-codespace label. - If the label is already applied, you can remove and reapply the label to reactivate your codespace. + In order to reactivate the codespace, please update the pull request by adding the https://github.com/${{ env.REPO }}/labels/extend-codespace label. + If the label is already applied, you can remove and reapply the label to reactivate the codespace. 🤖 This comment is [automatically generated][workflow]. - [workflow]: ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/.github/workflows/codespace-review-check.yml + [workflow]: ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.workflow_sha }}/.github/workflows/codespace-review-check.yml - uses: ./.github/actions/slack-alert if: ${{ failure() && github.event_name != 'workflow_dispatch' }} diff --git a/.github/workflows/codespace-review-down.yml b/.github/workflows/codespace-review-down.yml index 93e8a9d468..9c2c2a498d 100644 --- a/.github/workflows/codespace-review-down.yml +++ b/.github/workflows/codespace-review-down.yml @@ -77,8 +77,8 @@ jobs: ### Review this PR in a codespace 📦 - Your pull request is now merged or closed, so I've removed all automatically created codespaces. + The pull request is now merged or closed, so I've removed all automatically created codespaces. 🤖 This comment is [automatically generated][workflow]. - [workflow]: ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/.github/workflows/codespace-review-down.yml + [workflow]: ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.workflow_sha }}/.github/workflows/codespace-review-down.yml diff --git a/.github/workflows/codespace-review-up.yml b/.github/workflows/codespace-review-up.yml index 8254b9129d..b82f43c188 100644 --- a/.github/workflows/codespace-review-up.yml +++ b/.github/workflows/codespace-review-up.yml @@ -107,7 +107,7 @@ jobs: gh pr comment \ "$branch" \ --repo "$REPO" \ - --body "Thank you for your pull request. I deleted the oldest codespaces to make room for a new one. You can make a new codespace by updating your pull request or closing and reopening your pull request." + --body "Thank you for this pull request. I deleted the oldest codespaces to make room for a new one. You can make a new codespace by updating the pull request or closing and reopening the pull request." echo "Commented on branch $branch" done echo "Deleted the oldest $tocut codespaces" @@ -205,18 +205,18 @@ jobs: ### Review this PR in a codespace 📦 - Your codespace will be ready in two to three minutes and you can review changes at: + The codespace will be ready in two to three minutes and you can review changes at: ${{ env.APP_URL }} - Your codespace will be automatically deleted once your pull request is closed or merged. + The codespace will be automatically deleted once the pull request is closed or merged. - #### Your codespace will idle after 4 hours of inactivity + #### The codespace will idle after 4 hours of inactivity - After 4 hours, you can reactivate your codespace by applying the https://github.com/${{ env.REPO }}/labels/extend-codespace label to the pull request. - If the label is already applied, you can remove and reapply the label to reactivate your codespace. + After 4 hours, you can reactivate the codespace by applying the https://github.com/${{ env.REPO }}/labels/extend-codespace label to the pull request. + If the label is already applied, you can remove and reapply the label to reactivate the codespace.
Table of review links - ${{ steps.changes.outputs.changesTable && 'The table shows the files in the `content` directory that were changed in this pull request. This helps you review your changes on the review server. Changes to the `data` directory are not included in this table.' || '' }} + ${{ steps.changes.outputs.changesTable && 'The table shows the files in the `content` directory that were changed in this pull request. Changes to the `data` directory are not included in this table.' || '' }} ${{ steps.changes.outputs.changesTable || '_This pull request contains code changes, so we will not generate a table of review links._' }} @@ -226,4 +226,4 @@ jobs: 🤖 This comment is [automatically generated][workflow]. - [workflow]: ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/.github/workflows/codespace-review-up.yml + [workflow]: ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.workflow_sha }}/.github/workflows/codespace-review-up.yml diff --git a/.github/workflows/review-comment.yml b/.github/workflows/review-comment.yml index 116573bb4a..a9637b55e2 100644 --- a/.github/workflows/review-comment.yml +++ b/.github/workflows/review-comment.yml @@ -100,6 +100,6 @@ jobs: 🤖 This comment is [automatically generated][workflow]. - [workflow]: ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/.github/workflows/review-comment.yml + [workflow]: ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.workflow_sha }}/.github/workflows/review-comment.yml [codespace]: ${{ github.repository == 'github/docs-internal' && 'https://github.com/github/docs-team/blob/main/contributing-to-docs/use-a-codespace-to-review.md' || 'https://docs.github.com/en/contributing/setting-up-your-environment-to-work-on-github-docs/working-on-github-docs-in-a-codespace' }} [local]: https://docs.github.com/en/contributing/setting-up-your-environment-to-work-on-github-docs/creating-a-local-environment#setting-up-your-local-environment