Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github: devlooped
github: devlooped
58 changes: 58 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: pages
on:
workflow_dispatch:
push:
branches:
- main
- pages

env:
PAGES_ORGANIZATION: ${{ secrets.PAGES_ORGANIZATION }}
PAGES_REPOSITORY: ${{ secrets.PAGES_REPOSITORY }}

jobs:
gh-pages:
runs-on: ubuntu-latest
steps:
- name: 🤘 checkout
uses: actions/checkout@v2

- name: ⚙ jekyll
run: |
sudo gem install bundler
bundle install

- name: 🖉 default env
env:
PAGES_ORGANIZATION: ${{ secrets.PAGES_ORGANIZATION }}
PAGES_REPOSITORY: ${{ secrets.PAGES_REPOSITORY }}
run: |
echo "PAGES_ORGANIZATION=${PAGES_ORGANIZATION}" >> $GITHUB_ENV
echo "PAGES_REPOSITORY=${PAGES_REPOSITORY}" >> $GITHUB_ENV

- name: 🖉 default repo
if: env.PAGES_REPOSITORY == ''
run: echo "PAGES_REPOSITORY=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV

- name: 🙏 build
run: bundle exec jekyll build -b ${{ env.PAGES_REPOSITORY }}
env:
JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: ✓ commit
run: |
cd _site
git init
git add -A
git config --local user.email "bot@devlooped.com"
git config --local user.name "bot@devlooped.com"
git commit -m "Publish pages from ${GITHUB_REPOSITORY}@${GITHUB_SHA:0:9}"

- name: 🚀 push
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.PAGES_ACCESS_TOKEN }}
repository: ${{ env.PAGES_ORGANIZATION }}/${{ env.PAGES_REPOSITORY }}
branch: gh-pages
force: true
directory: ./_site
59 changes: 59 additions & 0 deletions .github/workflows/sponsors.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
$event = Get-Content -Path $env:GITHUB_EVENT_PATH | ConvertFrom-Json
$author = $event.issue ? $event.issue.user.node_id : $event.pull_request.user.node_id

if ($author -eq $null) {
throw 'No user id found'
}

gh auth status

echo "Looking up sponsorship from $env:GITHUB_ACTOR ..."

