Skip to content

Commit

Permalink
Fix PSL target branch acquisition (#6209)
Browse files Browse the repository at this point in the history
It turns out that `github.event.repository.default_branch` doesn't
exist when the action is triggered by cron (though it does exist
when the action is triggered manually, which I would expect to
be nearly identical...). So instead add a step to acquire the default
branch name from the API and use that as the target branch instead.
  • Loading branch information
aarongable authored Jul 1, 2022
1 parent b825594 commit 67e3aa9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/update-psl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
schedule:
# Run monthly at a random (https://xkcd.com/221/) time.
- cron: '46 8 1 * *'
- cron: '46 16 1 * *'

permissions:
contents: write
Expand Down Expand Up @@ -39,6 +39,11 @@ jobs:
- 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:
script: |
Expand All @@ -48,5 +53,5 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
head: '${{ steps.branch.outputs.name }}',
base: '${{ github.event.repository.default_branch }}'
base: '${{ steps.default_branch.outputs.name }}'
})

0 comments on commit 67e3aa9

Please sign in to comment.