Closed vsoch closed 4 years ago
@vsoch Just a minor note but I've been seeing some error checking failures in the code even though you have set -e
but that's probably for another issue.
@sgnn7 can you show me where you've tested this? You can test directly from this branch:
steps:
- name: pull-request-action
uses: vsoch/pull-request-action@add/support-null-branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
...
I won't do any kind of merge and release until you've been able to plug this into a workflow and verify it resolves the issue you were having.
And yes please also report any issues that you see so they might be addressed.
@vsoch let me test that and I'll ping you back here on the results
@vsoch It's working! :)
PS: Some of these links might disappear as I continue to work on this.
Haha, I think the repository is private so I can't actually see any of them :) Let me quickly test on my testing branch to make sure the old way works, and if that works (and you still give the A-OK) we can release. Back in a bit!
ah darn it - forgot that the playroom repo is locked up but it does work for the release:[published]
case for sure. I'll tack on some screenshots.
okay sounds good :) I'm testing on my repository now, should know shortly as well.
Code:
on:
release:
types:
- published
...
jobs:
persist-new-suite-yml:
name: Commit Suite Release YML
runs-on: ubuntu-latest
steps:
...
- name: Set BRANCH_NAME
run: |
tag_name=${{github.event.release.tag_name}}
echo "Tag: $tag_name"
version=$(echo "$tag_name" | sed 's/^v//')
echo "Version: $version"
echo "::set-output name=suite_version::${version}"
echo "::set-output name=suite_update_branch::suite_${version}"
id: data
- name: Permanently save the new suite release
run: |
mkdir -p releases
new_suite_version_yml="releases/suite_${{ steps.data.outputs.suite_version }}.yml"
echo "Suite target file: $new_suite_version_yml"
cp suite.yml "${new_suite_version_yml}"
git add "${new_suite_version_yml}"
git commit -m "Suite v${{ steps.data.outputs.suite_version }} auto-commit of new release files"
- name: Push files
run: |
git push --force "https://${{ github.actor }}:${{secrets.GITHUB_TOKEN}}@github.com/${{ github.repository }}.git" "HEAD:${{ steps.data.outputs.suite_update_branch }}"
- name: Open a PR to the default branch
uses: vsoch/pull-request-action@add/support-null-branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_REQUEST_FROM_BRANCH: "${{ steps.data.outputs.suite_update_branch }}"
PULL_REQUEST_BRANCH: master
PULL_REQUEST_TITLE: "Action: Update suite release file for v${{ steps.data.outputs.suite_version }}"
PULL_REQUEST_BODY: "Auto-generated PR!"
This is beautiful - mine worked as well! If it's alright with you, can I add your recipe to an examples folder? I think it's a likely and useful use case, and better than the dummy example that I provided.
Absolutely :) 👍
(the branch name of the action might need to be updated though)
Yep just did that, I'm updating to 1.0.2 so that it will coincide with the release of it. Coming soon!
This will add support for
PULL_REQUEST_FROM_BRANCH
, which is honored either in place of deriving the branch from the payload, or absolutely required. This includes commits from #21 and should close #20 .