$query = gh api graphql --paginate -f owner='devlooped' -f query='
query($owner: String!, $endCursor: String) {
organization (login: $owner) {
sponsorshipsAsMaintainer (first: 100, after: $endCursor) {
nodes {
sponsorEntity {
... on Organization { id, name }
... on User { id, name }
}
tier { monthlyPriceInDollars }
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
'

$amount =
$query |
ConvertFrom-Json |
select @{ Name='nodes'; Expression={$_.data.organization.sponsorshipsAsMaintainer.nodes}} |
select -ExpandProperty nodes |
where { $_.sponsorEntity.id -eq $author } |
select -ExpandProperty tier |
select -ExpandProperty monthlyPriceInDollars

if ($null -eq $amount) {
echo "Author is not a sponsor! Nothing left to do."
return
}

echo "Author is a sponsor!"

$headers = @{ 'Accept'='application/vnd.github.v3+json;charset=utf-8'; 'Authorization' = "bearer $env:GH_TOKEN" }

# Try creating the labels, ignore errors (i.e. already created)
iwr -Body '{ "name":"sponsor :purple_heart:", "color":"ea4aaa", "description":"sponsor" }' "$env:GITHUB_API_URL/repos/$env:GITHUB_REPOSITORY/labels" -Method Post -Headers $headers -SkipHttpErrorCheck -UseBasicParsing | select -ExpandProperty StatusCode
iwr -Body '{ "name":"sponsor :yellow_heart:", "color":"ea4aaa", "description":"sponsor++" }' "$env:GITHUB_API_URL/repos/$env:GITHUB_REPOSITORY/labels" -Method Post -Headers $headers -SkipHttpErrorCheck -UseBasicParsing | select -ExpandProperty StatusCode

$number = $event.issue ? $event.issue.number : $event.pull_request.number
$labels = $amount -ge 100 ? '{"labels":["sponsor :yellow_heart:"]}' : '{"labels":["sponsor :purple_heart:"]}'

iwr -Body $labels "$env:GITHUB_API_URL/repos/$env:GITHUB_REPOSITORY/issues/$number/labels" -Method Post -Headers $headers -SkipHttpErrorCheck -UseBasicParsing | select -ExpandProperty StatusCode

echo 'Label applied'
23 changes: 23 additions & 0 deletions .github/workflows/sponsors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Runs on new issues/PRs and applies sponsor labels

name: sponsors
on:
issues:
types: [opened]

jobs:
sponsors:
runs-on: windows-latest
steps:
- name: 🤘 checkout
uses: actions/checkout@v2

- name: 🔽 gh
run: |
iwr -useb get.scoop.sh | iex
scoop install gh

- name: 💛 sponsors
run: ./.github/workflows/sponsors.ps1
env:
GH_TOKEN: ${{ secrets.DEVLOOPED_TOKEN }}
27 changes: 24 additions & 3 deletions .netconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[file]
url = https://github.com/devlooped/oss
url = https://github.com/devlooped/.github
[file "readme.md"]
url = https://github.com/devlooped/oss/blob/main/readme.md
skip
Expand All @@ -21,10 +22,10 @@
weak
sha = 0683ee777d7d878d4bf013d7deea352685135a05
[file ".github/FUNDING.yml"]
url = https://github.com/devlooped/oss/blob/main/.github/FUNDING.yml
etag = f4d02805592d1f86c29acc9da3a40e817fb3611d6ff0f6409f547137f38f65df
url = https://github.com/devlooped/.github/blob/main/.github/FUNDING.yml
etag = a944c728facd033bbdfb4ff8d0ef10d0b3a457c277dc499458df0ffc7e6409da
weak
sha = 4c91539ec08a3f9c14ff1e8c6a7c4ae88795f5f1
sha = 39f4c591716ff50dd035d2fade35e5822489ab7f
[file ".github/ISSUE_TEMPLATE/bug.md"]
url = https://github.com/devlooped/oss/blob/main/.github/ISSUE_TEMPLATE/bug.md
etag = 026852ba1f1921f3a043bb5e09cd7a2c3d9a33ec51f48e524dc3a2ab72de3141
Expand Down Expand Up @@ -155,3 +156,23 @@
sha = 7d0ccab53c166b87b971040f25de06570821f8ac
etag = 0ef58051c4db505e16b39954b27ab9e7a903647998b959e0924634d5f01824dd
weak
[file ".github/workflows/pages.yml"]
url = https://github.com/devlooped/.github/blob/main/.github/workflows/pages.yml
sha = e8f3774884afda36ac177c4193929d24d7901de9
etag = 42fdc888e07b492cccc6fd29972bd9ea6f13691a3fdf057e07f3f8eec9330b7a
weak
[file ".github/workflows/sponsors.ps1"]
url = https://github.com/devlooped/.github/blob/main/.github/workflows/sponsors.ps1
sha = 11f5c27cfdb304436ef0b7ee27ff333cda31ef65
etag = 57a303125f3367b68ad0700d89ff4ba57cb29b33b303903488c9c8638d0bf735
weak
[file ".github/workflows/sponsors.yml"]
url = https://github.com/devlooped/.github/blob/main/.github/workflows/sponsors.yml
sha = 514760df24bd906b9e5d3a56deac0d18cba59a6d
etag = 0236ed96c1d11f69b26ac0e039e74107df5731574236e2de2a83152fee5df0a6
weak
[file "Gemfile"]
url = https://github.com/devlooped/.github/blob/main/Gemfile
sha = f2dc1370469bec1b2d32d82faf659b050cdc7e2a
etag = d45832acd078778ffebf260000f6d25172a131f51684744d7e982da2a47170ce
weak
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gem 'github-pages', '~> 209', group: :jekyll_plugins