Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created October 2, 2022 16:46
Show Gist options
  • Select an option

  • Save KyMidd/1f4ebac3d9a92c346eeb254bcb53d3e9 to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/1f4ebac3d9a92c346eeb254bcb53d3e9 to your computer and use it in GitHub Desktop.
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Identify PR commit
run: |
# Interestingly, GITHUB Actions are served a git log with an extra commit
# Genuinely no idea why, so we grab the appropriate commit from the log
commit_sha=$(git log | grep commit | sed -n 2p | cut -d " " -f 2)
# Write commit sha to GITHUB_ENV so downstream tasks can use it
echo "commit_sha=$commit_sha" | tee -a $GITHUB_ENV
- name: Jenkins Any PR Validate
id: jenkins_any_pr_validate
uses: your-internal-org/repo-with-action-in-it@v1 # Note, the `v1` refers to a "release" of your Action
with:
jenkins-username: "${{ secrets.JENKINS_USERNAME_FOR_RUNNING_JOB }}" # Store the secrets Org wide so all can access
jenkins-api-token: "${{ secrets.JENKINS_API_TOKEN_FOR_RUNNING_JOBS }}" # Store this API secret Org wide so all can access
github_repository: $GITHUB_REPOSITORY # This is a GitHub well known environment var
commit_sha: ${{ env.commit_sha }} # This is populated by us above
branch: $GITHUB_HEAD_REF # This is a GitHub well known environment var
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment