Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider revising GitHub Actions workflows for maintainability #1037

Closed
matthewfeickert opened this issue Feb 3, 2023 · 1 comment
Closed

Comments

@matthewfeickert
Copy link
Contributor

matthewfeickert commented Feb 3, 2023

I see in your comment above that more cleaning could be done, that could be a great idea, feel free to tell us more about that!

Sure. Some of this is just matters of preference, and obviously whatever works best for you is what you should do, but I've found it easier to maintain GitHub Actions workflows by separating them out into multiple workflows rather than having them all exist in one, like you normally would do for Travis CI, GitLab pipelines, etc. So for example, the

analyse:
name: Analyse
needs: skip_duplicate
if: ${{ needs.skip_duplicate.outputs.should_skip == 'false' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can check out the head.
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Override language selection
with:
languages: python, javascript
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

job doesn't need to live in your CI workflow, but could exist as a separate codeql-analysis.yml workflow.

Also, unless I'm mistaken about its purpose, the

skip_duplicate:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
github_token: ${{ github.token }}

can be replaced with GitHub Actions concurrency control (c.f. https://docs.github.com/en/actions/using-jobs/using-concurrency). i.e. something like

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

Originally posted by @matthewfeickert in #1035 (comment)

This was referenced Feb 19, 2023
@mwouts
Copy link
Owner

mwouts commented Jun 24, 2023

Fixed by #1084

@mwouts mwouts closed this as completed Jun 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants