diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index a105ac5..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -github: devlooped diff --git a/.github/workflows/combine-prs.yml b/.github/workflows/combine-prs.yml deleted file mode 100644 index 0255974..0000000 --- a/.github/workflows/combine-prs.yml +++ /dev/null @@ -1,157 +0,0 @@ -# Source: https://github.com/hrvey/combine-prs-workflow -# Tweaks: regex support for branch - -name: '⛙ combine-prs' - -on: - workflow_dispatch: - inputs: - branchExpression: - description: 'Regular expression to match against PR branches to find combinable PRs' - required: true - default: 'dependabot' - mustBeGreen: - description: 'Only combine PRs that are green (status is success)' - required: true - default: true - combineTitle: - description: 'Title of the combined PR' - required: true - default: '⬆️ Bump dependencies' - combineBranchName: - description: 'Name of the branch to combine PRs into' - required: true - default: 'combine-prs' - ignoreLabel: - description: 'Exclude PRs with this label' - required: true - default: 'nocombine' - -jobs: - combine-prs: - name: ${{ github.event.inputs.combineBranchName }} - runs-on: ubuntu-latest - steps: - - uses: actions/github-script@v6 - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - const pulls = await github.paginate('GET /repos/:owner/:repo/pulls', { - owner: context.repo.owner, - repo: context.repo.repo - }); - const branchRegExp = new RegExp(`${{github.event.inputs.branchExpression}}`); - let branchesAndPRStrings = []; - let baseBranch = null; - let baseBranchSHA = null; - for (const pull of pulls) { - const branch = pull['head']['ref']; - console.log('Pull for branch: ' + branch); - if (branchRegExp.test(branch)) { - console.log('Branch matched: ' + branch); - let statusOK = true; - if(${{ github.event.inputs.mustBeGreen }}) { - console.log('Checking green status: ' + branch); - const stateQuery = `query($owner: String!, $repo: String!, $pull_number: Int!) { - repository(owner: $owner, name: $repo) { - pullRequest(number:$pull_number) { - commits(last: 1) { - nodes { - commit { - statusCheckRollup { - state - } - } - } - } - } - } - }` - const vars = { - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: pull['number'] - }; - const result = await github.graphql(stateQuery, vars); - const [{ commit }] = result.repository.pullRequest.commits.nodes; - const state = commit.statusCheckRollup.state - console.log('Validating status: ' + state); - if(state != 'SUCCESS') { - console.log('Discarding ' + branch + ' with status ' + state); - statusOK = false; - } - } - console.log('Checking labels: ' + branch); - const labels = pull['labels']; - for(const label of labels) { - const labelName = label['name']; - console.log('Checking label: ' + labelName); - if(labelName == '${{ github.event.inputs.ignoreLabel }}') { - console.log('Discarding ' + branch + ' with label ' + labelName); - statusOK = false; - } - } - if (statusOK) { - console.log('Adding branch to array: ' + branch); - const prString = '#' + pull['number'] + ' ' + pull['title']; - branchesAndPRStrings.push({ branch, prString }); - baseBranch = pull['base']['ref']; - baseBranchSHA = pull['base']['sha']; - } - } - } - if (branchesAndPRStrings.length == 0) { - core.setFailed('No PRs/branches matched criteria'); - return; - } - if (branchesAndPRStrings.length == 1) { - core.setFailed('Only one PR/branch matched criteria'); - return; - } - - try { - await github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: 'refs/heads/' + '${{ github.event.inputs.combineBranchName }}', - sha: baseBranchSHA - }); - } catch (error) { - console.log(error); - core.setFailed('Failed to create combined branch - maybe a branch by that name already exists?'); - return; - } - - let combinedPRs = []; - let mergeFailedPRs = []; - for(const { branch, prString } of branchesAndPRStrings) { - try { - await github.rest.repos.merge({ - owner: context.repo.owner, - repo: context.repo.repo, - base: '${{ github.event.inputs.combineBranchName }}', - head: branch, - }); - console.log('Merged branch ' + branch); - combinedPRs.push(prString); - } catch (error) { - console.log('Failed to merge branch ' + branch); - mergeFailedPRs.push(prString); - } - } - - console.log('Creating combined PR'); - const combinedPRsString = combinedPRs.join('\n'); - let body = '⛙ Combined PRs:\n' + combinedPRsString; - if(mergeFailedPRs.length > 0) { - const mergeFailedPRsString = mergeFailedPRs.join('\n'); - body += '\n\n⚠️ The following PRs were left out due to merge conflicts:\n' + mergeFailedPRsString - } - await github.rest.pulls.create({ - owner: context.repo.owner, - repo: context.repo.repo, - title: '⛙ ${{github.event.inputs.combineTitle}}', - head: '${{ github.event.inputs.combineBranchName }}', - base: baseBranch, - body: body - }); diff --git a/.github/workflows/dotnet-file-core.yml b/.github/workflows/dotnet-file-core.yml deleted file mode 100644 index 1230687..0000000 --- a/.github/workflows/dotnet-file-core.yml +++ /dev/null @@ -1,88 +0,0 @@ -# Synchronizes .netconfig-configured files with dotnet-file -name: dotnet-file-core -on: - workflow_call: - -env: - DOTNET_NOLOGO: true - -defaults: - run: - shell: pwsh - -jobs: - sync: - runs-on: ubuntu-latest - continue-on-error: true - steps: - - name: 🤖 defaults - uses: devlooped/actions-bot@v1 - with: - name: ${{ secrets.BOT_NAME }} - email: ${{ secrets.BOT_EMAIL }} - gh_token: ${{ secrets.GH_TOKEN }} - github_token: ${{ secrets.GITHUB_TOKEN }} - - - name: 🤘 checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: main - token: ${{ env.GH_TOKEN }} - - - name: ⌛ rate - if: github.event_name != 'workflow_dispatch' - run: | - # add random sleep since we run on fixed schedule - sleep (get-random -max 60) - # get currently authenticated user rate limit info - $rate = gh api rate_limit | convertfrom-json | select -expandproperty rate - # if we don't have at least 100 requests left, wait until reset - if ($rate.remaining -lt 10) { - $wait = ($rate.reset - (Get-Date (Get-Date).ToUniversalTime() -UFormat %s)) - echo "Rate limit remaining is $($rate.remaining), waiting for $($wait / 1000) seconds to reset" - sleep $wait - $rate = gh api rate_limit | convertfrom-json | select -expandproperty rate - echo "Rate limit has reset to $($rate.remaining) requests" - } - - - name: 🔄 sync - run: | - dotnet tool update -g dotnet-gcm - # store credentials in plaintext for linux compat - git config --local credential.credentialStore plaintext - dotnet gcm store --protocol=https --host=github.com --username=$env:GITHUB_ACTOR --password=$env:GH_TOKEN - gh auth status - - dotnet tool update -g dotnet-file - $changelog = "$([System.IO.Path]::GetTempPath())dotnet-file.md" - dotnet file sync -c:$changelog - if (test-path $changelog) { - echo 'CHANGES<> $env:GITHUB_ENV - cat $changelog >> $env:GITHUB_ENV - echo 'EOF' >> $env:GITHUB_ENV - cat $changelog - } else { - echo 'No changelog was generated' - } - - - name: +Mᐁ includes - uses: devlooped/actions-includes@v1 - with: - validate: false - - - name: ✍ pull request - uses: peter-evans/create-pull-request@v7 - with: - base: main - branch: dotnet-file-sync - delete-branch: true - labels: dependencies - author: ${{ env.BOT_AUTHOR }} - committer: ${{ env.BOT_AUTHOR }} - commit-message: ⬆️ Bump files with dotnet-file sync - - ${{ env.CHANGES }} - title: "⬆️ Bump files with dotnet-file sync" - body: ${{ env.CHANGES }} - token: ${{ env.GH_TOKEN }} diff --git a/.netconfig b/.netconfig index 7774d0b..4224b00 100644 --- a/.netconfig +++ b/.netconfig @@ -37,9 +37,7 @@ weak [file ".github/FUNDING.yml"] url = https://github.com/devlooped/.github/blob/main/.github/FUNDING.yml - sha = 39f4c591716ff50dd035d2fade35e5822489ab7f - etag = a944c728facd033bbdfb4ff8d0ef10d0b3a457c277dc499458df0ffc7e6409da - weak + skip [file ".github/dependabot.yml"] url = https://github.com/devlooped/oss/blob/main/.github/dependabot.yml sha = 49661dbf0720cde93eb5569be7523b5912351560 @@ -117,9 +115,7 @@ weak [file ".github/workflows/combine-prs.yml"] url = https://github.com/devlooped/oss/blob/main/.github/workflows/combine-prs.yml - sha = c1610886eba42cb250e3894aed40c0a258cd383d - etag = 598ee294649a44d4c5d5934416c01183597d08aa7db7938453fd2bbf52a4e64d - weak + skip [file ".github/release.yml"] url = https://github.com/devlooped/oss/blob/main/.github/release.yml sha = 0c23e24704625cf75b2cb1fdc566cef7e20af313 @@ -142,9 +138,7 @@ weak [file ".github/workflows/dotnet-file-core.yml"] url = https://github.com/devlooped/oss/blob/main/.github/workflows/dotnet-file-core.yml - sha = 875284ba5d565f529aba2f5d24ab8ed27c1d1c79 - etag = 8de1d974bf73b1945b5c8be684c3a0b7364114a0d795c9d68837aed9b3aff331 - weak + skip [file ".github/workflows/triage.yml"] url = https://github.com/devlooped/oss/blob/main/.github/workflows/triage.yml sha = 33000c0c4ab4eb4e0e142fa54515b811a189d55c