[Idea]: Folia support for OpenInv #196

Closed
reabuc wants to merge 137 commits from master into master
77 changed files with 7445 additions and 3042 deletions
Showing only changes of commit 2d36249dbb - Show all commits

View File

@@ -2,7 +2,7 @@ name: Auto-merge Dependabot PRs
on: on:
workflow_run: workflow_run:
workflows: [ "OpenInv CI" ] workflows: [ "Pull Request" ]
types: [ completed ] types: [ completed ]
jobs: jobs:
@@ -12,15 +12,44 @@ jobs:
&& github.event.workflow_run.conclusion == 'success'" && github.event.workflow_run.conclusion == 'success'"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
# Note: this is directly from GitHub's example for using data from a triggering workflow:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow
- name: 'Download artifact'
uses: actions/github-script@v6
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr_number"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_number.zip`, Buffer.from(download.data));
# This might be a useless use of cat, but I'm not sure what shell Actions is going to be running.
- name: Add Pull Number Variable
run: |-
unzip pr_number.zip
echo "PR_NUMBER=$(cat pr_number)" >> "$GITHUB_ENV"
- name: Approve - name: Approve
uses: hmarr/auto-approve-action@v3.2.1 uses: hmarr/auto-approve-action@v3.2.1
with: with:
github-token: "${{ secrets.GITHUB_TOKEN }}" github-token: "${{ secrets.GITHUB_TOKEN }}"
pull-request-number: "${{ github.event.workflow_run.event.pull_request.id }}" pull-request-number: "${{ env.PR_NUMBER }}"
- name: Merge - name: Merge
uses: pascalgn/automerge-action@v0.15.6 uses: pascalgn/automerge-action@v0.15.6
env: env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_LABELS: "dependencies,java" MERGE_LABELS: "dependencies,java"
MERGE_METHOD: "squash" MERGE_METHOD: "squash"
PULL_REQUEST: "${{ github.event.workflow_run.event.pull_request.id }}" PULL_REQUEST: "${{ env.PR_NUMBER }}"

View File

@@ -2,7 +2,12 @@ name: OpenInv CI
on: on:
push: push:
pull_request: branches:
- '**'
tags-ignore:
- '**'
# Enable running CI via other Actions, i.e. for drafting releases and handling PRs.
workflow_call:
jobs: jobs:
build: build:

View File

@@ -1,15 +1,16 @@
name: Draft Github Release name: Draft Github Release
on: on:
workflow_run: push:
workflows: [ "OpenInv CI" ] tags:
types: [ completed ] - '**'
jobs: jobs:
draft_release: run-ci:
if: "github.event.workflow_run.event == 'push' runs-on: ubuntu-latest
&& github.event.workflow_run.conclusion == 'success' uses: Jikoo/OpenInv/.github/workflows/ci.yml@master
&& startsWith(github.event.workflow_run.event.push.ref, 'refs/tags/')" draft-release:
needs: [ run-ci ]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
# Fetch all history - used to assemble changelog. # Fetch all history - used to assemble changelog.
@@ -21,15 +22,10 @@ jobs:
run: bash ./scripts/set_release_env.sh run: bash ./scripts/set_release_env.sh
- name: Download Artifact - name: Download Artifact
# Unfortunately actions/download-artifact cannot fetch from other workflow runs. uses: actions/download-artifact@v3
uses: dawidd6/action-download-artifact@v2.26.0
with: with:
name: dist name: dist
path: dist path: dist
run_id: "${{ github.event.workflow_run.id }}"
run_number: "${{ github.event.workflow_run.run_number }}"
# Searching for a specific run ID that we know was successful, unset 'success' default.
workflow_conclusion: ""
- name: Create Release - name: Create Release
id: create-release id: create-release

23
.github/workflows/pull_request.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: Pull Request
on:
pull_request:
jobs:
run-ci:
runs-on: ubuntu-latest
uses: Jikoo/OpenInv/.github/workflows/ci.yml@master
store-dependabot-pr-data:
if: "github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'"
runs-on: ubuntu-latest
steps:
# Note: this is directly from GitHub's example for using data from a triggering workflow:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow
- name: Store Pull Number
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/pr_number
- uses: actions/upload-artifact@v3
with:
name: pr_number
path: pr/