Attempt to move diff generation to this repository #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate | |
on: | |
push: | |
branches: | |
- main | |
pull_request: {} | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: Ref of aj-foster/open-api-generator | |
required: true | |
type: string | |
permissions: | |
contents: write | |
jobs: | |
generate: | |
name: Generate Diff | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Ref (Push) | |
if: github.event_name == 'pull_request' | |
run: | | |
echo "REF=main" >> $GITHUB_ENV | |
- name: Setup Ref (Pull Request) | |
if: github.event_name == 'pull_request' | |
run: | | |
echo "REF=$GITHUB_HEAD_REF" >> $GITHUB_ENV | |
- name: Setup Ref (Workflow Dispatch) | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
echo "REF=${{ inputs.ref }}" >> $GITHUB_ENV | |
- name: Checkout (Diffs) | |
uses: actions/checkout@v4 | |
with: | |
repository: "aj-foster/open-api-diffs" | |
ref: reduced | |
path: diffs | |
- name: Checkout (Generator) | |
uses: actions/checkout@v4 | |
with: | |
repository: "aj-foster/open-api-generator" | |
path: generator | |
- name: Setup BEAM | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: "27.0" | |
elixir-version: "1.17.1" | |
- name: Generate Code | |
run: | | |
cd diffs/ | |
elixir generate.exs "$REF" | |
- name: Save Code | |
run: | | |
cd generator/ | |
git checkout --orphan temporary-branch | |
git rm -rf . | |
mv ../diffs/output . | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add output/ | |
git commit -m "Generated output for aj-foster/open-api-generator@$REF" | |
git tag -f "_diff/$REF" | |
git push --tags --force |