1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Auto codespace feedback round 2 (#54706)

This commit is contained in:
Kevin Heis
2025-03-06 10:14:22 -08:00
committed by GitHub
parent cd8bf2a292
commit f92c0f22e1
4 changed files with 20 additions and 18 deletions

View File

@@ -32,17 +32,19 @@ jobs:
LOGIN: docs-bot LOGIN: docs-bot
REPO: github/docs-internal REPO: github/docs-internal
run: | 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" echo "- Ago: $ago"
# on mac: date -v-225M -Iseconds # on mac: date -v-225M -Iseconds
# -v-225M means 225 minutes ago, 4 * 60 - 15 = 225
# -Iseconds means ISO 8601 format, to seconds # -Iseconds means ISO 8601 format, to seconds
branches=$( branches=$(
gh codespace list \ gh codespace list \
--repo "$REPO" \ --repo "$REPO" \
--limit 1000 \ --limit 1000 \
--json name,owner,lastUsedAt,gitStatus \ --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 "- Branches:"
echo "$(echo "$branches" | sed 's/^/ /')" echo "$(echo "$branches" | sed 's/^/ /')"
@@ -111,14 +113,14 @@ jobs:
### Review this PR in a codespace 📦 ### Review this PR in a codespace 📦
Your codespace is no longer active. The codespace is no longer active.
Youve reached the 4 hour limit. Youve 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. 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 your codespace. If the label is already applied, you can remove and reapply the label to reactivate the codespace.
🤖 This comment is [automatically generated][workflow]. 🤖 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 - uses: ./.github/actions/slack-alert
if: ${{ failure() && github.event_name != 'workflow_dispatch' }} if: ${{ failure() && github.event_name != 'workflow_dispatch' }}

View File

@@ -77,8 +77,8 @@ jobs:
### Review this PR in a codespace 📦 ### 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]. 🤖 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

View File

@@ -107,7 +107,7 @@ jobs:
gh pr comment \ gh pr comment \
"$branch" \ "$branch" \
--repo "$REPO" \ --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" echo "Commented on branch $branch"
done done
echo "Deleted the oldest $tocut codespaces" echo "Deleted the oldest $tocut codespaces"
@@ -205,18 +205,18 @@ jobs:
### Review this PR in a codespace 📦 ### 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 }} ${{ 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. 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 your codespace. If the label is already applied, you can remove and reapply the label to reactivate the codespace.
<details><summary>Table of review links</summary> <details><summary>Table of review links</summary>
${{ 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._' }} ${{ 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]. 🤖 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

View File

@@ -100,6 +100,6 @@ jobs:
🤖 This comment is [automatically generated][workflow]. 🤖 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' }} [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 [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