Skip to content

Fork puppet-puppet

Fork puppet-puppet #61

Workflow file for this run

name: fork
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'requests/fork/*.yml'
- 'requests/fork/*.yaml'
env:
ROOT_DIR: "./requests/fork"
SCRIPTS_DIR: ".github/workflows/scripts/fork"
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_PR: ${{ github.event.number }}
GITHUB_ORG: "wayfair-contribs"
LICENSE_STRING: "0bsd\napache-2.0\nbsd-2-clause\nbsd-3-clause\nmit"
jobs:
demo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: 🍠 lint yaml
uses: ibiqlik/action-yamllint@v3
with:
file_or_dir: 'requests/fork/**'
config_file: '.yamllint.yml'
- name: 📑 parse request
run: ${SCRIPTS_DIR}/parse.sh
shell: bash
- name: 🚨 handle error
if: ${{ failure() }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.OSPO_API_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "🚨 Hey @${{ env.GITHUB_ACTOR }}, looks like there was an issue processing your fork request! \
Please ensure you've committed a properly-formatted YAML (`.yml`) file to the `requests/fork/` directory."
})
- name: ✅ approve PR
if: ${{ success() }}
uses: hmarr/auto-approve-action@v3
with:
github-token: ${{ secrets.OSPO_API_TOKEN }}
- name: 🚀 create fork
uses: wayfair-incubator/[email protected]
with:
token: ${{ secrets.OSPO_API_TOKEN }}
repo: ${{ env.REPO_NAME }}
owner: ${{ env.REPO_OWNER }}
org: ${{ env.GITHUB_ORG }}
user: ${{ env.GITHUB_USER }}
checkUser: true
promoteUser: ${{ env.PROMOTE_USER }}
licenseAllowlist: ${{ env.LICENSE_STRING }}
id: fork
- name: 💬 add comment
if: ${{ success() }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.OSPO_API_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "🎉 All set @${{ env.GITHUB_ACTOR }}! \
Here's your fork: ${{ steps.fork.outputs.forkUrl }}"
})
- name: 📦 process request
if: ${{ success() }}
run: |
${SCRIPTS_DIR}/move.sh
${SCRIPTS_DIR}/push.sh
shell: bash