From e6a17eaf77462daddf1411b7f86ffb0c72545fdf Mon Sep 17 00:00:00 2001 From: David Leal Date: Mon, 12 Jun 2023 17:32:38 +0000 Subject: [PATCH 1/2] Create PR rather than direct commit (directory workflow) --- directory_md/action.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/directory_md/action.yml b/directory_md/action.yml index 6f7edc3..dd1edc6 100644 --- a/directory_md/action.yml +++ b/directory_md/action.yml @@ -26,18 +26,27 @@ runs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.10' # or whatever version you support + python-version: '3.x' - name: Setup Git configurations shell: bash run: | git config --global user.name github-actions[bot] git config --global user.email 'github-actions@users.noreply.github.com' - - name: Running the formatter + - name: Running the directory builder shell: bash run: | python build_directory_md.py ${{ inputs.language }} ${{ inputs.working-directory }} ${{ inputs.filetypes }} ${{ inputs.ignored-directories }} ${{ inputs.ignore-folders-children }} > DIRECTORY.md - name: Committing changes shell: bash run: | - git commit -m "chore: update `DIRECTORY.md`" DIRECTORY.md || true - git push origin HEAD:$GITHUB_REF || true + git branch directory-update + git checkout directory-update + + git commit -m "docs: update `DIRECTORY.md`" DIRECTORY.md || true + git push origin directory-update:directory-update + - name: Creating a pull request + shell: bash + run: | + if [[ `git status --porcelain` ]]; then + gh pr create --base ${GITHUB_REF##*/} --head directory-update --title 'docs: updating `DIRECTORY.md`' --body 'Updated the `DIRECTORY.md` file (see the diff. for changes).' || true + # `true` is needed in case the PR has been already created to prevent the CI to fail. The changes will already be pushed to the current PR's branch. From c454b84db8d430c795d3766a98e4adf35019cd7b Mon Sep 17 00:00:00 2001 From: David Leal Date: Tue, 13 Jun 2023 10:25:48 -0600 Subject: [PATCH 2/2] chore: apply suggestions from code review Co-authored-by: Taj --- directory_md/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/directory_md/action.yml b/directory_md/action.yml index dd1edc6..19a007c 100644 --- a/directory_md/action.yml +++ b/directory_md/action.yml @@ -43,7 +43,7 @@ runs: git checkout directory-update git commit -m "docs: update `DIRECTORY.md`" DIRECTORY.md || true - git push origin directory-update:directory-update + git push origin directory-update:directory-update --force - name: Creating a pull request shell: bash run: |