Skip to content

Commit

Permalink
ci: Update the updater workflow to skip running poetry-audit during t…
Browse files Browse the repository at this point in the history
…he updater process (#235)

* ci: Update the updater workflow to skip running a hook that can't be run

* ci: Update publisher workflows to better handle secondary rate limitations from GitHub
  • Loading branch information
nfelt14 authored Jun 10, 2024
1 parent d3c525c commit 9e6e016
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 23 deletions.
39 changes: 28 additions & 11 deletions .github/workflows/publish-api-comparison.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,35 @@ jobs:
uses: actions/github-script@v7
with:
script: |
const response = await github.rest.search.issuesAndPullRequests({
q: 'repo:${{ github.repository }} is:pr sha:${{ github.event.workflow_run.head_sha }}',
per_page: 1,
})
const items = response.data.items
if (items.length < 1) {
console.error('No PRs found')
return
const maxAttempts = 5;
let attempt = 0;
let pullRequestNumber;
while (attempt < maxAttempts) {
try {
const response = await github.rest.search.issuesAndPullRequests({
q: 'repo:${{ github.repository }} is:pr sha:${{ github.event.workflow_run.head_sha }}',
per_page: 1,
});
const items = response.data.items;
if (items.length < 1) {
throw new Error('No PRs found');
}
pullRequestNumber = items[0].number;
console.info("Pull request number is", pullRequestNumber);
break; // Exit loop on success
} catch (error) {
console.error(`Attempt ${attempt + 1} failed:`, error.message);
if (attempt < maxAttempts - 1) { // Check if not last attempt
console.log(`Waiting for 2 minutes before retrying...`);
await new Promise(resolve => setTimeout(resolve, 120000)); // Wait for 2 minutes
}
}
attempt++;
}
const pullRequestNumber = items[0].number
console.info("Pull request number is", pullRequestNumber)
return pullRequestNumber
if (!pullRequestNumber) {
core.setFailed("Failed to fetch PR number after 5 attempts");
}
return pullRequestNumber;
- name: Publish API Breaking Changes Check Results
uses: marocchino/sticky-pull-request-comment@v2
if: ${{ env.BREAKING_CHANGES == 'true' }}
Expand Down
39 changes: 28 additions & 11 deletions .github/workflows/publish-test-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,35 @@ jobs:
uses: actions/github-script@v7
with:
script: |
const response = await github.rest.search.issuesAndPullRequests({
q: 'repo:${{ github.repository }} is:pr sha:${{ github.event.workflow_run.head_sha }}',
per_page: 1,
})
const items = response.data.items
if (items.length < 1) {
console.error('No PRs found')
return
const maxAttempts = 5;
let attempt = 0;
let pullRequestNumber;
while (attempt < maxAttempts) {
try {
const response = await github.rest.search.issuesAndPullRequests({
q: 'repo:${{ github.repository }} is:pr sha:${{ github.event.workflow_run.head_sha }}',
per_page: 1,
});
const items = response.data.items;
if (items.length < 1) {
throw new Error('No PRs found');
}
pullRequestNumber = items[0].number;
console.info("Pull request number is", pullRequestNumber);
break; // Exit loop on success
} catch (error) {
console.error(`Attempt ${attempt + 1} failed:`, error.message);
if (attempt < maxAttempts - 1) { // Check if not last attempt
console.log(`Waiting for 2 minutes before retrying...`);
await new Promise(resolve => setTimeout(resolve, 120000)); // Wait for 2 minutes
}
}
attempt++;
}
const pullRequestNumber = items[0].number
console.info("Pull request number is", pullRequestNumber)
return pullRequestNumber
if (!pullRequestNumber) {
core.setFailed("Failed to fetch PR number after 5 attempts");
}
return pullRequestNumber;
- name: Publish Test Results
uses: marocchino/sticky-pull-request-comment@v2
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Run pre-commit
continue-on-error: true
env:
SKIP: ${{ inputs.pre-commit-hook-skip-list || 'pylint,pyright,pyright-verifytypes,pyroma' }}
SKIP: ${{ inputs.pre-commit-hook-skip-list || 'pylint,pyright,pyright-verifytypes,pyroma,poetry-audit' }}
run: python -m pre_commit run --all
- uses: stefanzweifel/git-auto-commit-action@v5
with:
Expand Down

0 comments on commit 9e6e016

Please sign in to comment.