Skip to content

Commit

Permalink
delete branch if generated by push-pr workflow (used to generate bu…
Browse files Browse the repository at this point in the history
…ilds of PRs from forks)
  • Loading branch information
twrichards committed Jan 26, 2024
1 parent 97682e2 commit f046365
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,21 @@ jobs:
npm install-clean
npm test
npm run build
- name: delete branch if generated by `push-pr` workflow (used to generate builds of PRs from forks)
if: "github.event_name == 'push' && github.ref_type == 'branch' && startsWith(github.ref, 'pr')"
run: |
git push origin --delete ${{ github.ref }}
- name: on PRs from forks, comment on PR with link to 'push-pr' workflow for @guardian/digital-cms members
if: "github.event.pull_request.head.repo.fork"
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Hey @guardian/digital-cms, this PR is from a fork. Brilliant that people are contributing from outside the organisation but please check there's nothing malicious/problematic... when you're happy and you need a deployable, run the [push-pr workflow]("").'
})
- uses: aws-actions/configure-aws-credentials@v4
if: "! github.event.pull_request.head.repo.fork"
with:
Expand Down

0 comments on commit f046365

Please sign in to comment.