-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refresh Tugboat Preview ID cache from PR cache scope #16562
Conversation
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 | ||
with: | ||
github-token: ${{ secrets.LABEL_API_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default identity github-actions (bot)
does not trigger the pull_request: labeled
event. I'm not sure why this is but a PAT will trigger the event correctly. (I suspect this to be a github-actions bug)
Note the PAT needed these permissions:
- repo admin read/write
- issues read/write
- pull request read/write
The current fine-grained token has these permissions for va.gov-cms and va.gov-cms-test repos only.
if: ${{ github.event.label.name == 'refresh-tugboat-cache' }} | ||
steps: | ||
- name: Refresh Preview ID | ||
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to cache scoping, actions/cache/restore will only work if triggered from some type of pull_request
event.
for (const pr of prs) { | ||
if (cacheKeys.includes(`${{ runner.os }}-tugboat-preview-id-pr-${pr}`)) { | ||
console.log(`Need to refresh: ${pr}`) | ||
toRefresh.push(pr) | ||
await github.rest.issues.addLabels({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pull_request: label
seems to be the least disruptive event. Alternatively we can use any of the other pull request events.
3c6ea45
to
dc9614d
Compare
GitHub Workflows (.github/workflows/*.yml)Have you...
|
This reverts commit 48de27e.
This reverts commit 48de27e.
* Revert "Add documentation for Tugboat GHA integration (#16739)" This reverts commit e5bce05. * Revert "Refresh Tugboat Preview ID cache from PR cache scope (#16562)" This reverts commit 48de27e. * Revert "Minimize PR overhead for non-code changes (#16279)" This reverts commit 176aa38. * Update documentation (#17123) * Test PR with documentation change * Update
Description
Resolves #16561
Testing done
Tested in va.gov-cms-test using department-of-veterans-affairs/va.gov-cms-test#1469. The last two triggered refreshes were successful. Note the name of the workflow job was updated to clarify functionality.
Screenshots
QA steps
TBD
Definition of Done
Select Team for PR review
CMS Team
Public websites
Facilities
User support
Accelerated Publishing