Skip to content

Commit

Permalink
Update workflow to create a PR
Browse files Browse the repository at this point in the history
Signed-off-by: Al-HusseinHameedJasim <[email protected]>
  • Loading branch information
Al-HusseinHameedJasim committed Jun 3, 2024
1 parent a8fc999 commit 67ea211
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/green-talks-scraper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,22 @@ jobs:
run: |
chmod +x green-talks-scraper/scraper.sh
./green-talks-scraper/scraper.sh >> green-talks-scraper/talks.md
- name: Commit file
run: |
# Check if "talks.md" has been modified
if git diff --name-only | grep "talks.md" || git ls-files --others --exclude-standard | grep "talks.md"; then
BRANCH_NAME="update-talks-$(date +'%Y%m%d%H%M')"
git config --local user.email "[email protected]"
git config --local user.name "green-talks-scraper-workflow"
git checkout -b $BRANCH_NAME
git add green-talks-scraper/talks.md
git commit -m "Update the green talks list [skip actions]"
echo "FILE_COMMITTED=true" >> $GITHUB_ENV # Set an environment variable
git remote set-url origin https://${GH_TOKEN}@github.com/cncf-tags/tag-env-tooling.git
git push --set-upstream origin $BRANCH_NAME -f
gh pr create --base main --head $BRANCH_NAME --title "Update the list of talks" --body "Update the list of talks"
else
echo "The list of talks is up to date"
fi
- name: Push changes
if: env.FILE_COMMITTED == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.MY_GITHUB_TOKEN }}
force: true
env:
GH_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}

0 comments on commit 67ea211

Please sign in to comment.