Skip to content

Update PSL

Update PSL #6

Workflow file for this run

name: Update PSL
on:
workflow_dispatch:
schedule:
# Run monthly at a random (https://xkcd.com/221/) time.
- cron: '46 16 1 * *'
permissions:
contents: write
pull-requests: write
jobs:
create-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# This is the real username and email used by github-actions elsewhere.
- run: git config user.name "github-actions[bot]"
- run: git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- run: echo ::set-output name=name::update-psl-$(date +%F)
id: branch
- run: git checkout -b ${{ steps.branch.outputs.name }}
# We run these inside "docker compose" to ensure we use the same Go version
# as elsewhere. They're run inside the netaccess container so they can
# download the dependency files.
- run: docker compose run netaccess go get github.com/weppos/publicsuffix-go@main
- run: docker compose run netaccess go mod vendor
- run: docker compose run netaccess go mod tidy
- run: git diff --numstat vendor/github.com/weppos/publicsuffix-go/publicsuffix/rules.go | awk '{ print "::set-output name=body::" $1 " additions and " $2 " removals." }'
id: diff
- run: git add vendor go.mod go.sum
- run: git commit -m "Update Public Suffix List"
- run: git push origin ${{ steps.branch.outputs.name }}
- run: echo ::set-output name=name::$(gh repo view --json defaultBranchRef --jq .defaultBranchRef.name)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: default_branch
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.CREATE_PR_PAT }}
script: |
github.rest.pulls.create({
title: 'Update Public Suffix List',
body: '${{ steps.diff.outputs.body }}',
owner: context.repo.owner,
repo: context.repo.repo,
head: '${{ steps.branch.outputs.name }}',
base: '${{ steps.default_branch.outputs.name }}'
})