add_file #748
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: Add a new file to the package index | |
on: | |
repository_dispatch: | |
types: | |
- add_file | |
workflow_dispatch: | |
inputs: | |
package_name: | |
description: Package name | |
required: true | |
href: | |
description: Package file href | |
required: true | |
hash_name: | |
description: Package hash name | |
required: true | |
default: sha256 | |
hash_value: | |
description: Package hash value | |
required: true | |
jobs: | |
add-file: | |
name: Add a new file to the package index | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Add the new file (on repository dispatch) | |
if: github.event_name == 'repository_dispatch' | |
run: | | |
echo "PACKAGE_NAME=${{ github.event.client_payload.package_name }}" >> $GITHUB_ENV | |
docker compose run --user="$(id -u):$(id -g)" --no-TTY add-file ${{ github.event.client_payload.package_name }} ${{ github.event.client_payload.href }} ${{ github.event.client_payload.hash_name }} ${{ github.event.client_payload.hash_value }} | |
- name: Add the new file (on workflow dispatch) | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
echo "PACKAGE_NAME=${{ github.event.inputs.package_name }}" >> $GITHUB_ENV | |
docker compose run --user="$(id -u):$(id -g)" --no-TTY add-file ${{ github.event.inputs.package_name }} ${{ github.event.inputs.href }} ${{ github.event.inputs.hash_name }} ${{ github.event.inputs.hash_value }} | |
- name: Create pull request | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
body: Add a file for ${{ env.PACKAGE_NAME }} to the index | |
branch: add-file-to-index | |
branch-suffix: random | |
commit-message: Add a file for ${{ env.PACKAGE_NAME }} to the index | |
delete-branch: true | |
title: Add a file for ${{ env.PACKAGE_NAME }} to the index |